[ https://issues.apache.org/jira/browse/HIVE-26643?focusedWorklogId=817733&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-817733 ]
ASF GitHub Bot logged work on HIVE-26643: ----------------------------------------- Author: ASF GitHub Bot Created on: 17/Oct/22 16:32 Start Date: 17/Oct/22 16:32 Worklog Time Spent: 10m Work Description: sonarcloud[bot] commented on PR #3680: URL: https://github.com/apache/hive/pull/3680#issuecomment-1281143967 Kudos, SonarCloud Quality Gate passed! [](https://sonarcloud.io/dashboard?id=apache_hive&pullRequest=3680) [](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3680&resolved=false&types=BUG) [](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3680&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3680&resolved=false&types=BUG) [](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3680&resolved=false&types=VULNERABILITY) [](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3680&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3680&resolved=false&types=VULNERABILITY) [](https://sonarcloud.io/project/security_hotspots?id=apache_hive&pullRequest=3680&resolved=false&types=SECURITY_HOTSPOT) [](https://sonarcloud.io/project/security_hotspots?id=apache_hive&pullRequest=3680&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_hive&pullRequest=3680&resolved=false&types=SECURITY_HOTSPOT) [](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3680&resolved=false&types=CODE_SMELL) [](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3680&resolved=false&types=CODE_SMELL) [1 Code Smell](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3680&resolved=false&types=CODE_SMELL) [](https://sonarcloud.io/component_measures?id=apache_hive&pullRequest=3680&metric=coverage&view=list) No Coverage information [](https://sonarcloud.io/component_measures?id=apache_hive&pullRequest=3680&metric=duplicated_lines_density&view=list) No Duplication information Issue Time Tracking ------------------- Worklog Id: (was: 817733) Time Spent: 20m (was: 10m) > HiveUnionPullUpConstantsRule produces an invalid plan when pulling up > constants for nullable fields > --------------------------------------------------------------------------------------------------- > > Key: HIVE-26643 > URL: https://issues.apache.org/jira/browse/HIVE-26643 > Project: Hive > Issue Type: Bug > Components: CBO > Affects Versions: 4.0.0-alpha-2 > Reporter: Alessandro Solimando > Assignee: Alessandro Solimando > Priority: Major > Labels: pull-request-available > Time Spent: 20m > Remaining Estimate: 0h > > The rule does pull up constants without checking/adjusting nullability to > match that of the field type. > Here is the stack-trace when a nullable type is involved: > {code:java} > java.lang.AssertionError: Cannot add expression of different type to set: > set type is RecordType(JavaType(class java.lang.Integer) f1, JavaType(int) > NOT NULL f2) NOT NULL > expression type is RecordType(JavaType(int) NOT NULL f1, JavaType(int) NOT > NULL f2) NOT NULL > set is > rel#38:HiveUnion.(input#0=HepRelVertex#35,input#1=HepRelVertex#35,all=true) > expression is HiveProject(f1=[1], f2=[$0]) > HiveUnion(all=[true]) > HiveProject(f2=[$1]) > HiveProject(f1=[$0], f2=[$1]) > HiveFilter(condition=[=($0, 1)]) > LogicalTableScan(table=[[]]) > HiveProject(f2=[$1]) > HiveProject(f1=[$0], f2=[$1]) > HiveFilter(condition=[=($0, 1)]) > LogicalTableScan(table=[[]]) > {code} > The solution is to check nullability and add a cast when the field is > nullable, since the constant's type is not. -- This message was sent by Atlassian Jira (v8.20.10#820010)