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

Table join query with some constant field in select fails

    XMLWordPrintableJSON

Details

    Description

      The following query fails:

      create table tb1 (year string, month string);
      create table tb2(month string);
      select unix_timestamp(a.year) 
      from (select * from tb1 where year='2001') a join tb2 b on (a.month=b.month);
      

      with the exception

      Caused by: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
              at java.util.ArrayList.rangeCheck(ArrayList.java:635)
              at java.util.ArrayList.get(ArrayList.java:411)
              at org.apache.hadoop.hive.serde2.objectinspector.StandardStructObjectInspector.init(StandardStructObjectInspector.java:118)
              at org.apache.hadoop.hive.serde2.objectinspector.StandardStructObjectInspector.<init>(StandardStructObjectInspector.java:109)
              at org.apache.hadoop.hive.serde2.objectinspector.ObjectInspectorFactory.getStandardStructObjectInspector(ObjectInspectorFactory.java:290)
              at org.apache.hadoop.hive.serde2.objectinspector.ObjectInspectorFactory.getStandardStructObjectInspector(ObjectInspectorFactory.java:275)
              at org.apache.hadoop.hive.ql.exec.CommonJoinOperator.getJoinOutputObjectInspector(CommonJoinOperator.java:175)
      

      The issue seems to be: during the query compilation, the field in the select should be replaced with the constant when some UDFs are used.

      Attachments

        1. HIVE-10802.patch
          15 kB
          Aihua Xu

        Issue Links

          Activity

            People

              aihuaxu Aihua Xu
              aihuaxu Aihua Xu
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: