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

get_json_object bug when extract list of list with index

Details

    • New Feature
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 0.12.0, 0.13.0
    • 0.14.0
    • UDF
    • all

    Description

      https://github.com/apache/hive/blob/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFJson.java#L250

      this line should be out of the for-loop

      For example
      json = '{"h":[1, [2, 3],

      {"i": 0}

      , [

      {"p": 11}

      ,

      {"p": 12}

      ,

      {"pp": 13}

      ]}'
      get_json_object(json, '$.h[*][0]') should return back the first node(if exists) of every childrenof '$.h'
      which specifically should be
      [2,

      {"p":11}

      ]
      but hive returns only
      2

      because when hive pick the node '2' out, the tmp_jsonList will change to a list only contains one node '2':
      [2]
      then it was assigned to variable jsonList, in the next loop, value of i would be 2 which is greater than the size(always 1) of jsonList, then the loop broke out.

      Attachments

        1. HIVE-7036.1.patch.txt
          4 kB
          Navis Ryu

        Activity

          hiveqa Hive QA added a comment -

          Overall: -1 at least one tests failed

          Here are the results of testing the latest attachment:
          https://issues.apache.org/jira/secure/attachment/12643916/HIVE-7036.1.patch.txt

          ERROR: -1 due to 4 failed/errored test(s), 5503 tests executed
          Failed tests:

          org.apache.hadoop.hive.cli.TestCliDriver.testCliDriver_stats_partscan_1_23
          org.apache.hadoop.hive.cli.TestMiniTezCliDriver.testCliDriver_insert1
          org.apache.hadoop.hive.cli.TestMiniTezCliDriver.testCliDriver_tez_dml
          org.apache.hadoop.hive.cli.TestMinimrCliDriver.testCliDriver_root_dir_external_table
          

          Test results: http://ec2-174-129-184-35.compute-1.amazonaws.com/jenkins/job/PreCommit-HIVE-Build/165/testReport
          Console output: http://ec2-174-129-184-35.compute-1.amazonaws.com/jenkins/job/PreCommit-HIVE-Build/165/console

          Messages:

          Executing org.apache.hive.ptest.execution.PrepPhase
          Executing org.apache.hive.ptest.execution.ExecutionPhase
          Executing org.apache.hive.ptest.execution.ReportingPhase
          Tests exited with: TestsFailedException: 4 tests failed
          

          This message is automatically generated.

          ATTACHMENT ID: 12643916

          hiveqa Hive QA added a comment - Overall : -1 at least one tests failed Here are the results of testing the latest attachment: https://issues.apache.org/jira/secure/attachment/12643916/HIVE-7036.1.patch.txt ERROR: -1 due to 4 failed/errored test(s), 5503 tests executed Failed tests: org.apache.hadoop.hive.cli.TestCliDriver.testCliDriver_stats_partscan_1_23 org.apache.hadoop.hive.cli.TestMiniTezCliDriver.testCliDriver_insert1 org.apache.hadoop.hive.cli.TestMiniTezCliDriver.testCliDriver_tez_dml org.apache.hadoop.hive.cli.TestMinimrCliDriver.testCliDriver_root_dir_external_table Test results: http://ec2-174-129-184-35.compute-1.amazonaws.com/jenkins/job/PreCommit-HIVE-Build/165/testReport Console output: http://ec2-174-129-184-35.compute-1.amazonaws.com/jenkins/job/PreCommit-HIVE-Build/165/console Messages: Executing org.apache.hive.ptest.execution.PrepPhase Executing org.apache.hive.ptest.execution.ExecutionPhase Executing org.apache.hive.ptest.execution.ReportingPhase Tests exited with: TestsFailedException: 4 tests failed This message is automatically generated. ATTACHMENT ID: 12643916

          +1

          ashutoshc Ashutosh Chauhan added a comment - +1

          Committed to trunk. Thanks, Navis!

          ashutoshc Ashutosh Chauhan added a comment - Committed to trunk. Thanks, Navis!
          thejas Thejas Nair added a comment -

          This has been fixed in 0.14 release. Please open new jira if you see any issues.

          thejas Thejas Nair added a comment - This has been fixed in 0.14 release. Please open new jira if you see any issues.

          People

            navis Navis Ryu
            xelz Ming Ma
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: