--outputformat=[table/vertical/csv/tsv/dsv]
Format mode for result display. Default is table.
Usage: beeline --outputformat=tsv
--delimiterForDSV=DELIMITER
specify the delimiter for delimiter-separated values output format (default: |)
Usage: beeline --outputformat=dsv --delimiterForDSV=,
beeline dsv and delimiterForDSV examples are as followings:
% bin/beeline
Hive version 0.11.0-SNAPSHOT by Apache
beeline> !connect jdbc:
hive2://localhost:10000 scott tiger org.apache.hive.jdbc.HiveDriver
!connect jdbc:
hive2://localhost:10000 scott tiger org.apache.hive.jdbc.HiveDriver
Connecting to jdbc:
hive2://localhost:10000
Connected to: Hive (version 0.14.0-SNAPSHOT)
Driver: Hive (version 0.14.0-SNAPSHOT)
Transaction isolation: TRANSACTION_REPEATABLE_READ
HiveServer2 Clients – dsv Example
0: jdbc:
hive2://localhost:10000> create table csv_table(id int, name string, info string) row format delimited fields terminated by '\t';
No rows affected (0.121 seconds)
0: jdbc:
hive2://localhost:10000> load data local inpath '/root/names' overwrite into table csv_table;
No rows affected (0.245 seconds)
0: jdbc:
hive2://localhost:10000> select * from csv_table;
+---------------+-----------------+-----------------+--+
| csv_table.id | csv_table.name | csv_table.info |
+---------------+-----------------+-----------------+--+
| 19630001 | "john" | lennon |
| 19630002 | peter,paul | mccartney |
| 19630003 | george | harrison |
| 19630004 | ringo | starr |
+---------------+-----------------+-----------------+--+
4 rows selected (0.09 seconds)
0: jdbc:
hive2://localhost:10000> !outformat csv
Unknown command: outformat csv
0: jdbc:
hive2://localhost:10000> !outputformat csv
0: jdbc:
hive2://localhost:10000> select * from csv_table;
csv_table.id,csv_table.name,csv_table.info
19630001,"""john""",lennon
19630002,"peter,paul",mccartney
19630003,george,harrison
19630004,ringo,starr
4 rows selected (0.105 seconds)
0: jdbc:
hive2://localhost:10000> !outputformat dsv
0: jdbc:
hive2://localhost:10000> select * from csv_table;
csv_table.id|csv_table.name|csv_table.info
19630001|"""john"""|lennon
19630002|peter,paul|mccartney
19630003|george|harrison
19630004|ringo|starr
4 rows selected (0.123 seconds)
0: jdbc:
hive2://localhost:10000> !set delimiterForDSV ',';
0: jdbc:
hive2://localhost:10000> select * from csv_table;
csv_table.id'csv_table.name'csv_table.info
19630001'"""john"""'lennon
19630002'peter,paul'mccartney
19630003'george'harrison
19630004'ringo'starr
4 rows selected (0.11 seconds)