konstantinb commented on code in PR #6505:
URL: https://github.com/apache/hive/pull/6505#discussion_r4711608112
##########
ql/src/test/results/clientpositive/llap/nested_column_pruning.q.out:
##########
@@ -1113,10 +1113,10 @@ STAGE PLANS:
Map Operator Tree:
TableScan
alias: t2
- filterExpr: ((not s2.f8.f9) and s1.f6 is not null) (type:
boolean)
+ filterExpr: (s1.f6 is not null and (not s2.f8.f9)) (type:
boolean)
Review Comment:
Consequence of the [NOT null guard in
45c29a03e3](https://github.com/apache/hive/blob/45c29a03e375b172826900f2c4f768ec9c33b7d1/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/stats/FilterSelectivityEstimator.java#L136-L142).
Estimating this nested boolean field returns null; previously NOT unboxed it
and threw an NPE. With missing column stats, the [sorter's exception
fallback](https://github.com/apache/hive/blob/85b3980f84571398351d0200800aefd020a6c153/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/rules/HiveFilterSortPredicates.java#L89-L97)
preserved the original order. Now NOT propagates null, sorting completes, and
the existing [nullsLast
comparator](https://github.com/apache/hive/blob/85b3980f84571398351d0200800aefd020a6c153/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/rules/HiveFilterSortPredicates.java#L117-L123)
places it after IS NOT NULL. Query results are unchanged; no runtime benefit
is claimed.
##########
ql/src/test/results/clientpositive/llap/orc_nested_column_pruning.q.out:
##########
@@ -1113,10 +1113,10 @@ STAGE PLANS:
Map Operator Tree:
TableScan
alias: t2
- filterExpr: ((not s2.f8.f9) and s1.f6 is not null) (type:
boolean)
+ filterExpr: (s1.f6 is not null and (not s2.f8.f9)) (type:
boolean)
Review Comment:
Same predicate-order change as in nested_column_pruning.q.out, caused by the
[NOT null guard in
45c29a03e3](https://github.com/apache/hive/blob/45c29a03e375b172826900f2c4f768ec9c33b7d1/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/stats/FilterSelectivityEstimator.java#L136-L142):
sorting now completes instead of retaining the input order after the caught
NPE, and the unknown-ranked NOT conjunct sorts last. Only EXPLAIN text changes;
query results are unchanged.
##########
ql/src/test/results/clientpositive/llap/vector_orc_nested_column_pruning.q.out:
##########
@@ -1505,16 +1505,16 @@ STAGE PLANS:
Map Operator Tree:
TableScan
alias: t2
- filterExpr: ((not s2.f8.f9) and s1.f6 is not null) (type:
boolean)
+ filterExpr: (s1.f6 is not null and (not s2.f8.f9)) (type:
boolean)
Statistics: Num rows: 1 Data size: 1468 Basic stats:
COMPLETE Column stats: NONE
TableScan Vectorization:
native: true
Filter Operator
Filter Vectorization:
className: VectorFilterOperator
native: true
- predicateExpression: FilterExprAndExpr(children:
SelectColumnIsFalse(col 10:boolean)(children: VectorUDFStructField(col
9:struct<f9:boolean,f10:array<int>,f11:map<string,boolean>>, col
0:int)(children: VectorUDFStructField(col
2:struct<f7:string,f8:struct<f9:boolean,f10:array<int>,f11:map<string,boolean>>>,
col 1:int) -> 9:struct<f9:boolean,f10:array<int>,f11:map<string,boolean>>) ->
10:boolean), SelectColumnIsNotNull(col 11:int)(children:
VectorUDFStructField(col
1:struct<f1:boolean,f2:string,f3:struct<f4:int,f5:double>,f6:int>, col 3:int)
-> 11:int))
- predicate: ((not s2.f8.f9) and s1.f6 is not null) (type:
boolean)
+ predicateExpression: FilterExprAndExpr(children:
SelectColumnIsNotNull(col 9:int)(children: VectorUDFStructField(col
1:struct<f1:boolean,f2:string,f3:struct<f4:int,f5:double>,f6:int>, col 3:int)
-> 9:int), SelectColumnIsFalse(col 11:boolean)(children:
VectorUDFStructField(col
10:struct<f9:boolean,f10:array<int>,f11:map<string,boolean>>, col
0:int)(children: VectorUDFStructField(col
2:struct<f7:string,f8:struct<f9:boolean,f10:array<int>,f11:map<string,boolean>>>,
col 1:int) -> 10:struct<f9:boolean,f10:array<int>,f11:map<string,boolean>>) ->
11:boolean))
Review Comment:
Vectorized form of the same reorder caused by the [NOT null guard in
45c29a03e3](https://github.com/apache/hive/blob/45c29a03e375b172826900f2c4f768ec9c33b7d1/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/stats/FilterSelectivityEstimator.java#L136-L142).
The IS NOT NULL child now runs first. Scratch-column numbering follows
expression order, including the reduce-sink key changing from col 10 to col 9
below; the computed values and query results are unchanged. Both conjuncts pass
the single right-hand row in this fixture, so this does not demonstrate a
runtime improvement.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]