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

JsonSerDe cannot handle json file with empty lines

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 1.2.1
    • None
    • HCatalog
    • None

    Description

      1. start HiveServer2 in apache-hive-1.2.1
      2 start a beeline connect to hive server2
      ADD JAR ADD JAR /home/apache-hive-1.2.1-bin/hcatalog/share/hcatalog/hive-hcatalog-core-1.2.1.jar ;

      CREATE external TABLE my_table(a string, b bigint)
      ROW FORMAT SERDE 'org.apache.hive.hcatalog.data.JsonSerDe'
      STORED AS TEXTFILE
      location 'file:///home/hive/json';

      3 put a file with more than one new lines at the end of the file

      {"a":"a_1", "b" : 1}

      4 run sql
      select * from my_table ;
      ------------------------

      my_table.a my_table.b

      ------------------------

      a_1 1
      a_1 1
      a_1 1
      a_1 1
      a_1 1

      ------------------------

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              pin_zhang pin_zhang
              Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: