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

case expression should allow different types per ISO-SQL 2011

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 0.8.0
    • None
    • SQL
    • None

    Description

      The ISO-SQL standard specification for CASE allows the specification to include different types in the WHEN and ELSE blocks including this example which mixes smallint and integer types

      select case when vsint.csint is not null then vsint.csint else 1 end from cert.vsint vsint

      The Apache Hive docs do not state how it deviates from the standard or any given restrictions so unsure if this is a bug vs an enhancement. Many SQL applications mix so this seems to be a restrictive implementation if this is by design.

      Argument type mismatch '1': The expression after ELSE should have the same type as those after THEN: "smallint" is expected but "int" is found

      Attachments

        1. Hive-3183.patch.txt
          1 kB
          Xiu Guo
        2. udf_when_type_wrong2.q.out
          0.4 kB
          Xiu Guo
        3. udf_when_type_wrong3.q.out
          0.4 kB
          Xiu Guo

        Activity

          People

            Unassigned Unassigned
            the6campbells N Campbell
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated: