fix FIMXE

This commit is contained in:
Zoltan Haindrich 2024-07-25 03:33:33 +00:00
parent d705c2759b
commit 8bb38a04a5
5 changed files with 22 additions and 8 deletions

View File

@ -117,7 +117,7 @@ public class MSQDruidMeta extends DruidMeta
RelDataType rowType = RowSignatures.toRelDataType(sig, DruidTypeSystem.TYPE_FACTORY); RelDataType rowType = RowSignatures.toRelDataType(sig, DruidTypeSystem.TYPE_FACTORY);
return Meta.Signature.create( return Meta.Signature.create(
AbstractDruidJdbcStatement.createColumnMetaData(rowType), AbstractDruidJdbcStatement.createColumnMetaData(rowType),
"FIXME some query?", druidStatement.getSqlQuery().sql(),
Collections.emptyList(), Collections.emptyList(),
Meta.CursorFactory.ARRAY, Meta.CursorFactory.ARRAY,
Meta.StatementType.SELECT Meta.StatementType.SELECT

View File

@ -94,7 +94,7 @@ order by 1;
"finalize" : true, "finalize" : true,
"maxParseExceptions" : 0, "maxParseExceptions" : 0,
"plannerStrategy" : "DECOUPLED", "plannerStrategy" : "DECOUPLED",
"sqlQueryId" : "86f85662-42c2-462f-8d1f-a692c33ebe99", "sqlQueryId" : "959637f0-a795-41f2-9cf0-f12e29361401",
"sqlStringifyArrays" : false "sqlStringifyArrays" : false
} }
} }
@ -127,8 +127,8 @@ order by 1;
"partitionCount" : 1, "partitionCount" : 1,
"shuffle" : "globalSort", "shuffle" : "globalSort",
"output" : "localStorage", "output" : "localStorage",
"startTime" : "2024-07-24T17:24:33.755Z", "startTime" : "2024-07-25T03:33:28.256Z",
"duration" : 657, "duration" : 754,
"sort" : true "sort" : true
}, { }, {
"stageNumber" : 1, "stageNumber" : 1,
@ -200,7 +200,7 @@ order by 1;
"finalize" : true, "finalize" : true,
"maxParseExceptions" : 0, "maxParseExceptions" : 0,
"plannerStrategy" : "DECOUPLED", "plannerStrategy" : "DECOUPLED",
"sqlQueryId" : "86f85662-42c2-462f-8d1f-a692c33ebe99", "sqlQueryId" : "959637f0-a795-41f2-9cf0-f12e29361401",
"sqlStringifyArrays" : false "sqlStringifyArrays" : false
} }
} }
@ -221,7 +221,7 @@ order by 1;
"workerCount" : 1, "workerCount" : 1,
"partitionCount" : 1, "partitionCount" : 1,
"output" : "localStorage", "output" : "localStorage",
"startTime" : "2024-07-24T17:24:34.412Z", "startTime" : "2024-07-25T03:33:29.010Z",
"duration" : 2 "duration" : 2
} ] } ]
!msqPlan !msqPlan

View File

@ -116,6 +116,13 @@ public class SqlQueryPlus
return new SqlQueryPlus(sql, queryContext, parameters, authResult); return new SqlQueryPlus(sql, queryContext, parameters, authResult);
} }
@Override
public String toString()
{
return "SqlQueryPlus {queryContext=" + queryContext + ", parameters=" + parameters
+ ", authResult=" + authResult + ", sql=" + sql + " }";
}
public static class Builder public static class Builder
{ {
private String sql; private String sql;

View File

@ -27,6 +27,7 @@ import org.apache.calcite.rel.type.RelDataType;
import org.apache.calcite.rel.type.RelDataTypeField; import org.apache.calcite.rel.type.RelDataTypeField;
import org.apache.calcite.sql.type.SqlTypeName; import org.apache.calcite.sql.type.SqlTypeName;
import org.apache.druid.java.util.common.ISE; import org.apache.druid.java.util.common.ISE;
import org.apache.druid.sql.SqlQueryPlus;
import org.apache.druid.sql.avatica.DruidJdbcResultSet.ResultFetcherFactory; import org.apache.druid.sql.avatica.DruidJdbcResultSet.ResultFetcherFactory;
import org.apache.druid.sql.calcite.planner.Calcites; import org.apache.druid.sql.calcite.planner.Calcites;
import org.apache.druid.sql.calcite.planner.PrepareResult; import org.apache.druid.sql.calcite.planner.PrepareResult;
@ -59,6 +60,7 @@ public abstract class AbstractDruidJdbcStatement implements Closeable
protected final ResultFetcherFactory fetcherFactory; protected final ResultFetcherFactory fetcherFactory;
protected Throwable throwable; protected Throwable throwable;
protected DruidJdbcResultSet resultSet; protected DruidJdbcResultSet resultSet;
protected SqlQueryPlus sqlQuery;
public AbstractDruidJdbcStatement( public AbstractDruidJdbcStatement(
final String connectionId, final String connectionId,
@ -246,4 +248,9 @@ public abstract class AbstractDruidJdbcStatement implements Closeable
{ {
return statementId; return statementId;
} }
public SqlQueryPlus getSqlQuery()
{
return sqlQuery;
}
} }

View File

@ -57,8 +57,8 @@ public class DruidJdbcStatement extends AbstractDruidJdbcStatement
public synchronized void execute(SqlQueryPlus queryPlus, long maxRowCount) public synchronized void execute(SqlQueryPlus queryPlus, long maxRowCount)
{ {
closeResultSet(); closeResultSet();
queryPlus = queryPlus.withContext(queryContext); this.sqlQuery = queryPlus.withContext(queryContext);
DirectStatement stmt = lifecycleFactory.directStatement(queryPlus); DirectStatement stmt = lifecycleFactory.directStatement(this.sqlQuery);
resultSet = new DruidJdbcResultSet(this, stmt, Long.MAX_VALUE, fetcherFactory); resultSet = new DruidJdbcResultSet(this, stmt, Long.MAX_VALUE, fetcherFactory);
try { try {
resultSet.execute(); resultSet.execute();