diff --git itests/util/src/main/java/org/apache/hadoop/hive/cli/control/CliConfigs.java itests/util/src/main/java/org/apache/hadoop/hive/cli/control/CliConfigs.java index cc74804..f12b786 100644 --- itests/util/src/main/java/org/apache/hadoop/hive/cli/control/CliConfigs.java +++ itests/util/src/main/java/org/apache/hadoop/hive/cli/control/CliConfigs.java @@ -64,7 +64,6 @@ excludeQuery("udaf_context_ngrams.q"); // disabled in HIVE-20741 excludeQuery("udaf_corr.q"); // disabled in HIVE-20741 excludeQuery("udaf_histogram_numeric.q"); // disabled in HIVE-20715 - excludeQuery("stat_estimate_related_col.q"); // disabled in HIVE-20727 excludeQuery("vector_groupby_reduce.q"); // Disabled in HIVE-21396 setResultsDir("ql/src/test/results/clientpositive"); diff --git ql/src/test/queries/clientpositive/stat_estimate_related_col.q ql/src/test/queries/clientpositive/stat_estimate_related_col.q index 54deb5b..5aa380f 100644 --- ql/src/test/queries/clientpositive/stat_estimate_related_col.q +++ ql/src/test/queries/clientpositive/stat_estimate_related_col.q @@ -1,5 +1,8 @@ -- disable cbo because calcite can see thru these test cases; the goal here is to test the annotation processing set hive.cbo.enable=false; + +set hive.semantic.analyzer.hook=org.apache.hadoop.hive.ql.hooks.AccurateEstimatesCheckerHook; +set accurate.estimate.checker.absolute.error=5; set hive.explain.user=true; set hive.strict.checks.cartesian.product=false; @@ -36,6 +39,9 @@ explain analyze select sum(a) from t8 where b in (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50) and b=2 and b=2 and 2=b group by b; explain analyze select sum(a) from t8 where b=2 and (b = 1 or b=2) group by b; + +set accurate.estimate.checker.absolute.error=8; + explain analyze select sum(a) from t8 where b=2 and (b = 1 or b=2) and (b=1 or b=3) group by b; explain analyze select sum(a) from t8 where diff --git ql/src/test/results/clientpositive/stat_estimate_related_col.q.out ql/src/test/results/clientpositive/stat_estimate_related_col.q.out index a041e51..8546612 100644 --- ql/src/test/results/clientpositive/stat_estimate_related_col.q.out +++ ql/src/test/results/clientpositive/stat_estimate_related_col.q.out @@ -93,18 +93,20 @@ TableScan alias: t8 filterExpr: (b) IN (2, 3) (type: boolean) - Statistics: Num rows: 40/1 Data size: 320 Basic stats: COMPLETE Column stats: COMPLETE + Statistics: Num rows: 40/40 Data size: 320 Basic stats: COMPLETE Column stats: COMPLETE Filter Operator predicate: (b) IN (2, 3) (type: boolean) - Statistics: Num rows: 16/1 Data size: 128 Basic stats: COMPLETE Column stats: COMPLETE + Statistics: Num rows: 16/16 Data size: 128 Basic stats: COMPLETE Column stats: COMPLETE Group By Operator aggregations: sum(a) keys: b (type: int) + minReductionHashAggr: 0.99 mode: hash outputColumnNames: _col0, _col1 - Statistics: Num rows: 2/1 Data size: 24 Basic stats: COMPLETE Column stats: COMPLETE + Statistics: Num rows: 2/2 Data size: 24 Basic stats: COMPLETE Column stats: COMPLETE Reduce Output Operator key expressions: _col0 (type: int) + null sort order: z sort order: + Map-reduce partition columns: _col0 (type: int) Statistics: Num rows: 2/2 Data size: 24 Basic stats: COMPLETE Column stats: COMPLETE @@ -162,22 +164,24 @@ TableScan alias: t8 filterExpr: (b = 2) (type: boolean) - Statistics: Num rows: 40/1 Data size: 320 Basic stats: COMPLETE Column stats: COMPLETE + Statistics: Num rows: 40/40 Data size: 320 Basic stats: COMPLETE Column stats: COMPLETE Filter Operator predicate: (b = 2) (type: boolean) - Statistics: Num rows: 8/1 Data size: 64 Basic stats: COMPLETE Column stats: COMPLETE + Statistics: Num rows: 8/8 Data size: 64 Basic stats: COMPLETE Column stats: COMPLETE Select Operator expressions: a (type: int) outputColumnNames: a - Statistics: Num rows: 8/1 Data size: 64 Basic stats: COMPLETE Column stats: COMPLETE + Statistics: Num rows: 8/8 Data size: 64 Basic stats: COMPLETE Column stats: COMPLETE Group By Operator aggregations: sum(a) keys: 2 (type: int) + minReductionHashAggr: 0.99 mode: hash outputColumnNames: _col0, _col1 Statistics: Num rows: 1/1 Data size: 12 Basic stats: COMPLETE Column stats: COMPLETE Reduce Output Operator key expressions: 2 (type: int) + null sort order: z sort order: + Map-reduce partition columns: 2 (type: int) Statistics: Num rows: 1/1 Data size: 12 Basic stats: COMPLETE Column stats: COMPLETE @@ -235,7 +239,7 @@ TableScan alias: t1 filterExpr: ((2 = b) and (b = 2)) (type: boolean) - Statistics: Num rows: 5/1 Data size: 40 Basic stats: COMPLETE Column stats: COMPLETE + Statistics: Num rows: 5/5 Data size: 40 Basic stats: COMPLETE Column stats: COMPLETE Filter Operator predicate: ((2 = b) and (b = 2)) (type: boolean) Statistics: Num rows: 1/1 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE @@ -246,11 +250,13 @@ Group By Operator aggregations: sum(a) keys: 2 (type: int) + minReductionHashAggr: 0.99 mode: hash outputColumnNames: _col0, _col1 Statistics: Num rows: 1/1 Data size: 12 Basic stats: COMPLETE Column stats: COMPLETE Reduce Output Operator key expressions: 2 (type: int) + null sort order: z sort order: + Map-reduce partition columns: 2 (type: int) Statistics: Num rows: 1/1 Data size: 12 Basic stats: COMPLETE Column stats: COMPLETE @@ -307,10 +313,10 @@ Map Operator Tree: TableScan alias: t1 - filterExpr: ((b) IN (2, 3) and (b = 2)) (type: boolean) - Statistics: Num rows: 5/1 Data size: 40 Basic stats: COMPLETE Column stats: COMPLETE + filterExpr: (((b = 2) or (b = 3)) and (b = 2)) (type: boolean) + Statistics: Num rows: 5/5 Data size: 40 Basic stats: COMPLETE Column stats: COMPLETE Filter Operator - predicate: ((b = 2) and (b) IN (2, 3)) (type: boolean) + predicate: (((b = 2) or (b = 3)) and (b = 2)) (type: boolean) Statistics: Num rows: 1/1 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE Select Operator expressions: a (type: int) @@ -319,11 +325,13 @@ Group By Operator aggregations: sum(a) keys: 2 (type: int) + minReductionHashAggr: 0.99 mode: hash outputColumnNames: _col0, _col1 Statistics: Num rows: 1/1 Data size: 12 Basic stats: COMPLETE Column stats: COMPLETE Reduce Output Operator key expressions: 2 (type: int) + null sort order: z sort order: + Map-reduce partition columns: 2 (type: int) Statistics: Num rows: 1/1 Data size: 12 Basic stats: COMPLETE Column stats: COMPLETE @@ -380,23 +388,25 @@ Map Operator Tree: TableScan alias: t8 - filterExpr: ((b) IN (2, 3) and (b = 2)) (type: boolean) - Statistics: Num rows: 40/1 Data size: 320 Basic stats: COMPLETE Column stats: COMPLETE + filterExpr: (((b = 2) or (b = 3)) and (b = 2)) (type: boolean) + Statistics: Num rows: 40/40 Data size: 320 Basic stats: COMPLETE Column stats: COMPLETE Filter Operator - predicate: ((b = 2) and (b) IN (2, 3)) (type: boolean) - Statistics: Num rows: 8/1 Data size: 64 Basic stats: COMPLETE Column stats: COMPLETE + predicate: (((b = 2) or (b = 3)) and (b = 2)) (type: boolean) + Statistics: Num rows: 3/8 Data size: 24 Basic stats: COMPLETE Column stats: COMPLETE Select Operator expressions: a (type: int) outputColumnNames: a - Statistics: Num rows: 8/1 Data size: 64 Basic stats: COMPLETE Column stats: COMPLETE + Statistics: Num rows: 3/8 Data size: 24 Basic stats: COMPLETE Column stats: COMPLETE Group By Operator aggregations: sum(a) keys: 2 (type: int) + minReductionHashAggr: 0.99 mode: hash outputColumnNames: _col0, _col1 Statistics: Num rows: 1/1 Data size: 12 Basic stats: COMPLETE Column stats: COMPLETE Reduce Output Operator key expressions: 2 (type: int) + null sort order: z sort order: + Map-reduce partition columns: 2 (type: int) Statistics: Num rows: 1/1 Data size: 12 Basic stats: COMPLETE Column stats: COMPLETE @@ -461,6 +471,7 @@ Statistics: Num rows: 8/8 Data size: 32 Basic stats: COMPLETE Column stats: COMPLETE Reduce Output Operator key expressions: 3 (type: int) + null sort order: z sort order: + Map-reduce partition columns: 3 (type: int) Statistics: Num rows: 8/8 Data size: 32 Basic stats: COMPLETE Column stats: COMPLETE @@ -473,6 +484,7 @@ Statistics: Num rows: 8/8 Data size: 32 Basic stats: COMPLETE Column stats: COMPLETE Reduce Output Operator key expressions: 3 (type: int) + null sort order: z sort order: + Map-reduce partition columns: 3 (type: int) Statistics: Num rows: 8/8 Data size: 32 Basic stats: COMPLETE Column stats: COMPLETE @@ -486,6 +498,7 @@ Statistics: Num rows: 64/64 Data size: 512 Basic stats: COMPLETE Column stats: COMPLETE Group By Operator aggregations: count() + minReductionHashAggr: 0.99 mode: hash outputColumnNames: _col0 Statistics: Num rows: 1/1 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE @@ -501,6 +514,7 @@ Map Operator Tree: TableScan Reduce Output Operator + null sort order: sort order: Statistics: Num rows: 1/1 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE value expressions: _col0 (type: bigint) @@ -552,22 +566,24 @@ TableScan alias: t8 filterExpr: ((b) IN (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50) and (b = 2) and (2 = b)) (type: boolean) - Statistics: Num rows: 40/1 Data size: 320 Basic stats: COMPLETE Column stats: COMPLETE + Statistics: Num rows: 40/40 Data size: 320 Basic stats: COMPLETE Column stats: COMPLETE Filter Operator - predicate: ((2 = b) and (b = 2) and (b) IN (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50)) (type: boolean) - Statistics: Num rows: 8/1 Data size: 64 Basic stats: COMPLETE Column stats: COMPLETE + predicate: ((b) IN (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50) and (b = 2) and (2 = b)) (type: boolean) + Statistics: Num rows: 8/8 Data size: 64 Basic stats: COMPLETE Column stats: COMPLETE Select Operator expressions: a (type: int) outputColumnNames: a - Statistics: Num rows: 8/1 Data size: 64 Basic stats: COMPLETE Column stats: COMPLETE + Statistics: Num rows: 8/8 Data size: 64 Basic stats: COMPLETE Column stats: COMPLETE Group By Operator aggregations: sum(a) keys: 2 (type: int) + minReductionHashAggr: 0.99 mode: hash outputColumnNames: _col0, _col1 Statistics: Num rows: 1/1 Data size: 12 Basic stats: COMPLETE Column stats: COMPLETE Reduce Output Operator key expressions: 2 (type: int) + null sort order: z sort order: + Map-reduce partition columns: 2 (type: int) Statistics: Num rows: 1/1 Data size: 12 Basic stats: COMPLETE Column stats: COMPLETE @@ -625,22 +641,24 @@ TableScan alias: t8 filterExpr: ((b = 2) and ((b = 1) or (b = 2))) (type: boolean) - Statistics: Num rows: 40/1 Data size: 320 Basic stats: COMPLETE Column stats: COMPLETE + Statistics: Num rows: 40/40 Data size: 320 Basic stats: COMPLETE Column stats: COMPLETE Filter Operator - predicate: (((b = 1) or (b = 2)) and (b = 2)) (type: boolean) - Statistics: Num rows: 8/1 Data size: 64 Basic stats: COMPLETE Column stats: COMPLETE + predicate: ((b = 2) and ((b = 1) or (b = 2))) (type: boolean) + Statistics: Num rows: 8/8 Data size: 64 Basic stats: COMPLETE Column stats: COMPLETE Select Operator expressions: a (type: int) outputColumnNames: a - Statistics: Num rows: 8/1 Data size: 64 Basic stats: COMPLETE Column stats: COMPLETE + Statistics: Num rows: 8/8 Data size: 64 Basic stats: COMPLETE Column stats: COMPLETE Group By Operator aggregations: sum(a) keys: 2 (type: int) + minReductionHashAggr: 0.99 mode: hash outputColumnNames: _col0, _col1 Statistics: Num rows: 1/1 Data size: 12 Basic stats: COMPLETE Column stats: COMPLETE Reduce Output Operator key expressions: 2 (type: int) + null sort order: z sort order: + Map-reduce partition columns: 2 (type: int) Statistics: Num rows: 1/1 Data size: 12 Basic stats: COMPLETE Column stats: COMPLETE @@ -698,9 +716,9 @@ TableScan alias: t8 filterExpr: ((b = 2) and ((b = 1) or (b = 2)) and ((b = 1) or (b = 3))) (type: boolean) - Statistics: Num rows: 40/1 Data size: 320 Basic stats: COMPLETE Column stats: COMPLETE + Statistics: Num rows: 40/40 Data size: 320 Basic stats: COMPLETE Column stats: COMPLETE Filter Operator - predicate: (((b = 1) or (b = 2)) and ((b = 1) or (b = 3)) and (b = 2)) (type: boolean) + predicate: ((b = 2) and ((b = 1) or (b = 2)) and ((b = 1) or (b = 3))) (type: boolean) Statistics: Num rows: 8/0 Data size: 64 Basic stats: COMPLETE Column stats: COMPLETE Select Operator expressions: a (type: int) @@ -709,11 +727,13 @@ Group By Operator aggregations: sum(a) keys: 2 (type: int) + minReductionHashAggr: 0.99 mode: hash outputColumnNames: _col0, _col1 Statistics: Num rows: 1/0 Data size: 12 Basic stats: COMPLETE Column stats: COMPLETE Reduce Output Operator key expressions: 2 (type: int) + null sort order: z sort order: + Map-reduce partition columns: 2 (type: int) Statistics: Num rows: 1/0 Data size: 12 Basic stats: COMPLETE Column stats: COMPLETE @@ -787,9 +807,9 @@ TableScan alias: t8 filterExpr: ((b = 2) and ((b = 1) or (b = 2)) and (a = 3) and ((a = 3) or (a = 4))) (type: boolean) - Statistics: Num rows: 40/1 Data size: 320 Basic stats: COMPLETE Column stats: COMPLETE + Statistics: Num rows: 40/40 Data size: 320 Basic stats: COMPLETE Column stats: COMPLETE Filter Operator - predicate: (((a = 3) or (a = 4)) and ((b = 1) or (b = 2)) and (a = 3) and (b = 2)) (type: boolean) + predicate: ((b = 2) and ((b = 1) or (b = 2)) and (a = 3) and ((a = 3) or (a = 4))) (type: boolean) Statistics: Num rows: 2/0 Data size: 16 Basic stats: COMPLETE Column stats: COMPLETE Select Operator expressions: 3 (type: int) @@ -798,11 +818,13 @@ Group By Operator aggregations: sum(a) keys: 2 (type: int) + minReductionHashAggr: 0.99 mode: hash outputColumnNames: _col0, _col1 Statistics: Num rows: 1/0 Data size: 12 Basic stats: COMPLETE Column stats: COMPLETE Reduce Output Operator key expressions: 2 (type: int) + null sort order: z sort order: + Map-reduce partition columns: 2 (type: int) Statistics: Num rows: 1/0 Data size: 12 Basic stats: COMPLETE Column stats: COMPLETE