- Subscribe to RSS Feed
- Mark Question as New
- Mark Question as Read
- Float this Question for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
Beeline select query
- Labels:
-
Apache Hive
Created ‎02-25-2016 09:52 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am trying to switch to Beeline from hive, but I have one issue.
Hive :
Query : select * from table;
Output : The output is in readable format i.e we can scroll down to see complete data on my screen(terminal).
Beeline : Query : select * from table;
Output : The output is not in readable format i.e we cannot scroll down to see complete data. All columns are mixed up.
Work Around : I tried setting --maxWidth=100 it worked for one table with 10 columns. But still the output is not properly readable. I have to change the value of maxWidth for different tables as different tables have different number of columns.
So, is there any way to set some default value so that the data becomes understandable using beeline?
Created ‎02-25-2016 09:55 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hey @Pooja Chawda
Hope are doing well! 🙂
Can you try below thing?
$beeline -u jdbc:hive2://<server-ip>:10000/databaseName -n <your-id> -p <your-password> --outputformat=csv -f input_query.sql > results.out
Or you can use below parameters:
--outputformat=csv --headerInterval=400 --showHeader=false --maxColumnWidth=20
Hope this helps!
Created ‎02-25-2016 09:55 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hey @Pooja Chawda
Hope are doing well! 🙂
Can you try below thing?
$beeline -u jdbc:hive2://<server-ip>:10000/databaseName -n <your-id> -p <your-password> --outputformat=csv -f input_query.sql > results.out
Or you can use below parameters:
--outputformat=csv --headerInterval=400 --showHeader=false --maxColumnWidth=20
Hope this helps!
Created ‎02-25-2016 10:16 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@Kuldeep Kulkarni thanks it worked for me.
Created ‎02-25-2016 10:16 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you @Pooja Chawda
Created ‎03-09-2016 03:02 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Due to HIVE_8615, it is advised to start using csv2/tsv2 for Beeline output formatting as csv/tsv are deprecated as of Hive 0.14.
More details can be on the Apache Hiveserver2 Client wiki:
"Separated-Value Output Formats Starting with Hive 0.14, there are improved SV output formats available, namely DSV, CSV2 and TSV2. These conform better to standard CSV convention, which adds quotes around a cell value only if it contains special characters (such as the delimiter character or a quote character) or spans multiple lines. These three formats differ only with the delimiter between cells, which is comma for CSV2, tab for TSV2, and configurable for DSV (delimiterForDSV property).
CSV and TSV output formats are maintained for backward compatibility, but beware as they add additional single-quote characters around all cell values contrary to this convention."
