From daf0a3a0ea7d160ac8ccc26692fb71dda84bcb48 Mon Sep 17 00:00:00 2001 From: Seaven Date: Thu, 7 Nov 2024 17:16:45 +0800 Subject: [PATCH] iiiii Signed-off-by: Seaven --- fe/fe-core/src/main/java/com/starrocks/qe/StmtExecutor.java | 1 + .../com/starrocks/statistic/HyperStatisticsCollectJob.java | 2 +- .../java/com/starrocks/statistic/hyper/StatisticSQLs.java | 6 +++--- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/fe/fe-core/src/main/java/com/starrocks/qe/StmtExecutor.java b/fe/fe-core/src/main/java/com/starrocks/qe/StmtExecutor.java index 550e122aefe053..bb1f3eeda7c4c4 100644 --- a/fe/fe-core/src/main/java/com/starrocks/qe/StmtExecutor.java +++ b/fe/fe-core/src/main/java/com/starrocks/qe/StmtExecutor.java @@ -1430,6 +1430,7 @@ private void executeAnalyze(AnalyzeStmt analyzeStmt, AnalyzeStatus analyzeStatus statsConnectCtx.getSessionVariable().setStatisticCollectParallelism( context.getSessionVariable().getStatisticCollectParallelism()); statsConnectCtx.setThreadLocalInfo(); + statsConnectCtx.setStatisticsConnection(true); try { executeAnalyze(statsConnectCtx, analyzeStmt, analyzeStatus, db, table); } finally { diff --git a/fe/fe-core/src/main/java/com/starrocks/statistic/HyperStatisticsCollectJob.java b/fe/fe-core/src/main/java/com/starrocks/statistic/HyperStatisticsCollectJob.java index 0d5b28c3f39e74..60a43722d08052 100644 --- a/fe/fe-core/src/main/java/com/starrocks/statistic/HyperStatisticsCollectJob.java +++ b/fe/fe-core/src/main/java/com/starrocks/statistic/HyperStatisticsCollectJob.java @@ -161,7 +161,7 @@ private void flushInsertStatisticsData(ConnectContext context) throws Exception } private StatementBase createInsertStmt() { - String sql = "INSERT INTO column_statistics values " + String.join(", ", sqlBuffer) + ";"; + String sql = "INSERT INTO _statistics_.column_statistics values " + String.join(", ", sqlBuffer) + ";"; List names = Lists.newArrayList("column_0", "column_1", "column_2", "column_3", "column_4", "column_5", "column_6", "column_7", "column_8", "column_9", "column_10", "column_11", "column_12"); diff --git a/fe/fe-core/src/main/java/com/starrocks/statistic/hyper/StatisticSQLs.java b/fe/fe-core/src/main/java/com/starrocks/statistic/hyper/StatisticSQLs.java index 5c988e49fb7f88..6ba7c00c98cc59 100644 --- a/fe/fe-core/src/main/java/com/starrocks/statistic/hyper/StatisticSQLs.java +++ b/fe/fe-core/src/main/java/com/starrocks/statistic/hyper/StatisticSQLs.java @@ -72,10 +72,10 @@ public class StatisticSQLs { public static final String BATCH_NDV_STATISTIC_TEMPLATE = "SELECT cast($version as INT)" + ", cast($partitionId as BIGINT)" + // BIGINT, partition_id ", '$columnNameStr'" + // VARCHAR, column_name - ", 0" + // BIGINT, row_count - ", 0" + // BIGINT, data_size + ", cast(0 as BIGINT)" + // BIGINT, row_count + ", cast(0 as BIGINT)" + // BIGINT, data_size ", $hllFunction" + // VARBINARY, ndv - ", 0" + // BIGINT, null_count + ", cast(0 as BIGINT)" + // BIGINT, null_count ", ''" + // VARCHAR, max ", '' " + // VARCHAR, min " FROM `$dbName`.`$tableName` partitions(`$partitionName`)";