[
https://issues.apache.org/jira/browse/HIVE-27157?focusedWorklogId=852082&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-852082
]
ASF GitHub Bot logged work on HIVE-27157:
-----------------------------------------
Author: ASF GitHub Bot
Created on: 21/Mar/23 18:12
Start Date: 21/Mar/23 18:12
Worklog Time Spent: 10m
Work Description: sonarcloud[bot] commented on PR #4135:
URL: https://github.com/apache/hive/pull/4135#issuecomment-1478373963
Kudos, SonarCloud Quality Gate passed! [](https://sonarcloud.io/dashboard?id=apache_hive&pullRequest=4135)
[](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=4135&resolved=false&types=BUG)
[](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=4135&resolved=false&types=BUG)
[0
Bugs](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=4135&resolved=false&types=BUG)
[](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=4135&resolved=false&types=VULNERABILITY)
[](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=4135&resolved=false&types=VULNERABILITY)
[0
Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=4135&resolved=false&types=VULNERABILITY)
[](https://sonarcloud.io/project/security_hotspots?id=apache_hive&pullRequest=4135&resolved=false&types=SECURITY_HOTSPOT)
[](https://sonarcloud.io/project/security_hotspots?id=apache_hive&pullRequest=4135&resolved=false&types=SECURITY_HOTSPOT)
[0 Security
Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_hive&pullRequest=4135&resolved=false&types=SECURITY_HOTSPOT)
[](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=4135&resolved=false&types=CODE_SMELL)
[](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=4135&resolved=false&types=CODE_SMELL)
[2 Code
Smells](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=4135&resolved=false&types=CODE_SMELL)
[](https://sonarcloud.io/component_measures?id=apache_hive&pullRequest=4135&metric=coverage&view=list)
No Coverage information
[](https://sonarcloud.io/component_measures?id=apache_hive&pullRequest=4135&metric=duplicated_lines_density&view=list)
No Duplication information
Issue Time Tracking
-------------------
Worklog Id: (was: 852082)
Time Spent: 20m (was: 10m)
> AssertionError when inferring return type for unix_timestamp function
> ---------------------------------------------------------------------
>
> Key: HIVE-27157
> URL: https://issues.apache.org/jira/browse/HIVE-27157
> Project: Hive
> Issue Type: Bug
> Components: CBO
> Affects Versions: 4.0.0-alpha-2
> Reporter: Stamatis Zampetakis
> Assignee: Stamatis Zampetakis
> Priority: Major
> Labels: pull-request-available
> Time Spent: 20m
> Remaining Estimate: 0h
>
> Any attempt to derive the return data type for the {{unix_timestamp}}
> function results into the following assertion error.
> {noformat}
> java.lang.AssertionError: typeName.allowsPrecScale(true, false): BIGINT
> at
> org.apache.calcite.sql.type.BasicSqlType.checkPrecScale(BasicSqlType.java:65)
> at org.apache.calcite.sql.type.BasicSqlType.<init>(BasicSqlType.java:81)
> at
> org.apache.calcite.sql.type.SqlTypeFactoryImpl.createSqlType(SqlTypeFactoryImpl.java:67)
> at
> org.apache.calcite.sql.fun.SqlAbstractTimeFunction.inferReturnType(SqlAbstractTimeFunction.java:78)
> at
> org.apache.calcite.rex.RexBuilder.deriveReturnType(RexBuilder.java:278)
> {noformat}
> due to a faulty implementation of type inference for the respective operators:
> *
> [https://github.com/apache/hive/blob/52360151dc43904217e812efde1069d6225e9570/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/reloperators/HiveUnixTimestampSqlOperator.java]
> *
> [https://github.com/apache/hive/blob/52360151dc43904217e812efde1069d6225e9570/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/reloperators/HiveToUnixTimestampSqlOperator.java]
> Although at this stage in master it is not possible to reproduce the problem
> with an actual SQL query the buggy implementation must be fixed since slight
> changes in the code/CBO rules may lead to methods relying on
> {{{}SqlOperator.inferReturnType{}}}.
> Note that in older versions of Hive it is possible to hit the AssertionError
> in various ways. For example in Hive 3.1.3 (and older), the error may come
> from
> [HiveRelDecorrelator|https://github.com/apache/hive/blob/4df4d75bf1e16fe0af75aad0b4179c34c07fc975/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/rules/HiveRelDecorrelator.java#L1933]
> in the presence of sub-queries.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
