Skip to content

Commit

Permalink
[BugFix] fix analyze table with sample ratio (#55202)
Browse files Browse the repository at this point in the history
Signed-off-by: stephen <[email protected]>
  • Loading branch information
stephen-shelby authored Jan 17, 2025
1 parent eb1cb80 commit 688a26d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,11 @@ public static void analyze(StatementBase statement, ConnectContext session) {
StatsConstants.STATISTIC_SAMPLE_COLLECT_ROWS,
StatsConstants.STATISTIC_EXCLUDE_PATTERN,

StatsConstants.HIGH_WEIGHT_SAMPLE_RATIO,
StatsConstants.MEDIUM_HIGH_WEIGHT_SAMPLE_RATIO,
StatsConstants.MEDIUM_LOW_WEIGHT_SAMPLE_RATIO,
StatsConstants.LOW_WEIGHT_SAMPLE_RATIO,

StatsConstants.HISTOGRAM_BUCKET_NUM,
StatsConstants.HISTOGRAM_MCV_SIZE,
StatsConstants.HISTOGRAM_SAMPLE_RATIO,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -491,4 +491,12 @@ public void testAnalyzePredicateColumns() {
stmt = (AnalyzeStmt) analyzeSuccess("analyze table db.tbl predicate columns");
Assert.assertTrue(stmt.isUsePredicateColumns());
}

@Test
public void testAnalyzeTableWithSampleRatio() {
analyzeSuccess("analyze sample table db.tbl properties(\"high_weight_sample_ratio\" = \"0.6\")");
analyzeSuccess("analyze sample table db.tbl properties(\"medium_high_weight_sample_ratio\" = \"0.6\")");
analyzeSuccess("analyze sample table db.tbl properties(\"medium_low_weight_sample_ratio\" = \"0.6\")");
analyzeSuccess("analyze sample table db.tbl properties(\"low_weight_sample_ratio\" = \"0.6\")");
}
}

0 comments on commit 688a26d

Please sign in to comment.