[jira] [Updated] (HIVE-21778) CBO: "Struct is not null" gets evaluated as `nullable` always causing filter miss in the query

2020-03-13 Thread Vineet Garg (Jira)


 [ 
https://issues.apache.org/jira/browse/HIVE-21778?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Vineet Garg updated HIVE-21778:
---
Fix Version/s: 4.0.0
   Resolution: Fixed
   Status: Resolved  (was: Patch Available)

Pushed to master

> CBO: "Struct is not null" gets evaluated as `nullable` always causing filter 
> miss in the query
> --
>
> Key: HIVE-21778
> URL: https://issues.apache.org/jira/browse/HIVE-21778
> Project: Hive
>  Issue Type: Bug
>  Components: CBO
>Affects Versions: 4.0.0, 2.3.5
>Reporter: Rajesh Balamohan
>Assignee: Vineet Garg
>Priority: Major
>  Labels: pull-request-available
> Fix For: 4.0.0
>
> Attachments: HIVE-21778.1.patch, HIVE-21778.2.patch, 
> HIVE-21778.3.patch, HIVE-21778.4.patch, HIVE-21778.5.patch, 
> HIVE-21778.6.patch, HIVE-21778.7.patch, HIVE-21778.8.patch, test_null.q, 
> test_null.q.out
>
>  Time Spent: 40m
>  Remaining Estimate: 0h
>
> {noformat}
> drop table if exists test_struct;
> CREATE external TABLE test_struct
> (
>   f1 string,
>   demo_struct struct,
>   datestr string
> );
> set hive.cbo.enable=true;
> explain select * from etltmp.test_struct where datestr='2019-01-01' and 
> demo_struct is not null;
> STAGE PLANS:
>   Stage: Stage-0
> Fetch Operator
>   limit: -1
>   Processor Tree:
> TableScan
>   alias: test_struct
>   filterExpr: (datestr = '2019-01-01') (type: boolean) <- Note 
> that demo_struct filter is not added here
>   Filter Operator
> predicate: (datestr = '2019-01-01') (type: boolean)
> Select Operator
>   expressions: f1 (type: string), demo_struct (type: 
> struct), '2019-01-01' (type: string)
>   outputColumnNames: _col0, _col1, _col2
>   ListSink
> set hive.cbo.enable=false;
> explain select * from etltmp.test_struct where datestr='2019-01-01' and 
> demo_struct is not null;
> STAGE PLANS:
>   Stage: Stage-0
> Fetch Operator
>   limit: -1
>   Processor Tree:
> TableScan
>   alias: test_struct
>   filterExpr: ((datestr = '2019-01-01') and demo_struct is not null) 
> (type: boolean) <- Note that demo_struct filter is added when CBO is 
> turned off
>   Filter Operator
> predicate: ((datestr = '2019-01-01') and demo_struct is not null) 
> (type: boolean)
> Select Operator
>   expressions: f1 (type: string), demo_struct (type: 
> struct), '2019-01-01' (type: string)
>   outputColumnNames: _col0, _col1, _col2
>   ListSink
> {noformat}
> In CalcitePlanner::genFilterRelNode, the following code misses to evaluate 
> this filter. 
> {noformat}
> RexNode factoredFilterExpr = RexUtil
>   .pullFactors(cluster.getRexBuilder(), convertedFilterExpr);
> {noformat}
> Note that even if we add `demo_struct.f1` it would end up pushing the filter 
> correctly. 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Updated] (HIVE-21778) CBO: "Struct is not null" gets evaluated as `nullable` always causing filter miss in the query

2020-03-12 Thread Vineet Garg (Jira)


 [ 
https://issues.apache.org/jira/browse/HIVE-21778?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Vineet Garg updated HIVE-21778:
---
Status: Open  (was: Patch Available)

> CBO: "Struct is not null" gets evaluated as `nullable` always causing filter 
> miss in the query
> --
>
> Key: HIVE-21778
> URL: https://issues.apache.org/jira/browse/HIVE-21778
> Project: Hive
>  Issue Type: Bug
>  Components: CBO
>Affects Versions: 2.3.5, 4.0.0
>Reporter: Rajesh Balamohan
>Assignee: Vineet Garg
>Priority: Major
>  Labels: pull-request-available
> Attachments: HIVE-21778.1.patch, HIVE-21778.2.patch, 
> HIVE-21778.3.patch, HIVE-21778.4.patch, HIVE-21778.5.patch, 
> HIVE-21778.6.patch, HIVE-21778.7.patch, HIVE-21778.8.patch, test_null.q, 
> test_null.q.out
>
>  Time Spent: 40m
>  Remaining Estimate: 0h
>
> {noformat}
> drop table if exists test_struct;
> CREATE external TABLE test_struct
> (
>   f1 string,
>   demo_struct struct,
>   datestr string
> );
> set hive.cbo.enable=true;
> explain select * from etltmp.test_struct where datestr='2019-01-01' and 
> demo_struct is not null;
> STAGE PLANS:
>   Stage: Stage-0
> Fetch Operator
>   limit: -1
>   Processor Tree:
> TableScan
>   alias: test_struct
>   filterExpr: (datestr = '2019-01-01') (type: boolean) <- Note 
> that demo_struct filter is not added here
>   Filter Operator
> predicate: (datestr = '2019-01-01') (type: boolean)
> Select Operator
>   expressions: f1 (type: string), demo_struct (type: 
> struct), '2019-01-01' (type: string)
>   outputColumnNames: _col0, _col1, _col2
>   ListSink
> set hive.cbo.enable=false;
> explain select * from etltmp.test_struct where datestr='2019-01-01' and 
> demo_struct is not null;
> STAGE PLANS:
>   Stage: Stage-0
> Fetch Operator
>   limit: -1
>   Processor Tree:
> TableScan
>   alias: test_struct
>   filterExpr: ((datestr = '2019-01-01') and demo_struct is not null) 
> (type: boolean) <- Note that demo_struct filter is added when CBO is 
> turned off
>   Filter Operator
> predicate: ((datestr = '2019-01-01') and demo_struct is not null) 
> (type: boolean)
> Select Operator
>   expressions: f1 (type: string), demo_struct (type: 
> struct), '2019-01-01' (type: string)
>   outputColumnNames: _col0, _col1, _col2
>   ListSink
> {noformat}
> In CalcitePlanner::genFilterRelNode, the following code misses to evaluate 
> this filter. 
> {noformat}
> RexNode factoredFilterExpr = RexUtil
>   .pullFactors(cluster.getRexBuilder(), convertedFilterExpr);
> {noformat}
> Note that even if we add `demo_struct.f1` it would end up pushing the filter 
> correctly. 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Updated] (HIVE-21778) CBO: "Struct is not null" gets evaluated as `nullable` always causing filter miss in the query

2020-03-12 Thread Vineet Garg (Jira)


 [ 
https://issues.apache.org/jira/browse/HIVE-21778?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Vineet Garg updated HIVE-21778:
---
Status: Patch Available  (was: Open)

> CBO: "Struct is not null" gets evaluated as `nullable` always causing filter 
> miss in the query
> --
>
> Key: HIVE-21778
> URL: https://issues.apache.org/jira/browse/HIVE-21778
> Project: Hive
>  Issue Type: Bug
>  Components: CBO
>Affects Versions: 2.3.5, 4.0.0
>Reporter: Rajesh Balamohan
>Assignee: Vineet Garg
>Priority: Major
>  Labels: pull-request-available
> Attachments: HIVE-21778.1.patch, HIVE-21778.2.patch, 
> HIVE-21778.3.patch, HIVE-21778.4.patch, HIVE-21778.5.patch, 
> HIVE-21778.6.patch, HIVE-21778.7.patch, HIVE-21778.8.patch, test_null.q, 
> test_null.q.out
>
>  Time Spent: 40m
>  Remaining Estimate: 0h
>
> {noformat}
> drop table if exists test_struct;
> CREATE external TABLE test_struct
> (
>   f1 string,
>   demo_struct struct,
>   datestr string
> );
> set hive.cbo.enable=true;
> explain select * from etltmp.test_struct where datestr='2019-01-01' and 
> demo_struct is not null;
> STAGE PLANS:
>   Stage: Stage-0
> Fetch Operator
>   limit: -1
>   Processor Tree:
> TableScan
>   alias: test_struct
>   filterExpr: (datestr = '2019-01-01') (type: boolean) <- Note 
> that demo_struct filter is not added here
>   Filter Operator
> predicate: (datestr = '2019-01-01') (type: boolean)
> Select Operator
>   expressions: f1 (type: string), demo_struct (type: 
> struct), '2019-01-01' (type: string)
>   outputColumnNames: _col0, _col1, _col2
>   ListSink
> set hive.cbo.enable=false;
> explain select * from etltmp.test_struct where datestr='2019-01-01' and 
> demo_struct is not null;
> STAGE PLANS:
>   Stage: Stage-0
> Fetch Operator
>   limit: -1
>   Processor Tree:
> TableScan
>   alias: test_struct
>   filterExpr: ((datestr = '2019-01-01') and demo_struct is not null) 
> (type: boolean) <- Note that demo_struct filter is added when CBO is 
> turned off
>   Filter Operator
> predicate: ((datestr = '2019-01-01') and demo_struct is not null) 
> (type: boolean)
> Select Operator
>   expressions: f1 (type: string), demo_struct (type: 
> struct), '2019-01-01' (type: string)
>   outputColumnNames: _col0, _col1, _col2
>   ListSink
> {noformat}
> In CalcitePlanner::genFilterRelNode, the following code misses to evaluate 
> this filter. 
> {noformat}
> RexNode factoredFilterExpr = RexUtil
>   .pullFactors(cluster.getRexBuilder(), convertedFilterExpr);
> {noformat}
> Note that even if we add `demo_struct.f1` it would end up pushing the filter 
> correctly. 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Updated] (HIVE-21778) CBO: "Struct is not null" gets evaluated as `nullable` always causing filter miss in the query

2020-03-12 Thread Vineet Garg (Jira)


 [ 
https://issues.apache.org/jira/browse/HIVE-21778?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Vineet Garg updated HIVE-21778:
---
Attachment: HIVE-21778.8.patch

> CBO: "Struct is not null" gets evaluated as `nullable` always causing filter 
> miss in the query
> --
>
> Key: HIVE-21778
> URL: https://issues.apache.org/jira/browse/HIVE-21778
> Project: Hive
>  Issue Type: Bug
>  Components: CBO
>Affects Versions: 4.0.0, 2.3.5
>Reporter: Rajesh Balamohan
>Assignee: Vineet Garg
>Priority: Major
>  Labels: pull-request-available
> Attachments: HIVE-21778.1.patch, HIVE-21778.2.patch, 
> HIVE-21778.3.patch, HIVE-21778.4.patch, HIVE-21778.5.patch, 
> HIVE-21778.6.patch, HIVE-21778.7.patch, HIVE-21778.8.patch, test_null.q, 
> test_null.q.out
>
>  Time Spent: 40m
>  Remaining Estimate: 0h
>
> {noformat}
> drop table if exists test_struct;
> CREATE external TABLE test_struct
> (
>   f1 string,
>   demo_struct struct,
>   datestr string
> );
> set hive.cbo.enable=true;
> explain select * from etltmp.test_struct where datestr='2019-01-01' and 
> demo_struct is not null;
> STAGE PLANS:
>   Stage: Stage-0
> Fetch Operator
>   limit: -1
>   Processor Tree:
> TableScan
>   alias: test_struct
>   filterExpr: (datestr = '2019-01-01') (type: boolean) <- Note 
> that demo_struct filter is not added here
>   Filter Operator
> predicate: (datestr = '2019-01-01') (type: boolean)
> Select Operator
>   expressions: f1 (type: string), demo_struct (type: 
> struct), '2019-01-01' (type: string)
>   outputColumnNames: _col0, _col1, _col2
>   ListSink
> set hive.cbo.enable=false;
> explain select * from etltmp.test_struct where datestr='2019-01-01' and 
> demo_struct is not null;
> STAGE PLANS:
>   Stage: Stage-0
> Fetch Operator
>   limit: -1
>   Processor Tree:
> TableScan
>   alias: test_struct
>   filterExpr: ((datestr = '2019-01-01') and demo_struct is not null) 
> (type: boolean) <- Note that demo_struct filter is added when CBO is 
> turned off
>   Filter Operator
> predicate: ((datestr = '2019-01-01') and demo_struct is not null) 
> (type: boolean)
> Select Operator
>   expressions: f1 (type: string), demo_struct (type: 
> struct), '2019-01-01' (type: string)
>   outputColumnNames: _col0, _col1, _col2
>   ListSink
> {noformat}
> In CalcitePlanner::genFilterRelNode, the following code misses to evaluate 
> this filter. 
> {noformat}
> RexNode factoredFilterExpr = RexUtil
>   .pullFactors(cluster.getRexBuilder(), convertedFilterExpr);
> {noformat}
> Note that even if we add `demo_struct.f1` it would end up pushing the filter 
> correctly. 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Updated] (HIVE-21778) CBO: "Struct is not null" gets evaluated as `nullable` always causing filter miss in the query

2020-03-06 Thread Vineet Garg (Jira)


 [ 
https://issues.apache.org/jira/browse/HIVE-21778?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Vineet Garg updated HIVE-21778:
---
Status: Patch Available  (was: Open)

> CBO: "Struct is not null" gets evaluated as `nullable` always causing filter 
> miss in the query
> --
>
> Key: HIVE-21778
> URL: https://issues.apache.org/jira/browse/HIVE-21778
> Project: Hive
>  Issue Type: Bug
>  Components: CBO
>Affects Versions: 2.3.5, 4.0.0
>Reporter: Rajesh Balamohan
>Assignee: Vineet Garg
>Priority: Major
>  Labels: pull-request-available
> Attachments: HIVE-21778.1.patch, HIVE-21778.2.patch, 
> HIVE-21778.3.patch, HIVE-21778.4.patch, HIVE-21778.5.patch, 
> HIVE-21778.6.patch, HIVE-21778.7.patch, test_null.q, test_null.q.out
>
>  Time Spent: 40m
>  Remaining Estimate: 0h
>
> {noformat}
> drop table if exists test_struct;
> CREATE external TABLE test_struct
> (
>   f1 string,
>   demo_struct struct,
>   datestr string
> );
> set hive.cbo.enable=true;
> explain select * from etltmp.test_struct where datestr='2019-01-01' and 
> demo_struct is not null;
> STAGE PLANS:
>   Stage: Stage-0
> Fetch Operator
>   limit: -1
>   Processor Tree:
> TableScan
>   alias: test_struct
>   filterExpr: (datestr = '2019-01-01') (type: boolean) <- Note 
> that demo_struct filter is not added here
>   Filter Operator
> predicate: (datestr = '2019-01-01') (type: boolean)
> Select Operator
>   expressions: f1 (type: string), demo_struct (type: 
> struct), '2019-01-01' (type: string)
>   outputColumnNames: _col0, _col1, _col2
>   ListSink
> set hive.cbo.enable=false;
> explain select * from etltmp.test_struct where datestr='2019-01-01' and 
> demo_struct is not null;
> STAGE PLANS:
>   Stage: Stage-0
> Fetch Operator
>   limit: -1
>   Processor Tree:
> TableScan
>   alias: test_struct
>   filterExpr: ((datestr = '2019-01-01') and demo_struct is not null) 
> (type: boolean) <- Note that demo_struct filter is added when CBO is 
> turned off
>   Filter Operator
> predicate: ((datestr = '2019-01-01') and demo_struct is not null) 
> (type: boolean)
> Select Operator
>   expressions: f1 (type: string), demo_struct (type: 
> struct), '2019-01-01' (type: string)
>   outputColumnNames: _col0, _col1, _col2
>   ListSink
> {noformat}
> In CalcitePlanner::genFilterRelNode, the following code misses to evaluate 
> this filter. 
> {noformat}
> RexNode factoredFilterExpr = RexUtil
>   .pullFactors(cluster.getRexBuilder(), convertedFilterExpr);
> {noformat}
> Note that even if we add `demo_struct.f1` it would end up pushing the filter 
> correctly. 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Updated] (HIVE-21778) CBO: "Struct is not null" gets evaluated as `nullable` always causing filter miss in the query

2020-03-06 Thread Vineet Garg (Jira)


 [ 
https://issues.apache.org/jira/browse/HIVE-21778?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Vineet Garg updated HIVE-21778:
---
Status: Open  (was: Patch Available)

> CBO: "Struct is not null" gets evaluated as `nullable` always causing filter 
> miss in the query
> --
>
> Key: HIVE-21778
> URL: https://issues.apache.org/jira/browse/HIVE-21778
> Project: Hive
>  Issue Type: Bug
>  Components: CBO
>Affects Versions: 2.3.5, 4.0.0
>Reporter: Rajesh Balamohan
>Assignee: Vineet Garg
>Priority: Major
>  Labels: pull-request-available
> Attachments: HIVE-21778.1.patch, HIVE-21778.2.patch, 
> HIVE-21778.3.patch, HIVE-21778.4.patch, HIVE-21778.5.patch, 
> HIVE-21778.6.patch, HIVE-21778.7.patch, test_null.q, test_null.q.out
>
>  Time Spent: 40m
>  Remaining Estimate: 0h
>
> {noformat}
> drop table if exists test_struct;
> CREATE external TABLE test_struct
> (
>   f1 string,
>   demo_struct struct,
>   datestr string
> );
> set hive.cbo.enable=true;
> explain select * from etltmp.test_struct where datestr='2019-01-01' and 
> demo_struct is not null;
> STAGE PLANS:
>   Stage: Stage-0
> Fetch Operator
>   limit: -1
>   Processor Tree:
> TableScan
>   alias: test_struct
>   filterExpr: (datestr = '2019-01-01') (type: boolean) <- Note 
> that demo_struct filter is not added here
>   Filter Operator
> predicate: (datestr = '2019-01-01') (type: boolean)
> Select Operator
>   expressions: f1 (type: string), demo_struct (type: 
> struct), '2019-01-01' (type: string)
>   outputColumnNames: _col0, _col1, _col2
>   ListSink
> set hive.cbo.enable=false;
> explain select * from etltmp.test_struct where datestr='2019-01-01' and 
> demo_struct is not null;
> STAGE PLANS:
>   Stage: Stage-0
> Fetch Operator
>   limit: -1
>   Processor Tree:
> TableScan
>   alias: test_struct
>   filterExpr: ((datestr = '2019-01-01') and demo_struct is not null) 
> (type: boolean) <- Note that demo_struct filter is added when CBO is 
> turned off
>   Filter Operator
> predicate: ((datestr = '2019-01-01') and demo_struct is not null) 
> (type: boolean)
> Select Operator
>   expressions: f1 (type: string), demo_struct (type: 
> struct), '2019-01-01' (type: string)
>   outputColumnNames: _col0, _col1, _col2
>   ListSink
> {noformat}
> In CalcitePlanner::genFilterRelNode, the following code misses to evaluate 
> this filter. 
> {noformat}
> RexNode factoredFilterExpr = RexUtil
>   .pullFactors(cluster.getRexBuilder(), convertedFilterExpr);
> {noformat}
> Note that even if we add `demo_struct.f1` it would end up pushing the filter 
> correctly. 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Updated] (HIVE-21778) CBO: "Struct is not null" gets evaluated as `nullable` always causing filter miss in the query

2020-03-05 Thread Vineet Garg (Jira)


 [ 
https://issues.apache.org/jira/browse/HIVE-21778?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Vineet Garg updated HIVE-21778:
---
Attachment: HIVE-21778.7.patch

> CBO: "Struct is not null" gets evaluated as `nullable` always causing filter 
> miss in the query
> --
>
> Key: HIVE-21778
> URL: https://issues.apache.org/jira/browse/HIVE-21778
> Project: Hive
>  Issue Type: Bug
>  Components: CBO
>Affects Versions: 4.0.0, 2.3.5
>Reporter: Rajesh Balamohan
>Assignee: Vineet Garg
>Priority: Major
>  Labels: pull-request-available
> Attachments: HIVE-21778.1.patch, HIVE-21778.2.patch, 
> HIVE-21778.3.patch, HIVE-21778.4.patch, HIVE-21778.5.patch, 
> HIVE-21778.6.patch, HIVE-21778.7.patch, test_null.q, test_null.q.out
>
>  Time Spent: 40m
>  Remaining Estimate: 0h
>
> {noformat}
> drop table if exists test_struct;
> CREATE external TABLE test_struct
> (
>   f1 string,
>   demo_struct struct,
>   datestr string
> );
> set hive.cbo.enable=true;
> explain select * from etltmp.test_struct where datestr='2019-01-01' and 
> demo_struct is not null;
> STAGE PLANS:
>   Stage: Stage-0
> Fetch Operator
>   limit: -1
>   Processor Tree:
> TableScan
>   alias: test_struct
>   filterExpr: (datestr = '2019-01-01') (type: boolean) <- Note 
> that demo_struct filter is not added here
>   Filter Operator
> predicate: (datestr = '2019-01-01') (type: boolean)
> Select Operator
>   expressions: f1 (type: string), demo_struct (type: 
> struct), '2019-01-01' (type: string)
>   outputColumnNames: _col0, _col1, _col2
>   ListSink
> set hive.cbo.enable=false;
> explain select * from etltmp.test_struct where datestr='2019-01-01' and 
> demo_struct is not null;
> STAGE PLANS:
>   Stage: Stage-0
> Fetch Operator
>   limit: -1
>   Processor Tree:
> TableScan
>   alias: test_struct
>   filterExpr: ((datestr = '2019-01-01') and demo_struct is not null) 
> (type: boolean) <- Note that demo_struct filter is added when CBO is 
> turned off
>   Filter Operator
> predicate: ((datestr = '2019-01-01') and demo_struct is not null) 
> (type: boolean)
> Select Operator
>   expressions: f1 (type: string), demo_struct (type: 
> struct), '2019-01-01' (type: string)
>   outputColumnNames: _col0, _col1, _col2
>   ListSink
> {noformat}
> In CalcitePlanner::genFilterRelNode, the following code misses to evaluate 
> this filter. 
> {noformat}
> RexNode factoredFilterExpr = RexUtil
>   .pullFactors(cluster.getRexBuilder(), convertedFilterExpr);
> {noformat}
> Note that even if we add `demo_struct.f1` it would end up pushing the filter 
> correctly. 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Updated] (HIVE-21778) CBO: "Struct is not null" gets evaluated as `nullable` always causing filter miss in the query

2020-03-05 Thread Vineet Garg (Jira)


 [ 
https://issues.apache.org/jira/browse/HIVE-21778?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Vineet Garg updated HIVE-21778:
---
Status: Patch Available  (was: Open)

> CBO: "Struct is not null" gets evaluated as `nullable` always causing filter 
> miss in the query
> --
>
> Key: HIVE-21778
> URL: https://issues.apache.org/jira/browse/HIVE-21778
> Project: Hive
>  Issue Type: Bug
>  Components: CBO
>Affects Versions: 2.3.5, 4.0.0
>Reporter: Rajesh Balamohan
>Assignee: Vineet Garg
>Priority: Major
>  Labels: pull-request-available
> Attachments: HIVE-21778.1.patch, HIVE-21778.2.patch, 
> HIVE-21778.3.patch, HIVE-21778.4.patch, HIVE-21778.5.patch, 
> HIVE-21778.6.patch, HIVE-21778.7.patch, test_null.q, test_null.q.out
>
>  Time Spent: 40m
>  Remaining Estimate: 0h
>
> {noformat}
> drop table if exists test_struct;
> CREATE external TABLE test_struct
> (
>   f1 string,
>   demo_struct struct,
>   datestr string
> );
> set hive.cbo.enable=true;
> explain select * from etltmp.test_struct where datestr='2019-01-01' and 
> demo_struct is not null;
> STAGE PLANS:
>   Stage: Stage-0
> Fetch Operator
>   limit: -1
>   Processor Tree:
> TableScan
>   alias: test_struct
>   filterExpr: (datestr = '2019-01-01') (type: boolean) <- Note 
> that demo_struct filter is not added here
>   Filter Operator
> predicate: (datestr = '2019-01-01') (type: boolean)
> Select Operator
>   expressions: f1 (type: string), demo_struct (type: 
> struct), '2019-01-01' (type: string)
>   outputColumnNames: _col0, _col1, _col2
>   ListSink
> set hive.cbo.enable=false;
> explain select * from etltmp.test_struct where datestr='2019-01-01' and 
> demo_struct is not null;
> STAGE PLANS:
>   Stage: Stage-0
> Fetch Operator
>   limit: -1
>   Processor Tree:
> TableScan
>   alias: test_struct
>   filterExpr: ((datestr = '2019-01-01') and demo_struct is not null) 
> (type: boolean) <- Note that demo_struct filter is added when CBO is 
> turned off
>   Filter Operator
> predicate: ((datestr = '2019-01-01') and demo_struct is not null) 
> (type: boolean)
> Select Operator
>   expressions: f1 (type: string), demo_struct (type: 
> struct), '2019-01-01' (type: string)
>   outputColumnNames: _col0, _col1, _col2
>   ListSink
> {noformat}
> In CalcitePlanner::genFilterRelNode, the following code misses to evaluate 
> this filter. 
> {noformat}
> RexNode factoredFilterExpr = RexUtil
>   .pullFactors(cluster.getRexBuilder(), convertedFilterExpr);
> {noformat}
> Note that even if we add `demo_struct.f1` it would end up pushing the filter 
> correctly. 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Updated] (HIVE-21778) CBO: "Struct is not null" gets evaluated as `nullable` always causing filter miss in the query

2020-03-05 Thread Vineet Garg (Jira)


 [ 
https://issues.apache.org/jira/browse/HIVE-21778?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Vineet Garg updated HIVE-21778:
---
Status: Open  (was: Patch Available)

> CBO: "Struct is not null" gets evaluated as `nullable` always causing filter 
> miss in the query
> --
>
> Key: HIVE-21778
> URL: https://issues.apache.org/jira/browse/HIVE-21778
> Project: Hive
>  Issue Type: Bug
>  Components: CBO
>Affects Versions: 2.3.5, 4.0.0
>Reporter: Rajesh Balamohan
>Assignee: Vineet Garg
>Priority: Major
>  Labels: pull-request-available
> Attachments: HIVE-21778.1.patch, HIVE-21778.2.patch, 
> HIVE-21778.3.patch, HIVE-21778.4.patch, HIVE-21778.5.patch, 
> HIVE-21778.6.patch, HIVE-21778.7.patch, test_null.q, test_null.q.out
>
>  Time Spent: 40m
>  Remaining Estimate: 0h
>
> {noformat}
> drop table if exists test_struct;
> CREATE external TABLE test_struct
> (
>   f1 string,
>   demo_struct struct,
>   datestr string
> );
> set hive.cbo.enable=true;
> explain select * from etltmp.test_struct where datestr='2019-01-01' and 
> demo_struct is not null;
> STAGE PLANS:
>   Stage: Stage-0
> Fetch Operator
>   limit: -1
>   Processor Tree:
> TableScan
>   alias: test_struct
>   filterExpr: (datestr = '2019-01-01') (type: boolean) <- Note 
> that demo_struct filter is not added here
>   Filter Operator
> predicate: (datestr = '2019-01-01') (type: boolean)
> Select Operator
>   expressions: f1 (type: string), demo_struct (type: 
> struct), '2019-01-01' (type: string)
>   outputColumnNames: _col0, _col1, _col2
>   ListSink
> set hive.cbo.enable=false;
> explain select * from etltmp.test_struct where datestr='2019-01-01' and 
> demo_struct is not null;
> STAGE PLANS:
>   Stage: Stage-0
> Fetch Operator
>   limit: -1
>   Processor Tree:
> TableScan
>   alias: test_struct
>   filterExpr: ((datestr = '2019-01-01') and demo_struct is not null) 
> (type: boolean) <- Note that demo_struct filter is added when CBO is 
> turned off
>   Filter Operator
> predicate: ((datestr = '2019-01-01') and demo_struct is not null) 
> (type: boolean)
> Select Operator
>   expressions: f1 (type: string), demo_struct (type: 
> struct), '2019-01-01' (type: string)
>   outputColumnNames: _col0, _col1, _col2
>   ListSink
> {noformat}
> In CalcitePlanner::genFilterRelNode, the following code misses to evaluate 
> this filter. 
> {noformat}
> RexNode factoredFilterExpr = RexUtil
>   .pullFactors(cluster.getRexBuilder(), convertedFilterExpr);
> {noformat}
> Note that even if we add `demo_struct.f1` it would end up pushing the filter 
> correctly. 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Updated] (HIVE-21778) CBO: "Struct is not null" gets evaluated as `nullable` always causing filter miss in the query

2020-03-04 Thread Vineet Garg (Jira)


 [ 
https://issues.apache.org/jira/browse/HIVE-21778?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Vineet Garg updated HIVE-21778:
---
Attachment: HIVE-21778.6.patch

> CBO: "Struct is not null" gets evaluated as `nullable` always causing filter 
> miss in the query
> --
>
> Key: HIVE-21778
> URL: https://issues.apache.org/jira/browse/HIVE-21778
> Project: Hive
>  Issue Type: Bug
>  Components: CBO
>Affects Versions: 4.0.0, 2.3.5
>Reporter: Rajesh Balamohan
>Assignee: Vineet Garg
>Priority: Major
>  Labels: pull-request-available
> Attachments: HIVE-21778.1.patch, HIVE-21778.2.patch, 
> HIVE-21778.3.patch, HIVE-21778.4.patch, HIVE-21778.5.patch, 
> HIVE-21778.6.patch, test_null.q, test_null.q.out
>
>  Time Spent: 40m
>  Remaining Estimate: 0h
>
> {noformat}
> drop table if exists test_struct;
> CREATE external TABLE test_struct
> (
>   f1 string,
>   demo_struct struct,
>   datestr string
> );
> set hive.cbo.enable=true;
> explain select * from etltmp.test_struct where datestr='2019-01-01' and 
> demo_struct is not null;
> STAGE PLANS:
>   Stage: Stage-0
> Fetch Operator
>   limit: -1
>   Processor Tree:
> TableScan
>   alias: test_struct
>   filterExpr: (datestr = '2019-01-01') (type: boolean) <- Note 
> that demo_struct filter is not added here
>   Filter Operator
> predicate: (datestr = '2019-01-01') (type: boolean)
> Select Operator
>   expressions: f1 (type: string), demo_struct (type: 
> struct), '2019-01-01' (type: string)
>   outputColumnNames: _col0, _col1, _col2
>   ListSink
> set hive.cbo.enable=false;
> explain select * from etltmp.test_struct where datestr='2019-01-01' and 
> demo_struct is not null;
> STAGE PLANS:
>   Stage: Stage-0
> Fetch Operator
>   limit: -1
>   Processor Tree:
> TableScan
>   alias: test_struct
>   filterExpr: ((datestr = '2019-01-01') and demo_struct is not null) 
> (type: boolean) <- Note that demo_struct filter is added when CBO is 
> turned off
>   Filter Operator
> predicate: ((datestr = '2019-01-01') and demo_struct is not null) 
> (type: boolean)
> Select Operator
>   expressions: f1 (type: string), demo_struct (type: 
> struct), '2019-01-01' (type: string)
>   outputColumnNames: _col0, _col1, _col2
>   ListSink
> {noformat}
> In CalcitePlanner::genFilterRelNode, the following code misses to evaluate 
> this filter. 
> {noformat}
> RexNode factoredFilterExpr = RexUtil
>   .pullFactors(cluster.getRexBuilder(), convertedFilterExpr);
> {noformat}
> Note that even if we add `demo_struct.f1` it would end up pushing the filter 
> correctly. 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Updated] (HIVE-21778) CBO: "Struct is not null" gets evaluated as `nullable` always causing filter miss in the query

2020-03-04 Thread Vineet Garg (Jira)


 [ 
https://issues.apache.org/jira/browse/HIVE-21778?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Vineet Garg updated HIVE-21778:
---
Status: Open  (was: Patch Available)

> CBO: "Struct is not null" gets evaluated as `nullable` always causing filter 
> miss in the query
> --
>
> Key: HIVE-21778
> URL: https://issues.apache.org/jira/browse/HIVE-21778
> Project: Hive
>  Issue Type: Bug
>  Components: CBO
>Affects Versions: 2.3.5, 4.0.0
>Reporter: Rajesh Balamohan
>Assignee: Vineet Garg
>Priority: Major
>  Labels: pull-request-available
> Attachments: HIVE-21778.1.patch, HIVE-21778.2.patch, 
> HIVE-21778.3.patch, HIVE-21778.4.patch, HIVE-21778.5.patch, 
> HIVE-21778.6.patch, test_null.q, test_null.q.out
>
>  Time Spent: 40m
>  Remaining Estimate: 0h
>
> {noformat}
> drop table if exists test_struct;
> CREATE external TABLE test_struct
> (
>   f1 string,
>   demo_struct struct,
>   datestr string
> );
> set hive.cbo.enable=true;
> explain select * from etltmp.test_struct where datestr='2019-01-01' and 
> demo_struct is not null;
> STAGE PLANS:
>   Stage: Stage-0
> Fetch Operator
>   limit: -1
>   Processor Tree:
> TableScan
>   alias: test_struct
>   filterExpr: (datestr = '2019-01-01') (type: boolean) <- Note 
> that demo_struct filter is not added here
>   Filter Operator
> predicate: (datestr = '2019-01-01') (type: boolean)
> Select Operator
>   expressions: f1 (type: string), demo_struct (type: 
> struct), '2019-01-01' (type: string)
>   outputColumnNames: _col0, _col1, _col2
>   ListSink
> set hive.cbo.enable=false;
> explain select * from etltmp.test_struct where datestr='2019-01-01' and 
> demo_struct is not null;
> STAGE PLANS:
>   Stage: Stage-0
> Fetch Operator
>   limit: -1
>   Processor Tree:
> TableScan
>   alias: test_struct
>   filterExpr: ((datestr = '2019-01-01') and demo_struct is not null) 
> (type: boolean) <- Note that demo_struct filter is added when CBO is 
> turned off
>   Filter Operator
> predicate: ((datestr = '2019-01-01') and demo_struct is not null) 
> (type: boolean)
> Select Operator
>   expressions: f1 (type: string), demo_struct (type: 
> struct), '2019-01-01' (type: string)
>   outputColumnNames: _col0, _col1, _col2
>   ListSink
> {noformat}
> In CalcitePlanner::genFilterRelNode, the following code misses to evaluate 
> this filter. 
> {noformat}
> RexNode factoredFilterExpr = RexUtil
>   .pullFactors(cluster.getRexBuilder(), convertedFilterExpr);
> {noformat}
> Note that even if we add `demo_struct.f1` it would end up pushing the filter 
> correctly. 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Updated] (HIVE-21778) CBO: "Struct is not null" gets evaluated as `nullable` always causing filter miss in the query

2020-03-04 Thread Vineet Garg (Jira)


 [ 
https://issues.apache.org/jira/browse/HIVE-21778?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Vineet Garg updated HIVE-21778:
---
Status: Patch Available  (was: Open)

> CBO: "Struct is not null" gets evaluated as `nullable` always causing filter 
> miss in the query
> --
>
> Key: HIVE-21778
> URL: https://issues.apache.org/jira/browse/HIVE-21778
> Project: Hive
>  Issue Type: Bug
>  Components: CBO
>Affects Versions: 2.3.5, 4.0.0
>Reporter: Rajesh Balamohan
>Assignee: Vineet Garg
>Priority: Major
>  Labels: pull-request-available
> Attachments: HIVE-21778.1.patch, HIVE-21778.2.patch, 
> HIVE-21778.3.patch, HIVE-21778.4.patch, HIVE-21778.5.patch, 
> HIVE-21778.6.patch, test_null.q, test_null.q.out
>
>  Time Spent: 40m
>  Remaining Estimate: 0h
>
> {noformat}
> drop table if exists test_struct;
> CREATE external TABLE test_struct
> (
>   f1 string,
>   demo_struct struct,
>   datestr string
> );
> set hive.cbo.enable=true;
> explain select * from etltmp.test_struct where datestr='2019-01-01' and 
> demo_struct is not null;
> STAGE PLANS:
>   Stage: Stage-0
> Fetch Operator
>   limit: -1
>   Processor Tree:
> TableScan
>   alias: test_struct
>   filterExpr: (datestr = '2019-01-01') (type: boolean) <- Note 
> that demo_struct filter is not added here
>   Filter Operator
> predicate: (datestr = '2019-01-01') (type: boolean)
> Select Operator
>   expressions: f1 (type: string), demo_struct (type: 
> struct), '2019-01-01' (type: string)
>   outputColumnNames: _col0, _col1, _col2
>   ListSink
> set hive.cbo.enable=false;
> explain select * from etltmp.test_struct where datestr='2019-01-01' and 
> demo_struct is not null;
> STAGE PLANS:
>   Stage: Stage-0
> Fetch Operator
>   limit: -1
>   Processor Tree:
> TableScan
>   alias: test_struct
>   filterExpr: ((datestr = '2019-01-01') and demo_struct is not null) 
> (type: boolean) <- Note that demo_struct filter is added when CBO is 
> turned off
>   Filter Operator
> predicate: ((datestr = '2019-01-01') and demo_struct is not null) 
> (type: boolean)
> Select Operator
>   expressions: f1 (type: string), demo_struct (type: 
> struct), '2019-01-01' (type: string)
>   outputColumnNames: _col0, _col1, _col2
>   ListSink
> {noformat}
> In CalcitePlanner::genFilterRelNode, the following code misses to evaluate 
> this filter. 
> {noformat}
> RexNode factoredFilterExpr = RexUtil
>   .pullFactors(cluster.getRexBuilder(), convertedFilterExpr);
> {noformat}
> Note that even if we add `demo_struct.f1` it would end up pushing the filter 
> correctly. 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Updated] (HIVE-21778) CBO: "Struct is not null" gets evaluated as `nullable` always causing filter miss in the query

2020-03-03 Thread Vineet Garg (Jira)


 [ 
https://issues.apache.org/jira/browse/HIVE-21778?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Vineet Garg updated HIVE-21778:
---
Attachment: HIVE-21778.5.patch

> CBO: "Struct is not null" gets evaluated as `nullable` always causing filter 
> miss in the query
> --
>
> Key: HIVE-21778
> URL: https://issues.apache.org/jira/browse/HIVE-21778
> Project: Hive
>  Issue Type: Bug
>  Components: CBO
>Affects Versions: 4.0.0, 2.3.5
>Reporter: Rajesh Balamohan
>Assignee: Vineet Garg
>Priority: Major
>  Labels: pull-request-available
> Attachments: HIVE-21778.1.patch, HIVE-21778.2.patch, 
> HIVE-21778.3.patch, HIVE-21778.4.patch, HIVE-21778.5.patch, test_null.q, 
> test_null.q.out
>
>  Time Spent: 40m
>  Remaining Estimate: 0h
>
> {noformat}
> drop table if exists test_struct;
> CREATE external TABLE test_struct
> (
>   f1 string,
>   demo_struct struct,
>   datestr string
> );
> set hive.cbo.enable=true;
> explain select * from etltmp.test_struct where datestr='2019-01-01' and 
> demo_struct is not null;
> STAGE PLANS:
>   Stage: Stage-0
> Fetch Operator
>   limit: -1
>   Processor Tree:
> TableScan
>   alias: test_struct
>   filterExpr: (datestr = '2019-01-01') (type: boolean) <- Note 
> that demo_struct filter is not added here
>   Filter Operator
> predicate: (datestr = '2019-01-01') (type: boolean)
> Select Operator
>   expressions: f1 (type: string), demo_struct (type: 
> struct), '2019-01-01' (type: string)
>   outputColumnNames: _col0, _col1, _col2
>   ListSink
> set hive.cbo.enable=false;
> explain select * from etltmp.test_struct where datestr='2019-01-01' and 
> demo_struct is not null;
> STAGE PLANS:
>   Stage: Stage-0
> Fetch Operator
>   limit: -1
>   Processor Tree:
> TableScan
>   alias: test_struct
>   filterExpr: ((datestr = '2019-01-01') and demo_struct is not null) 
> (type: boolean) <- Note that demo_struct filter is added when CBO is 
> turned off
>   Filter Operator
> predicate: ((datestr = '2019-01-01') and demo_struct is not null) 
> (type: boolean)
> Select Operator
>   expressions: f1 (type: string), demo_struct (type: 
> struct), '2019-01-01' (type: string)
>   outputColumnNames: _col0, _col1, _col2
>   ListSink
> {noformat}
> In CalcitePlanner::genFilterRelNode, the following code misses to evaluate 
> this filter. 
> {noformat}
> RexNode factoredFilterExpr = RexUtil
>   .pullFactors(cluster.getRexBuilder(), convertedFilterExpr);
> {noformat}
> Note that even if we add `demo_struct.f1` it would end up pushing the filter 
> correctly. 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Updated] (HIVE-21778) CBO: "Struct is not null" gets evaluated as `nullable` always causing filter miss in the query

2020-03-03 Thread Vineet Garg (Jira)


 [ 
https://issues.apache.org/jira/browse/HIVE-21778?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Vineet Garg updated HIVE-21778:
---
Status: Patch Available  (was: Open)

> CBO: "Struct is not null" gets evaluated as `nullable` always causing filter 
> miss in the query
> --
>
> Key: HIVE-21778
> URL: https://issues.apache.org/jira/browse/HIVE-21778
> Project: Hive
>  Issue Type: Bug
>  Components: CBO
>Affects Versions: 2.3.5, 4.0.0
>Reporter: Rajesh Balamohan
>Assignee: Vineet Garg
>Priority: Major
>  Labels: pull-request-available
> Attachments: HIVE-21778.1.patch, HIVE-21778.2.patch, 
> HIVE-21778.3.patch, HIVE-21778.4.patch, HIVE-21778.5.patch, test_null.q, 
> test_null.q.out
>
>  Time Spent: 40m
>  Remaining Estimate: 0h
>
> {noformat}
> drop table if exists test_struct;
> CREATE external TABLE test_struct
> (
>   f1 string,
>   demo_struct struct,
>   datestr string
> );
> set hive.cbo.enable=true;
> explain select * from etltmp.test_struct where datestr='2019-01-01' and 
> demo_struct is not null;
> STAGE PLANS:
>   Stage: Stage-0
> Fetch Operator
>   limit: -1
>   Processor Tree:
> TableScan
>   alias: test_struct
>   filterExpr: (datestr = '2019-01-01') (type: boolean) <- Note 
> that demo_struct filter is not added here
>   Filter Operator
> predicate: (datestr = '2019-01-01') (type: boolean)
> Select Operator
>   expressions: f1 (type: string), demo_struct (type: 
> struct), '2019-01-01' (type: string)
>   outputColumnNames: _col0, _col1, _col2
>   ListSink
> set hive.cbo.enable=false;
> explain select * from etltmp.test_struct where datestr='2019-01-01' and 
> demo_struct is not null;
> STAGE PLANS:
>   Stage: Stage-0
> Fetch Operator
>   limit: -1
>   Processor Tree:
> TableScan
>   alias: test_struct
>   filterExpr: ((datestr = '2019-01-01') and demo_struct is not null) 
> (type: boolean) <- Note that demo_struct filter is added when CBO is 
> turned off
>   Filter Operator
> predicate: ((datestr = '2019-01-01') and demo_struct is not null) 
> (type: boolean)
> Select Operator
>   expressions: f1 (type: string), demo_struct (type: 
> struct), '2019-01-01' (type: string)
>   outputColumnNames: _col0, _col1, _col2
>   ListSink
> {noformat}
> In CalcitePlanner::genFilterRelNode, the following code misses to evaluate 
> this filter. 
> {noformat}
> RexNode factoredFilterExpr = RexUtil
>   .pullFactors(cluster.getRexBuilder(), convertedFilterExpr);
> {noformat}
> Note that even if we add `demo_struct.f1` it would end up pushing the filter 
> correctly. 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Updated] (HIVE-21778) CBO: "Struct is not null" gets evaluated as `nullable` always causing filter miss in the query

2020-03-03 Thread Vineet Garg (Jira)


 [ 
https://issues.apache.org/jira/browse/HIVE-21778?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Vineet Garg updated HIVE-21778:
---
Status: Open  (was: Patch Available)

> CBO: "Struct is not null" gets evaluated as `nullable` always causing filter 
> miss in the query
> --
>
> Key: HIVE-21778
> URL: https://issues.apache.org/jira/browse/HIVE-21778
> Project: Hive
>  Issue Type: Bug
>  Components: CBO
>Affects Versions: 2.3.5, 4.0.0
>Reporter: Rajesh Balamohan
>Assignee: Vineet Garg
>Priority: Major
>  Labels: pull-request-available
> Attachments: HIVE-21778.1.patch, HIVE-21778.2.patch, 
> HIVE-21778.3.patch, HIVE-21778.4.patch, HIVE-21778.5.patch, test_null.q, 
> test_null.q.out
>
>  Time Spent: 40m
>  Remaining Estimate: 0h
>
> {noformat}
> drop table if exists test_struct;
> CREATE external TABLE test_struct
> (
>   f1 string,
>   demo_struct struct,
>   datestr string
> );
> set hive.cbo.enable=true;
> explain select * from etltmp.test_struct where datestr='2019-01-01' and 
> demo_struct is not null;
> STAGE PLANS:
>   Stage: Stage-0
> Fetch Operator
>   limit: -1
>   Processor Tree:
> TableScan
>   alias: test_struct
>   filterExpr: (datestr = '2019-01-01') (type: boolean) <- Note 
> that demo_struct filter is not added here
>   Filter Operator
> predicate: (datestr = '2019-01-01') (type: boolean)
> Select Operator
>   expressions: f1 (type: string), demo_struct (type: 
> struct), '2019-01-01' (type: string)
>   outputColumnNames: _col0, _col1, _col2
>   ListSink
> set hive.cbo.enable=false;
> explain select * from etltmp.test_struct where datestr='2019-01-01' and 
> demo_struct is not null;
> STAGE PLANS:
>   Stage: Stage-0
> Fetch Operator
>   limit: -1
>   Processor Tree:
> TableScan
>   alias: test_struct
>   filterExpr: ((datestr = '2019-01-01') and demo_struct is not null) 
> (type: boolean) <- Note that demo_struct filter is added when CBO is 
> turned off
>   Filter Operator
> predicate: ((datestr = '2019-01-01') and demo_struct is not null) 
> (type: boolean)
> Select Operator
>   expressions: f1 (type: string), demo_struct (type: 
> struct), '2019-01-01' (type: string)
>   outputColumnNames: _col0, _col1, _col2
>   ListSink
> {noformat}
> In CalcitePlanner::genFilterRelNode, the following code misses to evaluate 
> this filter. 
> {noformat}
> RexNode factoredFilterExpr = RexUtil
>   .pullFactors(cluster.getRexBuilder(), convertedFilterExpr);
> {noformat}
> Note that even if we add `demo_struct.f1` it would end up pushing the filter 
> correctly. 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Updated] (HIVE-21778) CBO: "Struct is not null" gets evaluated as `nullable` always causing filter miss in the query

2020-03-02 Thread Vineet Garg (Jira)


 [ 
https://issues.apache.org/jira/browse/HIVE-21778?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Vineet Garg updated HIVE-21778:
---
Status: Patch Available  (was: Open)

> CBO: "Struct is not null" gets evaluated as `nullable` always causing filter 
> miss in the query
> --
>
> Key: HIVE-21778
> URL: https://issues.apache.org/jira/browse/HIVE-21778
> Project: Hive
>  Issue Type: Bug
>  Components: CBO
>Affects Versions: 2.3.5, 4.0.0
>Reporter: Rajesh Balamohan
>Assignee: Vineet Garg
>Priority: Major
>  Labels: pull-request-available
> Attachments: HIVE-21778.1.patch, HIVE-21778.2.patch, 
> HIVE-21778.3.patch, HIVE-21778.4.patch, test_null.q, test_null.q.out
>
>  Time Spent: 40m
>  Remaining Estimate: 0h
>
> {noformat}
> drop table if exists test_struct;
> CREATE external TABLE test_struct
> (
>   f1 string,
>   demo_struct struct,
>   datestr string
> );
> set hive.cbo.enable=true;
> explain select * from etltmp.test_struct where datestr='2019-01-01' and 
> demo_struct is not null;
> STAGE PLANS:
>   Stage: Stage-0
> Fetch Operator
>   limit: -1
>   Processor Tree:
> TableScan
>   alias: test_struct
>   filterExpr: (datestr = '2019-01-01') (type: boolean) <- Note 
> that demo_struct filter is not added here
>   Filter Operator
> predicate: (datestr = '2019-01-01') (type: boolean)
> Select Operator
>   expressions: f1 (type: string), demo_struct (type: 
> struct), '2019-01-01' (type: string)
>   outputColumnNames: _col0, _col1, _col2
>   ListSink
> set hive.cbo.enable=false;
> explain select * from etltmp.test_struct where datestr='2019-01-01' and 
> demo_struct is not null;
> STAGE PLANS:
>   Stage: Stage-0
> Fetch Operator
>   limit: -1
>   Processor Tree:
> TableScan
>   alias: test_struct
>   filterExpr: ((datestr = '2019-01-01') and demo_struct is not null) 
> (type: boolean) <- Note that demo_struct filter is added when CBO is 
> turned off
>   Filter Operator
> predicate: ((datestr = '2019-01-01') and demo_struct is not null) 
> (type: boolean)
> Select Operator
>   expressions: f1 (type: string), demo_struct (type: 
> struct), '2019-01-01' (type: string)
>   outputColumnNames: _col0, _col1, _col2
>   ListSink
> {noformat}
> In CalcitePlanner::genFilterRelNode, the following code misses to evaluate 
> this filter. 
> {noformat}
> RexNode factoredFilterExpr = RexUtil
>   .pullFactors(cluster.getRexBuilder(), convertedFilterExpr);
> {noformat}
> Note that even if we add `demo_struct.f1` it would end up pushing the filter 
> correctly. 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Updated] (HIVE-21778) CBO: "Struct is not null" gets evaluated as `nullable` always causing filter miss in the query

2020-03-02 Thread Vineet Garg (Jira)


 [ 
https://issues.apache.org/jira/browse/HIVE-21778?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Vineet Garg updated HIVE-21778:
---
Status: Open  (was: Patch Available)

> CBO: "Struct is not null" gets evaluated as `nullable` always causing filter 
> miss in the query
> --
>
> Key: HIVE-21778
> URL: https://issues.apache.org/jira/browse/HIVE-21778
> Project: Hive
>  Issue Type: Bug
>  Components: CBO
>Affects Versions: 2.3.5, 4.0.0
>Reporter: Rajesh Balamohan
>Assignee: Vineet Garg
>Priority: Major
>  Labels: pull-request-available
> Attachments: HIVE-21778.1.patch, HIVE-21778.2.patch, 
> HIVE-21778.3.patch, HIVE-21778.4.patch, test_null.q, test_null.q.out
>
>  Time Spent: 40m
>  Remaining Estimate: 0h
>
> {noformat}
> drop table if exists test_struct;
> CREATE external TABLE test_struct
> (
>   f1 string,
>   demo_struct struct,
>   datestr string
> );
> set hive.cbo.enable=true;
> explain select * from etltmp.test_struct where datestr='2019-01-01' and 
> demo_struct is not null;
> STAGE PLANS:
>   Stage: Stage-0
> Fetch Operator
>   limit: -1
>   Processor Tree:
> TableScan
>   alias: test_struct
>   filterExpr: (datestr = '2019-01-01') (type: boolean) <- Note 
> that demo_struct filter is not added here
>   Filter Operator
> predicate: (datestr = '2019-01-01') (type: boolean)
> Select Operator
>   expressions: f1 (type: string), demo_struct (type: 
> struct), '2019-01-01' (type: string)
>   outputColumnNames: _col0, _col1, _col2
>   ListSink
> set hive.cbo.enable=false;
> explain select * from etltmp.test_struct where datestr='2019-01-01' and 
> demo_struct is not null;
> STAGE PLANS:
>   Stage: Stage-0
> Fetch Operator
>   limit: -1
>   Processor Tree:
> TableScan
>   alias: test_struct
>   filterExpr: ((datestr = '2019-01-01') and demo_struct is not null) 
> (type: boolean) <- Note that demo_struct filter is added when CBO is 
> turned off
>   Filter Operator
> predicate: ((datestr = '2019-01-01') and demo_struct is not null) 
> (type: boolean)
> Select Operator
>   expressions: f1 (type: string), demo_struct (type: 
> struct), '2019-01-01' (type: string)
>   outputColumnNames: _col0, _col1, _col2
>   ListSink
> {noformat}
> In CalcitePlanner::genFilterRelNode, the following code misses to evaluate 
> this filter. 
> {noformat}
> RexNode factoredFilterExpr = RexUtil
>   .pullFactors(cluster.getRexBuilder(), convertedFilterExpr);
> {noformat}
> Note that even if we add `demo_struct.f1` it would end up pushing the filter 
> correctly. 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Updated] (HIVE-21778) CBO: "Struct is not null" gets evaluated as `nullable` always causing filter miss in the query

2020-03-02 Thread Vineet Garg (Jira)


 [ 
https://issues.apache.org/jira/browse/HIVE-21778?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Vineet Garg updated HIVE-21778:
---
Attachment: HIVE-21778.4.patch

> CBO: "Struct is not null" gets evaluated as `nullable` always causing filter 
> miss in the query
> --
>
> Key: HIVE-21778
> URL: https://issues.apache.org/jira/browse/HIVE-21778
> Project: Hive
>  Issue Type: Bug
>  Components: CBO
>Affects Versions: 4.0.0, 2.3.5
>Reporter: Rajesh Balamohan
>Assignee: Vineet Garg
>Priority: Major
>  Labels: pull-request-available
> Attachments: HIVE-21778.1.patch, HIVE-21778.2.patch, 
> HIVE-21778.3.patch, HIVE-21778.4.patch, test_null.q, test_null.q.out
>
>  Time Spent: 40m
>  Remaining Estimate: 0h
>
> {noformat}
> drop table if exists test_struct;
> CREATE external TABLE test_struct
> (
>   f1 string,
>   demo_struct struct,
>   datestr string
> );
> set hive.cbo.enable=true;
> explain select * from etltmp.test_struct where datestr='2019-01-01' and 
> demo_struct is not null;
> STAGE PLANS:
>   Stage: Stage-0
> Fetch Operator
>   limit: -1
>   Processor Tree:
> TableScan
>   alias: test_struct
>   filterExpr: (datestr = '2019-01-01') (type: boolean) <- Note 
> that demo_struct filter is not added here
>   Filter Operator
> predicate: (datestr = '2019-01-01') (type: boolean)
> Select Operator
>   expressions: f1 (type: string), demo_struct (type: 
> struct), '2019-01-01' (type: string)
>   outputColumnNames: _col0, _col1, _col2
>   ListSink
> set hive.cbo.enable=false;
> explain select * from etltmp.test_struct where datestr='2019-01-01' and 
> demo_struct is not null;
> STAGE PLANS:
>   Stage: Stage-0
> Fetch Operator
>   limit: -1
>   Processor Tree:
> TableScan
>   alias: test_struct
>   filterExpr: ((datestr = '2019-01-01') and demo_struct is not null) 
> (type: boolean) <- Note that demo_struct filter is added when CBO is 
> turned off
>   Filter Operator
> predicate: ((datestr = '2019-01-01') and demo_struct is not null) 
> (type: boolean)
> Select Operator
>   expressions: f1 (type: string), demo_struct (type: 
> struct), '2019-01-01' (type: string)
>   outputColumnNames: _col0, _col1, _col2
>   ListSink
> {noformat}
> In CalcitePlanner::genFilterRelNode, the following code misses to evaluate 
> this filter. 
> {noformat}
> RexNode factoredFilterExpr = RexUtil
>   .pullFactors(cluster.getRexBuilder(), convertedFilterExpr);
> {noformat}
> Note that even if we add `demo_struct.f1` it would end up pushing the filter 
> correctly. 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Updated] (HIVE-21778) CBO: "Struct is not null" gets evaluated as `nullable` always causing filter miss in the query

2020-02-28 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/HIVE-21778?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

ASF GitHub Bot updated HIVE-21778:
--
Labels: pull-request-available  (was: )

> CBO: "Struct is not null" gets evaluated as `nullable` always causing filter 
> miss in the query
> --
>
> Key: HIVE-21778
> URL: https://issues.apache.org/jira/browse/HIVE-21778
> Project: Hive
>  Issue Type: Bug
>  Components: CBO
>Affects Versions: 4.0.0, 2.3.5
>Reporter: Rajesh Balamohan
>Assignee: Vineet Garg
>Priority: Major
>  Labels: pull-request-available
> Attachments: HIVE-21778.1.patch, HIVE-21778.2.patch, 
> HIVE-21778.3.patch, test_null.q, test_null.q.out
>
>
> {noformat}
> drop table if exists test_struct;
> CREATE external TABLE test_struct
> (
>   f1 string,
>   demo_struct struct,
>   datestr string
> );
> set hive.cbo.enable=true;
> explain select * from etltmp.test_struct where datestr='2019-01-01' and 
> demo_struct is not null;
> STAGE PLANS:
>   Stage: Stage-0
> Fetch Operator
>   limit: -1
>   Processor Tree:
> TableScan
>   alias: test_struct
>   filterExpr: (datestr = '2019-01-01') (type: boolean) <- Note 
> that demo_struct filter is not added here
>   Filter Operator
> predicate: (datestr = '2019-01-01') (type: boolean)
> Select Operator
>   expressions: f1 (type: string), demo_struct (type: 
> struct), '2019-01-01' (type: string)
>   outputColumnNames: _col0, _col1, _col2
>   ListSink
> set hive.cbo.enable=false;
> explain select * from etltmp.test_struct where datestr='2019-01-01' and 
> demo_struct is not null;
> STAGE PLANS:
>   Stage: Stage-0
> Fetch Operator
>   limit: -1
>   Processor Tree:
> TableScan
>   alias: test_struct
>   filterExpr: ((datestr = '2019-01-01') and demo_struct is not null) 
> (type: boolean) <- Note that demo_struct filter is added when CBO is 
> turned off
>   Filter Operator
> predicate: ((datestr = '2019-01-01') and demo_struct is not null) 
> (type: boolean)
> Select Operator
>   expressions: f1 (type: string), demo_struct (type: 
> struct), '2019-01-01' (type: string)
>   outputColumnNames: _col0, _col1, _col2
>   ListSink
> {noformat}
> In CalcitePlanner::genFilterRelNode, the following code misses to evaluate 
> this filter. 
> {noformat}
> RexNode factoredFilterExpr = RexUtil
>   .pullFactors(cluster.getRexBuilder(), convertedFilterExpr);
> {noformat}
> Note that even if we add `demo_struct.f1` it would end up pushing the filter 
> correctly. 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Updated] (HIVE-21778) CBO: "Struct is not null" gets evaluated as `nullable` always causing filter miss in the query

2020-02-28 Thread Vineet Garg (Jira)


 [ 
https://issues.apache.org/jira/browse/HIVE-21778?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Vineet Garg updated HIVE-21778:
---
Attachment: HIVE-21778.3.patch

> CBO: "Struct is not null" gets evaluated as `nullable` always causing filter 
> miss in the query
> --
>
> Key: HIVE-21778
> URL: https://issues.apache.org/jira/browse/HIVE-21778
> Project: Hive
>  Issue Type: Bug
>  Components: CBO
>Affects Versions: 4.0.0, 2.3.5
>Reporter: Rajesh Balamohan
>Assignee: Vineet Garg
>Priority: Major
> Attachments: HIVE-21778.1.patch, HIVE-21778.2.patch, 
> HIVE-21778.3.patch, test_null.q, test_null.q.out
>
>
> {noformat}
> drop table if exists test_struct;
> CREATE external TABLE test_struct
> (
>   f1 string,
>   demo_struct struct,
>   datestr string
> );
> set hive.cbo.enable=true;
> explain select * from etltmp.test_struct where datestr='2019-01-01' and 
> demo_struct is not null;
> STAGE PLANS:
>   Stage: Stage-0
> Fetch Operator
>   limit: -1
>   Processor Tree:
> TableScan
>   alias: test_struct
>   filterExpr: (datestr = '2019-01-01') (type: boolean) <- Note 
> that demo_struct filter is not added here
>   Filter Operator
> predicate: (datestr = '2019-01-01') (type: boolean)
> Select Operator
>   expressions: f1 (type: string), demo_struct (type: 
> struct), '2019-01-01' (type: string)
>   outputColumnNames: _col0, _col1, _col2
>   ListSink
> set hive.cbo.enable=false;
> explain select * from etltmp.test_struct where datestr='2019-01-01' and 
> demo_struct is not null;
> STAGE PLANS:
>   Stage: Stage-0
> Fetch Operator
>   limit: -1
>   Processor Tree:
> TableScan
>   alias: test_struct
>   filterExpr: ((datestr = '2019-01-01') and demo_struct is not null) 
> (type: boolean) <- Note that demo_struct filter is added when CBO is 
> turned off
>   Filter Operator
> predicate: ((datestr = '2019-01-01') and demo_struct is not null) 
> (type: boolean)
> Select Operator
>   expressions: f1 (type: string), demo_struct (type: 
> struct), '2019-01-01' (type: string)
>   outputColumnNames: _col0, _col1, _col2
>   ListSink
> {noformat}
> In CalcitePlanner::genFilterRelNode, the following code misses to evaluate 
> this filter. 
> {noformat}
> RexNode factoredFilterExpr = RexUtil
>   .pullFactors(cluster.getRexBuilder(), convertedFilterExpr);
> {noformat}
> Note that even if we add `demo_struct.f1` it would end up pushing the filter 
> correctly. 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Updated] (HIVE-21778) CBO: "Struct is not null" gets evaluated as `nullable` always causing filter miss in the query

2020-02-28 Thread Vineet Garg (Jira)


 [ 
https://issues.apache.org/jira/browse/HIVE-21778?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Vineet Garg updated HIVE-21778:
---
Status: Patch Available  (was: In Progress)

> CBO: "Struct is not null" gets evaluated as `nullable` always causing filter 
> miss in the query
> --
>
> Key: HIVE-21778
> URL: https://issues.apache.org/jira/browse/HIVE-21778
> Project: Hive
>  Issue Type: Bug
>  Components: CBO
>Affects Versions: 2.3.5, 4.0.0
>Reporter: Rajesh Balamohan
>Assignee: Vineet Garg
>Priority: Major
> Attachments: HIVE-21778.1.patch, HIVE-21778.2.patch, 
> HIVE-21778.3.patch, test_null.q, test_null.q.out
>
>
> {noformat}
> drop table if exists test_struct;
> CREATE external TABLE test_struct
> (
>   f1 string,
>   demo_struct struct,
>   datestr string
> );
> set hive.cbo.enable=true;
> explain select * from etltmp.test_struct where datestr='2019-01-01' and 
> demo_struct is not null;
> STAGE PLANS:
>   Stage: Stage-0
> Fetch Operator
>   limit: -1
>   Processor Tree:
> TableScan
>   alias: test_struct
>   filterExpr: (datestr = '2019-01-01') (type: boolean) <- Note 
> that demo_struct filter is not added here
>   Filter Operator
> predicate: (datestr = '2019-01-01') (type: boolean)
> Select Operator
>   expressions: f1 (type: string), demo_struct (type: 
> struct), '2019-01-01' (type: string)
>   outputColumnNames: _col0, _col1, _col2
>   ListSink
> set hive.cbo.enable=false;
> explain select * from etltmp.test_struct where datestr='2019-01-01' and 
> demo_struct is not null;
> STAGE PLANS:
>   Stage: Stage-0
> Fetch Operator
>   limit: -1
>   Processor Tree:
> TableScan
>   alias: test_struct
>   filterExpr: ((datestr = '2019-01-01') and demo_struct is not null) 
> (type: boolean) <- Note that demo_struct filter is added when CBO is 
> turned off
>   Filter Operator
> predicate: ((datestr = '2019-01-01') and demo_struct is not null) 
> (type: boolean)
> Select Operator
>   expressions: f1 (type: string), demo_struct (type: 
> struct), '2019-01-01' (type: string)
>   outputColumnNames: _col0, _col1, _col2
>   ListSink
> {noformat}
> In CalcitePlanner::genFilterRelNode, the following code misses to evaluate 
> this filter. 
> {noformat}
> RexNode factoredFilterExpr = RexUtil
>   .pullFactors(cluster.getRexBuilder(), convertedFilterExpr);
> {noformat}
> Note that even if we add `demo_struct.f1` it would end up pushing the filter 
> correctly. 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Updated] (HIVE-21778) CBO: "Struct is not null" gets evaluated as `nullable` always causing filter miss in the query

2020-02-28 Thread Vineet Garg (Jira)


 [ 
https://issues.apache.org/jira/browse/HIVE-21778?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Vineet Garg updated HIVE-21778:
---
Status: Open  (was: Patch Available)

> CBO: "Struct is not null" gets evaluated as `nullable` always causing filter 
> miss in the query
> --
>
> Key: HIVE-21778
> URL: https://issues.apache.org/jira/browse/HIVE-21778
> Project: Hive
>  Issue Type: Bug
>  Components: CBO
>Affects Versions: 2.3.5, 4.0.0
>Reporter: Rajesh Balamohan
>Assignee: Vineet Garg
>Priority: Major
> Attachments: HIVE-21778.1.patch, HIVE-21778.2.patch, 
> HIVE-21778.3.patch, test_null.q, test_null.q.out
>
>
> {noformat}
> drop table if exists test_struct;
> CREATE external TABLE test_struct
> (
>   f1 string,
>   demo_struct struct,
>   datestr string
> );
> set hive.cbo.enable=true;
> explain select * from etltmp.test_struct where datestr='2019-01-01' and 
> demo_struct is not null;
> STAGE PLANS:
>   Stage: Stage-0
> Fetch Operator
>   limit: -1
>   Processor Tree:
> TableScan
>   alias: test_struct
>   filterExpr: (datestr = '2019-01-01') (type: boolean) <- Note 
> that demo_struct filter is not added here
>   Filter Operator
> predicate: (datestr = '2019-01-01') (type: boolean)
> Select Operator
>   expressions: f1 (type: string), demo_struct (type: 
> struct), '2019-01-01' (type: string)
>   outputColumnNames: _col0, _col1, _col2
>   ListSink
> set hive.cbo.enable=false;
> explain select * from etltmp.test_struct where datestr='2019-01-01' and 
> demo_struct is not null;
> STAGE PLANS:
>   Stage: Stage-0
> Fetch Operator
>   limit: -1
>   Processor Tree:
> TableScan
>   alias: test_struct
>   filterExpr: ((datestr = '2019-01-01') and demo_struct is not null) 
> (type: boolean) <- Note that demo_struct filter is added when CBO is 
> turned off
>   Filter Operator
> predicate: ((datestr = '2019-01-01') and demo_struct is not null) 
> (type: boolean)
> Select Operator
>   expressions: f1 (type: string), demo_struct (type: 
> struct), '2019-01-01' (type: string)
>   outputColumnNames: _col0, _col1, _col2
>   ListSink
> {noformat}
> In CalcitePlanner::genFilterRelNode, the following code misses to evaluate 
> this filter. 
> {noformat}
> RexNode factoredFilterExpr = RexUtil
>   .pullFactors(cluster.getRexBuilder(), convertedFilterExpr);
> {noformat}
> Note that even if we add `demo_struct.f1` it would end up pushing the filter 
> correctly. 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Updated] (HIVE-21778) CBO: "Struct is not null" gets evaluated as `nullable` always causing filter miss in the query

2020-02-11 Thread Vineet Garg (Jira)


 [ 
https://issues.apache.org/jira/browse/HIVE-21778?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Vineet Garg updated HIVE-21778:
---
Status: Patch Available  (was: Open)

> CBO: "Struct is not null" gets evaluated as `nullable` always causing filter 
> miss in the query
> --
>
> Key: HIVE-21778
> URL: https://issues.apache.org/jira/browse/HIVE-21778
> Project: Hive
>  Issue Type: Bug
>  Components: CBO
>Affects Versions: 2.3.5, 4.0.0
>Reporter: Rajesh Balamohan
>Assignee: Vineet Garg
>Priority: Major
> Attachments: HIVE-21778.1.patch, HIVE-21778.2.patch, test_null.q, 
> test_null.q.out
>
>
> {noformat}
> drop table if exists test_struct;
> CREATE external TABLE test_struct
> (
>   f1 string,
>   demo_struct struct,
>   datestr string
> );
> set hive.cbo.enable=true;
> explain select * from etltmp.test_struct where datestr='2019-01-01' and 
> demo_struct is not null;
> STAGE PLANS:
>   Stage: Stage-0
> Fetch Operator
>   limit: -1
>   Processor Tree:
> TableScan
>   alias: test_struct
>   filterExpr: (datestr = '2019-01-01') (type: boolean) <- Note 
> that demo_struct filter is not added here
>   Filter Operator
> predicate: (datestr = '2019-01-01') (type: boolean)
> Select Operator
>   expressions: f1 (type: string), demo_struct (type: 
> struct), '2019-01-01' (type: string)
>   outputColumnNames: _col0, _col1, _col2
>   ListSink
> set hive.cbo.enable=false;
> explain select * from etltmp.test_struct where datestr='2019-01-01' and 
> demo_struct is not null;
> STAGE PLANS:
>   Stage: Stage-0
> Fetch Operator
>   limit: -1
>   Processor Tree:
> TableScan
>   alias: test_struct
>   filterExpr: ((datestr = '2019-01-01') and demo_struct is not null) 
> (type: boolean) <- Note that demo_struct filter is added when CBO is 
> turned off
>   Filter Operator
> predicate: ((datestr = '2019-01-01') and demo_struct is not null) 
> (type: boolean)
> Select Operator
>   expressions: f1 (type: string), demo_struct (type: 
> struct), '2019-01-01' (type: string)
>   outputColumnNames: _col0, _col1, _col2
>   ListSink
> {noformat}
> In CalcitePlanner::genFilterRelNode, the following code misses to evaluate 
> this filter. 
> {noformat}
> RexNode factoredFilterExpr = RexUtil
>   .pullFactors(cluster.getRexBuilder(), convertedFilterExpr);
> {noformat}
> Note that even if we add `demo_struct.f1` it would end up pushing the filter 
> correctly. 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Updated] (HIVE-21778) CBO: "Struct is not null" gets evaluated as `nullable` always causing filter miss in the query

2020-02-11 Thread Vineet Garg (Jira)


 [ 
https://issues.apache.org/jira/browse/HIVE-21778?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Vineet Garg updated HIVE-21778:
---
Attachment: HIVE-21778.2.patch

> CBO: "Struct is not null" gets evaluated as `nullable` always causing filter 
> miss in the query
> --
>
> Key: HIVE-21778
> URL: https://issues.apache.org/jira/browse/HIVE-21778
> Project: Hive
>  Issue Type: Bug
>  Components: CBO
>Affects Versions: 4.0.0, 2.3.5
>Reporter: Rajesh Balamohan
>Assignee: Vineet Garg
>Priority: Major
> Attachments: HIVE-21778.1.patch, HIVE-21778.2.patch, test_null.q, 
> test_null.q.out
>
>
> {noformat}
> drop table if exists test_struct;
> CREATE external TABLE test_struct
> (
>   f1 string,
>   demo_struct struct,
>   datestr string
> );
> set hive.cbo.enable=true;
> explain select * from etltmp.test_struct where datestr='2019-01-01' and 
> demo_struct is not null;
> STAGE PLANS:
>   Stage: Stage-0
> Fetch Operator
>   limit: -1
>   Processor Tree:
> TableScan
>   alias: test_struct
>   filterExpr: (datestr = '2019-01-01') (type: boolean) <- Note 
> that demo_struct filter is not added here
>   Filter Operator
> predicate: (datestr = '2019-01-01') (type: boolean)
> Select Operator
>   expressions: f1 (type: string), demo_struct (type: 
> struct), '2019-01-01' (type: string)
>   outputColumnNames: _col0, _col1, _col2
>   ListSink
> set hive.cbo.enable=false;
> explain select * from etltmp.test_struct where datestr='2019-01-01' and 
> demo_struct is not null;
> STAGE PLANS:
>   Stage: Stage-0
> Fetch Operator
>   limit: -1
>   Processor Tree:
> TableScan
>   alias: test_struct
>   filterExpr: ((datestr = '2019-01-01') and demo_struct is not null) 
> (type: boolean) <- Note that demo_struct filter is added when CBO is 
> turned off
>   Filter Operator
> predicate: ((datestr = '2019-01-01') and demo_struct is not null) 
> (type: boolean)
> Select Operator
>   expressions: f1 (type: string), demo_struct (type: 
> struct), '2019-01-01' (type: string)
>   outputColumnNames: _col0, _col1, _col2
>   ListSink
> {noformat}
> In CalcitePlanner::genFilterRelNode, the following code misses to evaluate 
> this filter. 
> {noformat}
> RexNode factoredFilterExpr = RexUtil
>   .pullFactors(cluster.getRexBuilder(), convertedFilterExpr);
> {noformat}
> Note that even if we add `demo_struct.f1` it would end up pushing the filter 
> correctly. 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Updated] (HIVE-21778) CBO: "Struct is not null" gets evaluated as `nullable` always causing filter miss in the query

2020-02-11 Thread Vineet Garg (Jira)


 [ 
https://issues.apache.org/jira/browse/HIVE-21778?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Vineet Garg updated HIVE-21778:
---
Status: Open  (was: Patch Available)

> CBO: "Struct is not null" gets evaluated as `nullable` always causing filter 
> miss in the query
> --
>
> Key: HIVE-21778
> URL: https://issues.apache.org/jira/browse/HIVE-21778
> Project: Hive
>  Issue Type: Bug
>  Components: CBO
>Affects Versions: 2.3.5, 4.0.0
>Reporter: Rajesh Balamohan
>Assignee: Vineet Garg
>Priority: Major
> Attachments: HIVE-21778.1.patch, HIVE-21778.2.patch, test_null.q, 
> test_null.q.out
>
>
> {noformat}
> drop table if exists test_struct;
> CREATE external TABLE test_struct
> (
>   f1 string,
>   demo_struct struct,
>   datestr string
> );
> set hive.cbo.enable=true;
> explain select * from etltmp.test_struct where datestr='2019-01-01' and 
> demo_struct is not null;
> STAGE PLANS:
>   Stage: Stage-0
> Fetch Operator
>   limit: -1
>   Processor Tree:
> TableScan
>   alias: test_struct
>   filterExpr: (datestr = '2019-01-01') (type: boolean) <- Note 
> that demo_struct filter is not added here
>   Filter Operator
> predicate: (datestr = '2019-01-01') (type: boolean)
> Select Operator
>   expressions: f1 (type: string), demo_struct (type: 
> struct), '2019-01-01' (type: string)
>   outputColumnNames: _col0, _col1, _col2
>   ListSink
> set hive.cbo.enable=false;
> explain select * from etltmp.test_struct where datestr='2019-01-01' and 
> demo_struct is not null;
> STAGE PLANS:
>   Stage: Stage-0
> Fetch Operator
>   limit: -1
>   Processor Tree:
> TableScan
>   alias: test_struct
>   filterExpr: ((datestr = '2019-01-01') and demo_struct is not null) 
> (type: boolean) <- Note that demo_struct filter is added when CBO is 
> turned off
>   Filter Operator
> predicate: ((datestr = '2019-01-01') and demo_struct is not null) 
> (type: boolean)
> Select Operator
>   expressions: f1 (type: string), demo_struct (type: 
> struct), '2019-01-01' (type: string)
>   outputColumnNames: _col0, _col1, _col2
>   ListSink
> {noformat}
> In CalcitePlanner::genFilterRelNode, the following code misses to evaluate 
> this filter. 
> {noformat}
> RexNode factoredFilterExpr = RexUtil
>   .pullFactors(cluster.getRexBuilder(), convertedFilterExpr);
> {noformat}
> Note that even if we add `demo_struct.f1` it would end up pushing the filter 
> correctly. 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Updated] (HIVE-21778) CBO: "Struct is not null" gets evaluated as `nullable` always causing filter miss in the query

2019-07-17 Thread Vineet Garg (JIRA)


 [ 
https://issues.apache.org/jira/browse/HIVE-21778?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Vineet Garg updated HIVE-21778:
---
Status: Patch Available  (was: Open)

> CBO: "Struct is not null" gets evaluated as `nullable` always causing filter 
> miss in the query
> --
>
> Key: HIVE-21778
> URL: https://issues.apache.org/jira/browse/HIVE-21778
> Project: Hive
>  Issue Type: Bug
>  Components: CBO
>Affects Versions: 2.3.5, 4.0.0
>Reporter: Rajesh Balamohan
>Assignee: Vineet Garg
>Priority: Major
> Attachments: HIVE-21778.1.patch, test_null.q, test_null.q.out
>
>
> {noformat}
> drop table if exists test_struct;
> CREATE external TABLE test_struct
> (
>   f1 string,
>   demo_struct struct,
>   datestr string
> );
> set hive.cbo.enable=true;
> explain select * from etltmp.test_struct where datestr='2019-01-01' and 
> demo_struct is not null;
> STAGE PLANS:
>   Stage: Stage-0
> Fetch Operator
>   limit: -1
>   Processor Tree:
> TableScan
>   alias: test_struct
>   filterExpr: (datestr = '2019-01-01') (type: boolean) <- Note 
> that demo_struct filter is not added here
>   Filter Operator
> predicate: (datestr = '2019-01-01') (type: boolean)
> Select Operator
>   expressions: f1 (type: string), demo_struct (type: 
> struct), '2019-01-01' (type: string)
>   outputColumnNames: _col0, _col1, _col2
>   ListSink
> set hive.cbo.enable=false;
> explain select * from etltmp.test_struct where datestr='2019-01-01' and 
> demo_struct is not null;
> STAGE PLANS:
>   Stage: Stage-0
> Fetch Operator
>   limit: -1
>   Processor Tree:
> TableScan
>   alias: test_struct
>   filterExpr: ((datestr = '2019-01-01') and demo_struct is not null) 
> (type: boolean) <- Note that demo_struct filter is added when CBO is 
> turned off
>   Filter Operator
> predicate: ((datestr = '2019-01-01') and demo_struct is not null) 
> (type: boolean)
> Select Operator
>   expressions: f1 (type: string), demo_struct (type: 
> struct), '2019-01-01' (type: string)
>   outputColumnNames: _col0, _col1, _col2
>   ListSink
> {noformat}
> In CalcitePlanner::genFilterRelNode, the following code misses to evaluate 
> this filter. 
> {noformat}
> RexNode factoredFilterExpr = RexUtil
>   .pullFactors(cluster.getRexBuilder(), convertedFilterExpr);
> {noformat}
> Note that even if we add `demo_struct.f1` it would end up pushing the filter 
> correctly. 



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)


[jira] [Updated] (HIVE-21778) CBO: "Struct is not null" gets evaluated as `nullable` always causing filter miss in the query

2019-07-17 Thread Vineet Garg (JIRA)


 [ 
https://issues.apache.org/jira/browse/HIVE-21778?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Vineet Garg updated HIVE-21778:
---
Attachment: HIVE-21778.1.patch

> CBO: "Struct is not null" gets evaluated as `nullable` always causing filter 
> miss in the query
> --
>
> Key: HIVE-21778
> URL: https://issues.apache.org/jira/browse/HIVE-21778
> Project: Hive
>  Issue Type: Bug
>  Components: CBO
>Affects Versions: 4.0.0, 2.3.5
>Reporter: Rajesh Balamohan
>Assignee: Vineet Garg
>Priority: Major
> Attachments: HIVE-21778.1.patch, test_null.q, test_null.q.out
>
>
> {noformat}
> drop table if exists test_struct;
> CREATE external TABLE test_struct
> (
>   f1 string,
>   demo_struct struct,
>   datestr string
> );
> set hive.cbo.enable=true;
> explain select * from etltmp.test_struct where datestr='2019-01-01' and 
> demo_struct is not null;
> STAGE PLANS:
>   Stage: Stage-0
> Fetch Operator
>   limit: -1
>   Processor Tree:
> TableScan
>   alias: test_struct
>   filterExpr: (datestr = '2019-01-01') (type: boolean) <- Note 
> that demo_struct filter is not added here
>   Filter Operator
> predicate: (datestr = '2019-01-01') (type: boolean)
> Select Operator
>   expressions: f1 (type: string), demo_struct (type: 
> struct), '2019-01-01' (type: string)
>   outputColumnNames: _col0, _col1, _col2
>   ListSink
> set hive.cbo.enable=false;
> explain select * from etltmp.test_struct where datestr='2019-01-01' and 
> demo_struct is not null;
> STAGE PLANS:
>   Stage: Stage-0
> Fetch Operator
>   limit: -1
>   Processor Tree:
> TableScan
>   alias: test_struct
>   filterExpr: ((datestr = '2019-01-01') and demo_struct is not null) 
> (type: boolean) <- Note that demo_struct filter is added when CBO is 
> turned off
>   Filter Operator
> predicate: ((datestr = '2019-01-01') and demo_struct is not null) 
> (type: boolean)
> Select Operator
>   expressions: f1 (type: string), demo_struct (type: 
> struct), '2019-01-01' (type: string)
>   outputColumnNames: _col0, _col1, _col2
>   ListSink
> {noformat}
> In CalcitePlanner::genFilterRelNode, the following code misses to evaluate 
> this filter. 
> {noformat}
> RexNode factoredFilterExpr = RexUtil
>   .pullFactors(cluster.getRexBuilder(), convertedFilterExpr);
> {noformat}
> Note that even if we add `demo_struct.f1` it would end up pushing the filter 
> correctly. 



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)


[jira] [Updated] (HIVE-21778) CBO: "Struct is not null" gets evaluated as `nullable` always causing filter miss in the query

2019-07-17 Thread Rajesh Balamohan (JIRA)


 [ 
https://issues.apache.org/jira/browse/HIVE-21778?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Rajesh Balamohan updated HIVE-21778:

Description: 
{noformat}
drop table if exists test_struct;
CREATE external TABLE test_struct
(
  f1 string,
  demo_struct struct,
  datestr string
);

set hive.cbo.enable=true;
explain select * from etltmp.test_struct where datestr='2019-01-01' and 
demo_struct is not null;



STAGE PLANS:
  Stage: Stage-0
Fetch Operator
  limit: -1
  Processor Tree:
TableScan
  alias: test_struct
  filterExpr: (datestr = '2019-01-01') (type: boolean) <- Note that 
demo_struct filter is not added here
  Filter Operator
predicate: (datestr = '2019-01-01') (type: boolean)
Select Operator
  expressions: f1 (type: string), demo_struct (type: 
struct), '2019-01-01' (type: string)
  outputColumnNames: _col0, _col1, _col2
  ListSink


set hive.cbo.enable=false;
explain select * from etltmp.test_struct where datestr='2019-01-01' and 
demo_struct is not null;


STAGE PLANS:
  Stage: Stage-0
Fetch Operator
  limit: -1
  Processor Tree:
TableScan
  alias: test_struct
  filterExpr: ((datestr = '2019-01-01') and demo_struct is not null) 
(type: boolean) <- Note that demo_struct filter is added when CBO is turned 
off
  Filter Operator
predicate: ((datestr = '2019-01-01') and demo_struct is not null) 
(type: boolean)
Select Operator
  expressions: f1 (type: string), demo_struct (type: 
struct), '2019-01-01' (type: string)
  outputColumnNames: _col0, _col1, _col2
  ListSink

{noformat}

In CalcitePlanner::genFilterRelNode, the following code misses to evaluate this 
filter. 
{noformat}
RexNode factoredFilterExpr = RexUtil
  .pullFactors(cluster.getRexBuilder(), convertedFilterExpr);
{noformat}

Note that even if we add `demo_struct.f1` it would end up pushing the filter 
correctly. 

  was:

{noformat}
drop table if exists test_struct;
CREATE external TABLE test_struct
(
  f1 string,
  demo_struct struct,
  datestr string
);

set hive.cbo.enable=true;
explain select * from etltmp.test_struct where datestr='2019-01-01' and 
demo_struct is not null;



STAGE PLANS:
  Stage: Stage-0
Fetch Operator
  limit: -1
  Processor Tree:
TableScan
  alias: test_struct
  filterExpr: (datestr = '2019-01-01') (type: boolean) <- Note that 
demo_struct filter is not added here
  Filter Operator
predicate: (datestr = '2019-01-01') (type: boolean)
Select Operator
  expressions: f1 (type: string), demo_struct (type: 
struct), '2019-01-01' (type: string)
  outputColumnNames: _col0, _col1, _col2
  ListSink


set hive.cbo.enable=false;
explain select * from etltmp.test_struct where datestr='2019-01-01' and 
demo_struct is not null;


STAGE PLANS:
  Stage: Stage-0
Fetch Operator
  limit: -1
  Processor Tree:
TableScan
  alias: test_struct
  filterExpr: ((datestr = '2019-01-01') and demo_struct is not null) 
(type: boolean) <- Note that demo_struct filter is added when CBO is turned 
off
  Filter Operator
predicate: ((datestr = '2019-01-01') and demo_struct is not null) 
(type: boolean)
Select Operator
  expressions: f1 (type: string), demo_struct (type: 
struct), '2019-01-01' (type: string)
  outputColumnNames: _col0, _col1, _col2
  ListSink

{noformat}

In CalcitePlanner::genFilterRelNode, the following code misses to evaluate this 
filter. 
{noformat}
RexNode factoredFilterExpr = RexUtil
  .pullFactors(cluster.getRexBuilder(), convertedFilterExpr);
{noformat}

Note that even if we add `demo_struct.f1` it would end up pushing the filter 
correctly. Suspecting {code}RexCall::isAlwaysTrue{code} is evaluating to true 
in this case.


> CBO: "Struct is not null" gets evaluated as `nullable` always causing filter 
> miss in the query
> --
>
> Key: HIVE-21778
> URL: https://issues.apache.org/jira/browse/HIVE-21778
> Project: Hive
>  Issue Type: Bug
>  Components: CBO
>Affects Versions: 4.0.0, 2.3.5
>Reporter: Rajesh Balamohan
>Priority: Major
> Attachments: test_null.q, test_null.q.out
>
>
> {noformat}
> drop table if exists test_struct;
> CREATE external TABLE test_struct
> (
>   f1 string,
>   demo_struct struct,
>   datestr string
> );
> set hive.cbo.enable=true;
> explain select * from etltmp.test_struct where datestr='2019-01-01' and 
> demo_struct is not null;
> STAGE PLANS:
>   Stage: Stage-0
> Fetch Operator
>   limit: -1
>  

[jira] [Updated] (HIVE-21778) CBO: "Struct is not null" gets evaluated as `nullable` always causing filter miss in the query

2019-07-17 Thread Rajesh Balamohan (JIRA)


 [ 
https://issues.apache.org/jira/browse/HIVE-21778?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Rajesh Balamohan updated HIVE-21778:

Summary: CBO: "Struct is not null" gets evaluated as `nullable` always 
causing filter miss in the query  (was: CBO: "Struct is not null" gets 
evaluated as `nullable` always causing pushdown miss in the query)

> CBO: "Struct is not null" gets evaluated as `nullable` always causing filter 
> miss in the query
> --
>
> Key: HIVE-21778
> URL: https://issues.apache.org/jira/browse/HIVE-21778
> Project: Hive
>  Issue Type: Bug
>  Components: CBO
>Affects Versions: 2.3.5
>Reporter: Rajesh Balamohan
>Priority: Major
> Attachments: test_null.q, test_null.q.out
>
>
> {noformat}
> drop table if exists test_struct;
> CREATE external TABLE test_struct
> (
>   f1 string,
>   demo_struct struct,
>   datestr string
> );
> set hive.cbo.enable=true;
> explain select * from etltmp.test_struct where datestr='2019-01-01' and 
> demo_struct is not null;
> STAGE PLANS:
>   Stage: Stage-0
> Fetch Operator
>   limit: -1
>   Processor Tree:
> TableScan
>   alias: test_struct
>   filterExpr: (datestr = '2019-01-01') (type: boolean) <- Note 
> that demo_struct filter is not added here
>   Filter Operator
> predicate: (datestr = '2019-01-01') (type: boolean)
> Select Operator
>   expressions: f1 (type: string), demo_struct (type: 
> struct), '2019-01-01' (type: string)
>   outputColumnNames: _col0, _col1, _col2
>   ListSink
> set hive.cbo.enable=false;
> explain select * from etltmp.test_struct where datestr='2019-01-01' and 
> demo_struct is not null;
> STAGE PLANS:
>   Stage: Stage-0
> Fetch Operator
>   limit: -1
>   Processor Tree:
> TableScan
>   alias: test_struct
>   filterExpr: ((datestr = '2019-01-01') and demo_struct is not null) 
> (type: boolean) <- Note that demo_struct filter is added when CBO is 
> turned off
>   Filter Operator
> predicate: ((datestr = '2019-01-01') and demo_struct is not null) 
> (type: boolean)
> Select Operator
>   expressions: f1 (type: string), demo_struct (type: 
> struct), '2019-01-01' (type: string)
>   outputColumnNames: _col0, _col1, _col2
>   ListSink
> {noformat}
> In CalcitePlanner::genFilterRelNode, the following code misses to evaluate 
> this filter. 
> {noformat}
> RexNode factoredFilterExpr = RexUtil
>   .pullFactors(cluster.getRexBuilder(), convertedFilterExpr);
> {noformat}
> Note that even if we add `demo_struct.f1` it would end up pushing the filter 
> correctly. Suspecting {code}RexCall::isAlwaysTrue{code} is evaluating to true 
> in this case.



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)


[jira] [Updated] (HIVE-21778) CBO: "Struct is not null" gets evaluated as `nullable` always causing filter miss in the query

2019-07-17 Thread Rajesh Balamohan (JIRA)


 [ 
https://issues.apache.org/jira/browse/HIVE-21778?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Rajesh Balamohan updated HIVE-21778:

Attachment: test_null.q.out
test_null.q

> CBO: "Struct is not null" gets evaluated as `nullable` always causing filter 
> miss in the query
> --
>
> Key: HIVE-21778
> URL: https://issues.apache.org/jira/browse/HIVE-21778
> Project: Hive
>  Issue Type: Bug
>  Components: CBO
>Affects Versions: 4.0.0, 2.3.5
>Reporter: Rajesh Balamohan
>Priority: Major
> Attachments: test_null.q, test_null.q.out
>
>
> {noformat}
> drop table if exists test_struct;
> CREATE external TABLE test_struct
> (
>   f1 string,
>   demo_struct struct,
>   datestr string
> );
> set hive.cbo.enable=true;
> explain select * from etltmp.test_struct where datestr='2019-01-01' and 
> demo_struct is not null;
> STAGE PLANS:
>   Stage: Stage-0
> Fetch Operator
>   limit: -1
>   Processor Tree:
> TableScan
>   alias: test_struct
>   filterExpr: (datestr = '2019-01-01') (type: boolean) <- Note 
> that demo_struct filter is not added here
>   Filter Operator
> predicate: (datestr = '2019-01-01') (type: boolean)
> Select Operator
>   expressions: f1 (type: string), demo_struct (type: 
> struct), '2019-01-01' (type: string)
>   outputColumnNames: _col0, _col1, _col2
>   ListSink
> set hive.cbo.enable=false;
> explain select * from etltmp.test_struct where datestr='2019-01-01' and 
> demo_struct is not null;
> STAGE PLANS:
>   Stage: Stage-0
> Fetch Operator
>   limit: -1
>   Processor Tree:
> TableScan
>   alias: test_struct
>   filterExpr: ((datestr = '2019-01-01') and demo_struct is not null) 
> (type: boolean) <- Note that demo_struct filter is added when CBO is 
> turned off
>   Filter Operator
> predicate: ((datestr = '2019-01-01') and demo_struct is not null) 
> (type: boolean)
> Select Operator
>   expressions: f1 (type: string), demo_struct (type: 
> struct), '2019-01-01' (type: string)
>   outputColumnNames: _col0, _col1, _col2
>   ListSink
> {noformat}
> In CalcitePlanner::genFilterRelNode, the following code misses to evaluate 
> this filter. 
> {noformat}
> RexNode factoredFilterExpr = RexUtil
>   .pullFactors(cluster.getRexBuilder(), convertedFilterExpr);
> {noformat}
> Note that even if we add `demo_struct.f1` it would end up pushing the filter 
> correctly. Suspecting {code}RexCall::isAlwaysTrue{code} is evaluating to true 
> in this case.



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)


[jira] [Updated] (HIVE-21778) CBO: "Struct is not null" gets evaluated as `nullable` always causing filter miss in the query

2019-07-17 Thread Rajesh Balamohan (JIRA)


 [ 
https://issues.apache.org/jira/browse/HIVE-21778?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Rajesh Balamohan updated HIVE-21778:

Affects Version/s: 4.0.0

> CBO: "Struct is not null" gets evaluated as `nullable` always causing filter 
> miss in the query
> --
>
> Key: HIVE-21778
> URL: https://issues.apache.org/jira/browse/HIVE-21778
> Project: Hive
>  Issue Type: Bug
>  Components: CBO
>Affects Versions: 4.0.0, 2.3.5
>Reporter: Rajesh Balamohan
>Priority: Major
> Attachments: test_null.q, test_null.q.out
>
>
> {noformat}
> drop table if exists test_struct;
> CREATE external TABLE test_struct
> (
>   f1 string,
>   demo_struct struct,
>   datestr string
> );
> set hive.cbo.enable=true;
> explain select * from etltmp.test_struct where datestr='2019-01-01' and 
> demo_struct is not null;
> STAGE PLANS:
>   Stage: Stage-0
> Fetch Operator
>   limit: -1
>   Processor Tree:
> TableScan
>   alias: test_struct
>   filterExpr: (datestr = '2019-01-01') (type: boolean) <- Note 
> that demo_struct filter is not added here
>   Filter Operator
> predicate: (datestr = '2019-01-01') (type: boolean)
> Select Operator
>   expressions: f1 (type: string), demo_struct (type: 
> struct), '2019-01-01' (type: string)
>   outputColumnNames: _col0, _col1, _col2
>   ListSink
> set hive.cbo.enable=false;
> explain select * from etltmp.test_struct where datestr='2019-01-01' and 
> demo_struct is not null;
> STAGE PLANS:
>   Stage: Stage-0
> Fetch Operator
>   limit: -1
>   Processor Tree:
> TableScan
>   alias: test_struct
>   filterExpr: ((datestr = '2019-01-01') and demo_struct is not null) 
> (type: boolean) <- Note that demo_struct filter is added when CBO is 
> turned off
>   Filter Operator
> predicate: ((datestr = '2019-01-01') and demo_struct is not null) 
> (type: boolean)
> Select Operator
>   expressions: f1 (type: string), demo_struct (type: 
> struct), '2019-01-01' (type: string)
>   outputColumnNames: _col0, _col1, _col2
>   ListSink
> {noformat}
> In CalcitePlanner::genFilterRelNode, the following code misses to evaluate 
> this filter. 
> {noformat}
> RexNode factoredFilterExpr = RexUtil
>   .pullFactors(cluster.getRexBuilder(), convertedFilterExpr);
> {noformat}
> Note that even if we add `demo_struct.f1` it would end up pushing the filter 
> correctly. Suspecting {code}RexCall::isAlwaysTrue{code} is evaluating to true 
> in this case.



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)