[
https://issues.apache.org/jira/browse/HIVE-24632?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Zhihua Deng updated HIVE-24632:
-------------------------------
Description:
The query
{code:java}
create table ccn_table(key int, value string);
set hive.cbo.enable=false;
select * from ccn_table where key > '123a' ;
{code}
will scan all records(partitions) compared to older version, as the plan
tells:
{noformat}
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{noformat}
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.
was:
The query
{code:java}
create table ccn_table(key int, value string);
set hive.cbo.enable=false;
select * from ccn_table where key > '123a' ;
{code}
will scan all records(partitions) compared to older version, as the plan
tells:
{noformat}
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{noformat}
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.
> Replace with null when GenericUDFBaseCompare has a non-interpretable val
> ------------------------------------------------------------------------
>
> Key: HIVE-24632
> URL: https://issues.apache.org/jira/browse/HIVE-24632
> Project: Hive
> Issue Type: Improvement
> Components: Parser
> Affects Versions: 4.0.0
> Reporter: Zhihua Deng
> Priority: Major
>
> The query
> {code:java}
> create table ccn_table(key int, value string);
> set hive.cbo.enable=false;
> select * from ccn_table where key > '123a' ;
> {code}
> will scan all records(partitions) compared to older version, as the plan
> tells:
> {noformat}
> 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{noformat}
> 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.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)