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

when output hive table to file,users should could have a separator of their own choice

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 0.8.1
    • 0.11.0
    • CLI
    • None
    • Linux 3.0.0-14-generic #23-Ubuntu SMP Mon Nov 21 20:34:47 UTC 2011 i686 i686 i386 GNU/Linux
      java version "1.6.0_25"
      hadoop-0.20.2-cdh3u0
      hive-0.8.1

    Description

      By default,when output hive table to file ,columns of the Hive table are separated by ^A character (that is \001).
      But indeed users should have the right to set a seperator of their own choice.

      Usage Example:
      create table for_test (key string, value string);
      load data local inpath './in1.txt' into table for_test
      select * from for_test;
      UT-01:default separator is \001 line separator is \n
      insert overwrite local directory './test-01'
      select * from src ;

      create table array_table (a array<string>, b array<string>)
      ROW FORMAT DELIMITED
      FIELDS TERMINATED BY '\t'
      COLLECTION ITEMS TERMINATED BY ',';

      load data local inpath "../hive/examples/files/arraytest.txt" overwrite into table table2;

      CREATE TABLE map_table (foo STRING , bar MAP<STRING, STRING>)
      ROW FORMAT DELIMITED
      FIELDS TERMINATED BY '\t'
      COLLECTION ITEMS TERMINATED BY ','
      MAP KEYS TERMINATED BY ':'
      STORED AS TEXTFILE;

      UT-02:defined field separator as ':'
      insert overwrite local directory './test-02'
      row format delimited
      FIELDS TERMINATED BY ':'
      select * from src ;

      UT-03: line separator DO NOT ALLOWED to define as other separator
      insert overwrite local directory './test-03'
      row format delimited
      FIELDS TERMINATED BY ':'
      select * from src ;

      UT-04: define map separators
      insert overwrite local directory './test-04'
      row format delimited
      FIELDS TERMINATED BY '\t'
      COLLECTION ITEMS TERMINATED BY ','
      MAP KEYS TERMINATED BY ':'
      select * from src;

      Attachments

        1. HIVE-3682.D10275.4.patch.for.0.11
          40 kB
          Sushanth Sowmyan
        2. HIVE-3682.D10275.4.patch
          40 kB
          Phabricator
        3. HIVE-3682.D10275.3.patch
          40 kB
          Phabricator
        4. HIVE-3682.D10275.2.patch
          40 kB
          Phabricator
        5. HIVE-3682.D10275.1.patch
          42 kB
          Phabricator
        6. HIVE-3682.with.serde.patch
          11 kB
          Sushanth Sowmyan
        7. HIVE-3682-1.patch
          7 kB
          caofangkun

        Issue Links

          Activity

            People

              sushanth Sushanth Sowmyan
              caofangkun caofangkun
              Votes:
              0 Vote for this issue
              Watchers:
              17 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: