From ce75e6adfec840519b09580434f3896b423a18b9 Mon Sep 17 00:00:00 2001 From: meiyi Date: Mon, 5 Aug 2024 18:34:49 +0800 Subject: [PATCH] [fix](group commit) Fix group commit debug log and improve performance (#38754) (#38841) Pick https://github.com/apache/doris/pull/38754 --- .../doris/analysis/NativeInsertStmt.java | 20 +++++++++++-------- .../org/apache/doris/qe/StmtExecutor.java | 6 +++--- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/analysis/NativeInsertStmt.java b/fe/fe-core/src/main/java/org/apache/doris/analysis/NativeInsertStmt.java index ac666020a0..524b7a90a4 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/analysis/NativeInsertStmt.java +++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/NativeInsertStmt.java @@ -1236,8 +1236,9 @@ public class NativeInsertStmt extends InsertStmt { for (Expr expr : row) { if (!(expr instanceof LiteralExpr)) { if (LOG.isDebugEnabled()) { - LOG.debug("group commit is off for table: {}, because not literal expr, " - + "expr: {}, row: {}", targetTable.getName(), expr, row); + LOG.debug("group commit is off for query_id: {}, table: {}, " + + "because not literal expr: {}, row: {}", + DebugUtil.printId(ctx.queryId()), targetTable.getName(), expr, row); } return; } @@ -1246,8 +1247,9 @@ public class NativeInsertStmt extends InsertStmt { // Does not support: insert into tbl values(); if (selectStmt.getValueList().getFirstRow().isEmpty() && CollectionUtils.isEmpty(targetColumnNames)) { if (LOG.isDebugEnabled()) { - LOG.debug("group commit is off for table: {}, because first row: {}, target columns: {}", - targetTable.getName(), selectStmt.getValueList().getFirstRow(), targetColumnNames); + LOG.debug("group commit is off for query_id: {}, table: {}, because first row: {}, " + + "target columns: {}", DebugUtil.printId(ctx.queryId()), targetTable.getName(), + selectStmt.getValueList().getFirstRow(), targetColumnNames); } return; } @@ -1259,8 +1261,10 @@ public class NativeInsertStmt extends InsertStmt { for (SelectListItem item : items) { if (item.getExpr() != null && !(item.getExpr() instanceof LiteralExpr)) { if (LOG.isDebugEnabled()) { - LOG.debug("group commit is off for table: {}, because not literal expr, " - + "expr: {}, row: {}", targetTable.getName(), item.getExpr(), item); + LOG.debug("group commit is off for query_id: {}, table: {}, " + + "because not literal expr: {}, row: {}", + DebugUtil.printId(ctx.queryId()), targetTable.getName(), item.getExpr(), + item); } return; } @@ -1273,8 +1277,8 @@ public class NativeInsertStmt extends InsertStmt { if (LOG.isDebugEnabled()) { for (Pair> pair : conditions) { if (pair.first.getAsBoolean() == false) { - LOG.debug("group commit is off for table: {}, because: {}", targetTable.getName(), - pair.second.get()); + LOG.debug("group commit is off for query_id: {}, table: {}, because: {}", + DebugUtil.printId(ctx.queryId()), targetTable.getName(), pair.second.get()); break; } } diff --git a/fe/fe-core/src/main/java/org/apache/doris/qe/StmtExecutor.java b/fe/fe-core/src/main/java/org/apache/doris/qe/StmtExecutor.java index dbab3ab395..ad4ae69b36 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/qe/StmtExecutor.java +++ b/fe/fe-core/src/main/java/org/apache/doris/qe/StmtExecutor.java @@ -347,14 +347,14 @@ public class StmtExecutor { if (expr instanceof NullLiteral) { row.addColBuilder().setValue(NULL_VALUE_FOR_LOAD); } else if (expr instanceof ArrayLiteral) { - row.addColBuilder().setValue(String.format("\"%s\"", expr.getStringValueForStreamLoad(options))); + row.addColBuilder().setValue("\"" + expr.getStringValueForStreamLoad(options) + "\""); } else { String stringValue = expr.getStringValueForStreamLoad(options); if (stringValue.equals(NULL_VALUE_FOR_LOAD) || stringValue.startsWith("\"") || stringValue.endsWith( "\"")) { - row.addColBuilder().setValue(String.format("\"%s\"", stringValue)); + row.addColBuilder().setValue("\"" + stringValue + "\""); } else { - row.addColBuilder().setValue(String.format("%s", stringValue)); + row.addColBuilder().setValue(stringValue); } } }