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

select query on json table with map containing numeric values fails

    XMLWordPrintableJSON

Details

    Description

      select query on json table throws this error if table contains map type column:

      Failed with exception java.io.IOException:org.apache.hadoop.hive.serde2.SerDeException: org.codehaus.jackson.JsonParseException: Current token (FIELD_NAME) not numeric, can not use numeric value accessors
       at [Source: java.io.ByteArrayInputStream@295f79b; line: 1, column: 26]
      

      steps to reproduce the issue:

      hive> create table c_complex(a array<string>,b map<string,int>) row format serde 'org.apache.hive.hcatalog.data.JsonSerDe';
      OK
      Time taken: 0.319 seconds
      hive> insert into table c_complex select array('aaa'),map('aaa',1) from studenttab10k limit 2;
      Query ID = hrt_qa_20150826183232_47deb33a-19c0-4d2b-a92f-726659eb9413
      Total jobs = 1
      Launching Job 1 out of 1
      
      
      Status: Running (Executing on YARN cluster with App id application_1440603993714_0010)
      
      --------------------------------------------------------------------------------
              VERTICES      STATUS  TOTAL  COMPLETED  RUNNING  PENDING  FAILED  KILLED
      --------------------------------------------------------------------------------
      Map 1 ..........   SUCCEEDED      1          1        0        0       0       0
      Reducer 2 ......   SUCCEEDED      1          1        0        0       0       0
      --------------------------------------------------------------------------------
      VERTICES: 02/02  [==========================>>] 100%  ELAPSED TIME: 11.75 s    
      --------------------------------------------------------------------------------
      Loading data to table default.c_complex
      Table default.c_complex stats: [numFiles=1, numRows=2, totalSize=56, rawDataSize=0]
      OK
      Time taken: 13.706 seconds
      hive> select * from c_complex;
      OK
      Failed with exception java.io.IOException:org.apache.hadoop.hive.serde2.SerDeException: org.codehaus.jackson.JsonParseException: Current token (FIELD_NAME) not numeric, can not use numeric value accessors
       at [Source: java.io.ByteArrayInputStream@295f79b; line: 1, column: 26]
      Time taken: 0.115 seconds
      hive> select count(*) from c_complex;
      OK
      2
      Time taken: 0.205 seconds, Fetched: 1 row(s)
      

      Attachments

        1. HIVE-12012.1.patch
          9 kB
          Jason Dere

        Issue Links

          Activity

            People

              jdere Jason Dere
              jvaria Jagruti Varia
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: