Uploaded image for project: 'Hive'
  1. Hive
  2. HIVE-27157

AssertionError when inferring return type for unix_timestamp function

    XMLWordPrintableJSON

Details

    Description

      Any attempt to derive the return data type for the unix_timestamp function results into the following assertion error.

      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)
      

      due to a faulty implementation of type inference for the respective operators:

      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 in the presence of sub-queries.

      Attachments

        Issue Links

          Activity

            People

              zabetak Stamatis Zampetakis
              zabetak Stamatis Zampetakis
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 1.5h
                  1.5h