[ https://issues.apache.org/jira/browse/HIVE-21778?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16887547#comment-16887547 ]
Hive QA commented on HIVE-21778: -------------------------------- | (/) *{color:green}+1 overall{color}* | \\ \\ || Vote || Subsystem || Runtime || Comment || || || || || {color:brown} Prechecks {color} || | {color:green}+1{color} | {color:green} @author {color} | {color:green} 0m 0s{color} | {color:green} The patch does not contain any @author tags. {color} | || || || || {color:brown} master Compile Tests {color} || | {color:green}+1{color} | {color:green} mvninstall {color} | {color:green} 9m 32s{color} | {color:green} master passed {color} | | {color:green}+1{color} | {color:green} compile {color} | {color:green} 1m 10s{color} | {color:green} master passed {color} | | {color:green}+1{color} | {color:green} checkstyle {color} | {color:green} 0m 41s{color} | {color:green} master passed {color} | | {color:blue}0{color} | {color:blue} findbugs {color} | {color:blue} 4m 11s{color} | {color:blue} ql in master has 2250 extant Findbugs warnings. {color} | | {color:green}+1{color} | {color:green} javadoc {color} | {color:green} 1m 1s{color} | {color:green} master passed {color} | || || || || {color:brown} Patch Compile Tests {color} || | {color:green}+1{color} | {color:green} mvninstall {color} | {color:green} 1m 29s{color} | {color:green} the patch passed {color} | | {color:green}+1{color} | {color:green} compile {color} | {color:green} 1m 8s{color} | {color:green} the patch passed {color} | | {color:green}+1{color} | {color:green} javac {color} | {color:green} 1m 8s{color} | {color:green} the patch passed {color} | | {color:green}+1{color} | {color:green} checkstyle {color} | {color:green} 0m 40s{color} | {color:green} the patch passed {color} | | {color:green}+1{color} | {color:green} whitespace {color} | {color:green} 0m 0s{color} | {color:green} The patch has no whitespace issues. {color} | | {color:green}+1{color} | {color:green} findbugs {color} | {color:green} 4m 14s{color} | {color:green} the patch passed {color} | | {color:green}+1{color} | {color:green} javadoc {color} | {color:green} 1m 2s{color} | {color:green} the patch passed {color} | || || || || {color:brown} Other Tests {color} || | {color:green}+1{color} | {color:green} asflicense {color} | {color:green} 0m 14s{color} | {color:green} The patch does not generate ASF License warnings. {color} | | {color:black}{color} | {color:black} {color} | {color:black} 26m 0s{color} | {color:black} {color} | \\ \\ || Subsystem || Report/Notes || | Optional Tests | asflicense javac javadoc findbugs checkstyle compile | | uname | Linux hiveptest-server-upstream 3.16.0-4-amd64 #1 SMP Debian 3.16.43-2+deb8u5 (2017-09-19) x86_64 GNU/Linux | | Build tool | maven | | Personality | /data/hiveptest/working/yetus_PreCommit-HIVE-Build-18074/dev-support/hive-personality.sh | | git revision | master / 198ab0e | | Default Java | 1.8.0_111 | | findbugs | v3.0.0 | | modules | C: ql U: ql | | Console output | http://104.198.109.242/logs//PreCommit-HIVE-Build-18074/yetus.txt | | Powered by | Apache Yetus http://yetus.apache.org | This message was automatically generated. > 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<f1:string, f2:string, f3:string>, > 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<f1:string,f2:string,f3:string>), '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<f1:string,f2:string,f3:string>), '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)