Hive
  1. Hive
  2. HIVE-5825

Case statement type checking too restrictive for parameterized types

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 0.13.0
    • Component/s: UDF
    • Labels:
      None

      Description

      explain select
      case when (key = '0') then 123.456BD else 0.0BD end
      from src limit 2

      FAILED: SemanticException [Error 10016]: Line 3:44 Argument type mismatch '0.0BD': The expression after ELSE should have the same type as those after THEN: "decimal(6,3)" is expected but "decimal(1,0)" is found

      The return type checking is too strict and won't allow different decimal types to be returned if they are not the exact same type (precision/scale). There are similar issues with char/varchar length, but even in the general case it seems odd that you wouldn't be able to specify 1 and 0.0 in the same case statement.

      I would propose setting returnOIResolver so that it is able to convert the return values to common type.

        Activity

        Jason Dere created issue -
        Jason Dere made changes -
        Field Original Value New Value
        Attachment HIVE-5825.1.patch [ 12614000 ]
        Jason Dere made changes -
        Status Open [ 1 ] Patch Available [ 10002 ]
        Xuefu Zhang made changes -
        Status Patch Available [ 10002 ] Resolved [ 5 ]
        Fix Version/s 0.13.0 [ 12324986 ]
        Resolution Fixed [ 1 ]

          People

          • Assignee:
            Jason Dere
            Reporter:
            Jason Dere
          • Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development