Review Board 1.7.22


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

Review Request #10115 - Created March 25, 2013 and updated

fangkun cao
hive-trunk
HIVE-3682
Reviewers
hive
hive
Type: New Feature
Priority: Minor  
Component/s: ql
Problem Definition?when output hive table to file,users should could have a separator of their own choice
Design:
Add a new command "insert overwrite [local] directory '...' [ROW FORMAT row_format] "
Examples :

insert overwrite local directory '${system:test.tmp.dir}/hive_test/multiins_local/src'
row format delimited 
FIELDS TERMINATED BY ':' 
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 "../data/files/array_table.txt" overwrite into table array_table;

insert overwrite local directory '${system:test.tmp.dir}/hive_test/multiins_local/array_table'
ROW FORMAT DELIMITED
FIELDS TERMINATED BY ':'
COLLECTION ITEMS TERMINATED BY '#'
select * from array_table;

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;

load data local inpath "../data/files/map_table.txt" overwrite into table map_table;

insert overwrite local directory '${system:test.tmp.dir}/hive_test/multiins_local/map_table'
ROW FORMAT DELIMITED
FIELDS TERMINATED BY ':'
COLLECTION ITEMS TERMINATED BY '#'
MAP KEYS TERMINATED BY '='
select * from array_table;

Impact Analysis:
Test ideas?

 
http://svn.apache.org/repos/asf/hive/trunk/data/files/array_table.txt
New File

    
   
1
a1,a2,a3	b1,b2,b3,b4

    
   
2
a21,a22,a23	b21,b22,b23,b24
http://svn.apache.org/repos/asf/hive/trunk/data/files/map_table.txt
New File
 
http://svn.apache.org/repos/asf/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/HiveParser.g
Revision 1460536 New Change
 
http://svn.apache.org/repos/asf/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/QB.java
Revision 1460536 New Change
 
http://svn.apache.org/repos/asf/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java
Revision 1460536 New Change
 
http://svn.apache.org/repos/asf/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/plan/LoadFileDesc.java
Revision 1460536 New Change
 
http://svn.apache.org/repos/asf/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/plan/PlanUtils.java
Revision 1460536 New Change
 
http://svn.apache.org/repos/asf/hive/trunk/ql/src/test/queries/clientpositive/insert_overwrite_local_directory_1.q
New File
 
http://svn.apache.org/repos/asf/hive/trunk/ql/src/test/results/clientpositive/insert_overwrite_local_directory_1.q.out
New File
 
  1. http://svn.apache.org/repos/asf/hive/trunk/data/files/array_table.txt: Loading...
  2. http://svn.apache.org/repos/asf/hive/trunk/data/files/map_table.txt: Loading...
  3. http://svn.apache.org/repos/asf/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/HiveParser.g: Loading...
  4. http://svn.apache.org/repos/asf/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/QB.java: Loading...
  5. http://svn.apache.org/repos/asf/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java: Loading...
  6. http://svn.apache.org/repos/asf/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/plan/LoadFileDesc.java: Loading...
  7. http://svn.apache.org/repos/asf/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/plan/PlanUtils.java: Loading...
  8. http://svn.apache.org/repos/asf/hive/trunk/ql/src/test/queries/clientpositive/insert_overwrite_local_directory_1.q: Loading...
  9. http://svn.apache.org/repos/asf/hive/trunk/ql/src/test/results/clientpositive/insert_overwrite_local_directory_1.q.out: Loading...