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

errors when selecting a struct field within an array from ORC based tables

Log workAgile BoardRank to TopRank to BottomBulk Copy AttachmentsBulk Move AttachmentsVotersWatch issueWatchersCreate sub-taskConvert to sub-taskMoveLinkCloneLabelsUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 0.13.0, 0.14.0
    • 1.0.0
    • None
    • HDP 2.1 / HDP 2.2 (YARN, but no Tez)

    Description

      When using ORC as storage for a table, we get errors on selecting a struct field within an array. These errors do not appear with default format.

      CREATE  TABLE `foobar_orc`(
        `uid` bigint,
        `elements` array<struct<elementid:bigint,foo:struct<bar:string>>>)
      STORED AS ORC;
      

      When selecting from this empty table, we get a direct NPE within the Hive CLI:

      SELECT
        elements.elementId
      FROM
        foobar_orc;
      -- FAILED: RuntimeException java.lang.NullPointerException
      

      A more real-world query produces a RuntimeException / NullPointerException in the mapper:

      SELECT
        uid,
        element.elementId
      FROM
        foobar_orc
      LATERAL VIEW
        EXPLODE(elements) e AS element;
      
      
      Error: java.lang.RuntimeException: Error in configuring object
      	at org.apache.hadoop.util.ReflectionUtils.setJobConf(ReflectionUtils.java:109)
      [...]
      Caused by: java.lang.NullPointerException
      	at org.apache.hadoop.hive.ql.exec.ExprNodeFieldEvaluator.initialize(ExprNodeFieldEvaluator.java:61)
      [...]
      FAILED: Execution Error, return code 2 from org.apache.hadoop.hive.ql.exec.mr.MapRedTask
      

      Both queries run fine on a non-orc table:

      CREATE  TABLE `foobar`(
        `uid` bigint,
        `elements` array<struct<elementid:bigint,foo:struct<bar:string>>>);  
      
      SELECT
        elements.elementId
      FROM
        foobar;
      -- OK
      -- Time taken: 0.225 seconds
      
      SELECT
        uid,
        element.elementId
      FROM
        foobar
      LATERAL VIEW
        EXPLODE(elements) e AS element;
      -- Total MapReduce CPU Time Spent: 1 seconds 920 msec
      -- OK
      -- Time taken: 25.905 seconds
      

      Attachments

        1. HIVE-8870.3.patch
          1 kB
          Sergio Peña

        Issue Links

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            spena Sergio Peña Assign to me
            akatose Michael Haeusler
            Votes:
            3 Vote for this issue
            Watchers:
            7 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment