Details
-
Improvement
-
Status: Closed
-
Major
-
Resolution: Fixed
-
4.0.0
Description
The query
create table ccn_table(key int, value string); set hive.cbo.enable=false; select * from ccn_table where key > '123a' ;
will scan all records(partitions) compared to older version, as the plan tells:
STAGE PLANS: Stage: Stage-0 Fetch Operator limit: -1 Processor Tree: TableScan alias: ccn_table filterExpr: (key > '123a') (type: boolean) Statistics: Num rows: 2 Data size: 180 Basic stats: COMPLETE Column stats: COMPLETE GatherStats: false Filter Operator isSamplingPred: false predicate: (key > '123a') (type: boolean) Statistics: Num rows: 1 Data size: 90 Basic stats: COMPLETE Column stats: COMPLETE Select Operator expressions: key (type: int), value (type: string) outputColumnNames: _col0, _col1 Statistics: Num rows: 1 Data size: 90 Basic stats: COMPLETE Column stats: COMPLETE ListSink
When the TypeCheckProcFactory#getXpathOrFuncExprNodeDesc validates the expr: key > '123a', the operator(>) is not an equal operator(=), so the factory returns key > '123a' as it is. However all the subclass of GenericUDFBaseCompare(except GenericUDFOPEqualNS and GenericUDFOPNotEqualNS) would return null if either side of the function children is null, so it's safe to return constant null when processing the expr `key > '123a'`. This will benifit some queries when the cbo is disabled.
Attachments
Issue Links
- links to