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

Selecting from JsonSerDe backed table fails for array type

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 1.1.0
    • None
    • None
    • None

    Description

      Table ddl:
      CREATE EXTERNAL TABLE tmp.la_ocs_edr
      (
      SPEND_STRUCT map<string,array<map<string,string>>>
      )
      ROW FORMAT SERDE 'org.apache.hive.hcatalog.data.JsonSerDe'
      LOCATION '/tmp/vm';
      Json file structure:
      {"SPEND_STRUCT": {"def":[

      {"COSTS":"0","BALANCE_TYPES":"128","BALANCES":"22"}

      ]}}
      {"SPEND_STRUCT": {"def":[

      {"COSTS":"0","BALANCE_TYPES":"478","BALANCES":"25"}

      ]}}
      A select query fails with:
      hive> select * from json_example;
      OK
      Failed with exception java.io.IOException:org.apache.hadoop.hive.serde2.SerDeException: java.io.IOException: Start of Array expected
      Same result from beeline.
      Strangely, inserting into the table as follows works and the JSON file is populated properly:
      hive> insert into json_example select map("def",array(map("COSTS","0","BALANCE_TYPES","128","BALANCES","22"))) from t1;
      then
      hive> !sh hdfs dfs -cat /user/hive/warehouse/test.db/json_example/*;
      {"spend_struct":{"def":[

      {"BALANCE_TYPES":"128","BALANCES":"22","COSTS":"0"}

      ]}}

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              elkhan Elkhan Eminov
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated: