backport: https://github.com/apache/doris/pull/52441
This commit is contained in:
@ -124,7 +124,7 @@ public class AnalysisJob {
|
||||
// buf could be empty when nothing need to do,r for example user submit an analysis task for table with no data
|
||||
// change
|
||||
if (!buf.isEmpty()) {
|
||||
String insertStmt = "INSERT INTO " + StatisticConstants.FULL_QUALIFIED_STATS_TBL_NAME + " VALUES ";
|
||||
String insertStmt = StatisticConstants.INSERT_INTO_COLUMN_STATS_PREFIX;
|
||||
StringJoiner values = new StringJoiner(",");
|
||||
for (ColStatsData data : buf) {
|
||||
values.add(data.toSQL(true));
|
||||
|
||||
@ -69,6 +69,11 @@ public class StatisticConstants {
|
||||
public static final String FULL_QUALIFIED_STATS_TBL_NAME = InternalCatalog.INTERNAL_CATALOG_NAME
|
||||
+ "." + FeConstants.INTERNAL_DB_NAME + "." + STATISTIC_TBL_NAME;
|
||||
|
||||
public static final String INSERT_INTO_COLUMN_STATS_PREFIX =
|
||||
"INSERT INTO " + FULL_QUALIFIED_STATS_TBL_NAME + "(`id`, `catalog_id`, `db_id`, `tbl_id`, `idx_id`, "
|
||||
+ "`col_id`, `part_id`, `count`, `ndv`, `null_count`, `min`, `max`, "
|
||||
+ "`data_size_in_bytes`, `update_time`) VALUES ";
|
||||
|
||||
public static final int STATISTIC_INTERNAL_TABLE_REPLICA_NUM = 3;
|
||||
|
||||
public static final int RETRY_LOAD_QUEUE_SIZE = 1000;
|
||||
|
||||
@ -74,9 +74,10 @@ public class StatisticsRepository {
|
||||
+ FULL_QUALIFIED_COLUMN_HISTOGRAM_NAME
|
||||
+ " WHERE `id` = '${id}' AND `catalog_id` = '${catalogId}' AND `db_id` = '${dbId}'";
|
||||
|
||||
private static final String INSERT_INTO_COLUMN_STATISTICS_FOR_ALTER = "INSERT INTO "
|
||||
+ FULL_QUALIFIED_COLUMN_STATISTICS_NAME + " VALUES('${id}', ${catalogId}, ${dbId}, ${tblId}, '${idxId}',"
|
||||
+ "'${colId}', ${partId}, ${count}, ${ndv}, ${nullCount}, ${min}, ${max}, ${dataSize}, NOW())";
|
||||
private static final String INSERT_INTO_COLUMN_STATISTICS_FOR_ALTER =
|
||||
StatisticConstants.INSERT_INTO_COLUMN_STATS_PREFIX
|
||||
+ "('${id}', ${catalogId}, ${dbId}, ${tblId}, '${idxId}',"
|
||||
+ "'${colId}', ${partId}, ${count}, ${ndv}, ${nullCount}, ${min}, ${max}, ${dataSize}, NOW())";
|
||||
|
||||
private static final String DELETE_TABLE_STATISTICS_TEMPLATE = "DELETE FROM " + FeConstants.INTERNAL_DB_NAME
|
||||
+ "." + "${tblName}" + " WHERE ${condition} AND `catalog_id` = '${catalogId}' AND `db_id` = '${dbId}'";
|
||||
|
||||
@ -238,7 +238,7 @@ public class AnalysisJobTest {
|
||||
job.writeBuf();
|
||||
Assertions.assertEquals(0, job.queryFinished.size());
|
||||
Assertions.assertEquals(0, job.buf.size());
|
||||
Assertions.assertEquals("ffd6aa73b79f9228c737a6da0f4b2834", job.stmtExecutor.getContext().getSqlHash());
|
||||
Assertions.assertEquals("d8c3a1696769a1862331eec30d2c1ecb", job.stmtExecutor.getContext().getSqlHash());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user