diff --git a/fe/fe-core/src/main/java/org/apache/doris/planner/OlapTableSink.java b/fe/fe-core/src/main/java/org/apache/doris/planner/OlapTableSink.java index 610404e03a..923c12df06 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/planner/OlapTableSink.java +++ b/fe/fe-core/src/main/java/org/apache/doris/planner/OlapTableSink.java @@ -350,8 +350,13 @@ public class OlapTableSink extends DataSink { } tPartition.setIsMutable(table.getPartitionInfo().getIsMutable(partitionId)); if (partition.getDistributionInfo().getType() == DistributionInfoType.RANDOM) { - int tabletIndex = Env.getCurrentEnv().getTabletLoadIndexRecorderMgr() - .getCurrentTabletLoadIndex(dbId, table.getId(), partition); + int tabletIndex; + if (tDataSink != null && tDataSink.type == TDataSinkType.GROUP_COMMIT_BLOCK_SINK) { + tabletIndex = 0; + } else { + tabletIndex = Env.getCurrentEnv().getTabletLoadIndexRecorderMgr() + .getCurrentTabletLoadIndex(dbId, table.getId(), partition); + } tPartition.setLoadTabletIdx(tabletIndex); } @@ -419,8 +424,13 @@ public class OlapTableSink extends DataSink { } if (partition.getDistributionInfo().getType() == DistributionInfoType.RANDOM) { - int tabletIndex = Env.getCurrentEnv().getTabletLoadIndexRecorderMgr() - .getCurrentTabletLoadIndex(dbId, table.getId(), partition); + int tabletIndex; + if (tDataSink != null && tDataSink.type == TDataSinkType.GROUP_COMMIT_BLOCK_SINK) { + tabletIndex = 0; + } else { + tabletIndex = Env.getCurrentEnv().getTabletLoadIndexRecorderMgr() + .getCurrentTabletLoadIndex(dbId, table.getId(), partition); + } tPartition.setLoadTabletIdx(tabletIndex); } partitionParam.addToPartitions(tPartition); diff --git a/fe/fe-core/src/main/java/org/apache/doris/qe/MysqlConnectProcessor.java b/fe/fe-core/src/main/java/org/apache/doris/qe/MysqlConnectProcessor.java index 1ef617cb2d..448f1b344c 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/qe/MysqlConnectProcessor.java +++ b/fe/fe-core/src/main/java/org/apache/doris/qe/MysqlConnectProcessor.java @@ -18,6 +18,7 @@ package org.apache.doris.qe; import org.apache.doris.analysis.ExecuteStmt; +import org.apache.doris.analysis.InsertStmt; import org.apache.doris.analysis.LiteralExpr; import org.apache.doris.analysis.NullLiteral; import org.apache.doris.analysis.QueryStmt; @@ -136,7 +137,10 @@ public class MysqlConnectProcessor extends ConnectProcessor { executor = new StmtExecutor(ctx, executeStmt); ctx.setExecutor(executor); executor.execute(); - stmtStr = executeStmt.toSql(); + PrepareStmtContext preparedStmtContext = ConnectContext.get().getPreparedStmt(String.valueOf(stmtId)); + if (preparedStmtContext != null && !(preparedStmtContext.stmt.getInnerStmt() instanceof InsertStmt)) { + stmtStr = executeStmt.toSql(); + } } catch (Throwable e) { // Catch all throwable. // If reach here, maybe palo bug. @@ -144,7 +148,9 @@ public class MysqlConnectProcessor extends ConnectProcessor { ctx.getState().setError(ErrorCode.ERR_UNKNOWN_ERROR, e.getClass().getSimpleName() + ", msg: " + e.getMessage()); } - auditAfterExec(stmtStr, prepareCtx.stmt.getInnerStmt(), null, false); + if (!stmtStr.isEmpty()) { + auditAfterExec(stmtStr, prepareCtx.stmt.getInnerStmt(), null, false); + } } // Process COM_QUERY statement,