[ https://issues.apache.org/jira/browse/HIVE-27296?focusedWorklogId=859516&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-859516 ]
ASF GitHub Bot logged work on HIVE-27296: ----------------------------------------- Author: ASF GitHub Bot Created on: 27/Apr/23 22:43 Start Date: 27/Apr/23 22:43 Worklog Time Spent: 10m Work Description: sonarcloud[bot] commented on PR #4275: URL: https://github.com/apache/hive/pull/4275#issuecomment-1526664111 Kudos, SonarCloud Quality Gate passed! [![Quality Gate passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/passed-16px.png 'Quality Gate passed')](https://sonarcloud.io/dashboard?id=apache_hive&pullRequest=4275) [![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png 'Bug')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=4275&resolved=false&types=BUG) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=4275&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=4275&resolved=false&types=BUG) [![Vulnerability](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability-16px.png 'Vulnerability')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=4275&resolved=false&types=VULNERABILITY) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=4275&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=4275&resolved=false&types=VULNERABILITY) [![Security Hotspot](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot-16px.png 'Security Hotspot')](https://sonarcloud.io/project/security_hotspots?id=apache_hive&pullRequest=4275&resolved=false&types=SECURITY_HOTSPOT) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/security_hotspots?id=apache_hive&pullRequest=4275&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_hive&pullRequest=4275&resolved=false&types=SECURITY_HOTSPOT) [![Code Smell](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell-16px.png 'Code Smell')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=4275&resolved=false&types=CODE_SMELL) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=4275&resolved=false&types=CODE_SMELL) [16 Code Smells](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=4275&resolved=false&types=CODE_SMELL) [![No Coverage information](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/NoCoverageInfo-16px.png 'No Coverage information')](https://sonarcloud.io/component_measures?id=apache_hive&pullRequest=4275&metric=coverage&view=list) No Coverage information [![No Duplication information](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/NoDuplicationInfo-16px.png 'No Duplication information')](https://sonarcloud.io/component_measures?id=apache_hive&pullRequest=4275&metric=duplicated_lines_density&view=list) No Duplication information Issue Time Tracking ------------------- Worklog Id: (was: 859516) Remaining Estimate: 0h Time Spent: 10m > HiveRelDecorrelator does not handle correlation with Values > ----------------------------------------------------------- > > Key: HIVE-27296 > URL: https://issues.apache.org/jira/browse/HIVE-27296 > Project: Hive > Issue Type: Bug > Reporter: Stamatis Zampetakis > Assignee: Stamatis Zampetakis > Priority: Major > Time Spent: 10m > Remaining Estimate: 0h > > The {{HiveRelDecorrelator}} does not cope well with {{Values}} expressions > and when such expression exists in the plan it fails to remove the respective > {{{}Correlate{}}}. > In HIVE-27278, we discovered a query that has a correlation over an empty > {{Values}} expression. > {code:sql} > EXPLAIN CBO SELECT id FROM t1 WHERE NULL IN (SELECT NULL FROM t2 where t1.id > = t2.id);{code} > The CBO plan after decorrelation is shown below. > {noformat} > HiveProject(id=[$0]) > LogicalCorrelate(correlation=[$cor0], joinType=[semi], requiredColumns=[{}]) > HiveTableScan(table=[[default, t1]], table:alias=[t1]) > HiveValues(tuples=[[]]) > {noformat} > Although, in HIVE-27278 we could find a solution for a plan that contains an > empty {{Values}} there can be queries with correlations on non-empty > {{Values}} and for those we don't have a solution at the moment. > Normally after decorrelation we shouldn't have any {{Correlate}} expressions > in the plan. > The problem starts from > [HiveRelDecorrelator.decorrelate(Values)|https://github.com/apache/hive/blob/59058c65457fb7ab9d8575a555034e6633962661/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/rules/HiveRelDecorrelator.java#L471] > that returns null when it encounters the {{Values}} expression. > Later, in > [HiveRelDecorrelator.decorrelate(Correlate)|https://github.com/apache/hive/blob/59058c65457fb7ab9d8575a555034e6633962661/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/rules/HiveRelDecorrelator.java#L1247] > it will bail out when treating the {{Correlate}} since one of the inputs is > not rewritten. > The problem is still there in latest Calcite (CALCITE-5568). -- This message was sent by Atlassian Jira (v8.20.10#820010)