Hive
  1. Hive
  2. HIVE-3945

union all datatype do not match may result wrong result

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Minor Minor
    • Resolution: Unresolved
    • Affects Version/s: 0.9.0
    • Fix Version/s: None
    • Component/s: Query Processor
    • Labels:
      None

      Description

      hive (default)> desc src;
      key string
      value string

      select key, value FROM
      ( select 'key' as key, 'value' as value – datatype: string, string
      from src s1 limit 1
      UNION ALL
      select s2.key as key, sum(s2.value) as value – datatype: strung, double
      from src s2 group by s2.key
      ) unionsrc;
      this query exec normally but has wrong result:
      key 2.4081029415476845E-282 – expected is 'value'
      35.0
      100 100.0
      48 0.0

      and sometimes when the string title is too long it may case ArrayIndexOutOfBoundsException:

      Caused by: java.lang.ArrayIndexOutOfBoundsException
      at java.lang.System.arraycopy(Native Method)
      at org.apache.hadoop.io.Text.set(Text.java:205)
      at org.apache.hadoop.hive.serde2.lazybinary.LazyBinaryString.init(LazyBinaryString.java:48)
      at org.apache.hadoop.hive.serde2.lazybinary.LazyBinaryStruct.uncheckedGetField(LazyBinaryStruct.java:216)
      at org.apache.hadoop.hive.serde2.lazybinary.LazyBinaryStruct.getField(LazyBinaryStruct.java:197)
      at org.apache.hadoop.hive.serde2.lazybinary.objectinspector.LazyBinaryStructObjectInspector.getStructFieldData(LazyBinaryStructObjectInspector.java:61)
      at org.apache.hadoop.hive.ql.exec.UnionOperator.processOp(UnionOperator.java:125)
      at org.apache.hadoop.hive.ql.exec.Operator.process(Operator.java:471)
      at org.apache.hadoop.hive.ql.exec.Operator.forward(Operator.java:762)
      at org.apache.hadoop.hive.ql.exec.MapOperator.process(MapOperator.java:531)

        Activity

          People

          • Assignee:
            Unassigned
            Reporter:
            caofangkun
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:

              Development