Hive Beeline Use __hive

Source: Internet
Author: User

HiveServer2 provides a new command-line tool, Beeline, which is a JDBC client based on the Sqlline CLI. On the sqlline of knowledge, you can refer to this site: http://sqlline.sourceforge.net/#manual

There are two types of beeline working modes, namely, local embedding mode and remote mode. In embedded mode, it returns an embedded hive (similar to the Hive CLI). Remote mode, however, communicates with a separate HiveServer2 process through the thrift Protocol.

Here's a simple example of how to use the login beeline:

% bin/beeline
Hive version 0.11.0-snapshot by Apache
beeline>!connect jdbc:hive2://localhost:10000/ Default 
!connect jdbc:hive2://localhost:10000/default 
connecting to Jdbc:hive2://localhost:10000/default
Connected to:hive (version 0.10.0)
Driver:hive (version 0.10.0-snapshot)
Transaction isolation:transaction_repeatable_read
0:jdbc:hive2:// Localhost:10000> show tables;
Show tables;
+-------------------+
|     Tab_name      |
+-------------------+
| primitives | | | | src1 | |
src_json          |
| Src_sequencefile | | src_thrift | | | srcbucket | |
srcbucket2        | |
srcpart           |
+-------------------+
9 rows selected (1.079 seconds)

Our project in the process of use, because the integration of Hamza rights control, the use of the time required to pass in the username and password, (commonly used in the form of a single query-e, you can write the command to a file-f), remote connection to the HiveServer2:

Beeline-u "Jdbc:hive2://hadoop1:10000/hamza_group_1"--hivevar hamza.usr= "Hamza_group"--hivevar hamza.passwd= " Hmylxj6uddqsy1wu "--color=true;

Exit Beeline command Line is!quit, many commands are preceded by an exclamation point, but for the ddl,dml after login, you can run the SQL statement directly, after the statement with a semicolon, and then enter the execution.


The Beeline CLI supports the following command-line arguments: Option Description--autocommit=[true/false] enable/disable automatic commit.
The Default is false. Usage:beeline--autocommit=true--autosave=[true/false] Automatically save preferences (true) or do not AutoSave (false) .
The Default is false. Usage:beeline--autosave=true--color=[true/false] control whether color are used for display.
The Default is false. Usage:beeline--color=true (not supported for Separated-value Output formats. HIVE-9770)--delimiterfordsv= DELIMITER the DELIMITER for delimiter-separated values output format.
Default is ' | ' character. version:0.14.0 (HIVE-7390)--fastconnect=[true/false] When connecting, skip building a list of all tables and columns fo R Tab-completion of HIVEQL statements (true) or build the list (false).
The Default is true. Usage:beeline--fastconnect=false--force=[true/false] Continue running script even after errors (true) or does not contin UE (FALSE).
The Default is false. Usage:beeline--force=true--headeRinterval=rows the interval for redisplaying column headers with number of ROWS, when outputformat is table.
Default is 100. Usage:beeline--headerinterval=50 (not supported for Separated-value Output formats.
HIVE-9770)--help Display a usage message. Usage:beeline--help--hiveconf Property=value use value for the given. 
Properties that are listed in Hive.conf.restricted.list cannot is reset with hiveconf (for the list of restricted and Whitelist). Usage:beeline--hiveconf prop1=value1 version:0.13.0 (HIVE-6173)--hivevar name=value, HIVE variable name and value. This is a hive-specific setting in which variables can being set at the sessions level and referenced in Hive commands or que
Ries.
Usage:beeline--hivevar var1=value1--incremental=[true/false] Print output incrementally. 
--isolation=level Set The transaction isolation level to transaction_read_committed or transaction_serializable. The "Field Detail" section in the Java Connection documentatioN. usage:beeline--isolation=transaction_serializable--maxcolumnwidth=maxcolwidth The maximum column width, in charact ERs, when outputformat is table.
Default is 15. Usage:beeline--maxcolumnwidth=25--maxwidth=maxwidth The maximum width to display before truncating data, in characters 
, when OutputFormat is table.
Default is to query the terminal for current width, then fall back to 80. Usage:beeline--maxwidth=150--nullemptystring=[true/false] Use historic behavior of printing null as empty string (true ) or use current behavior of printing null as null (FALSE).
The Default is false. Usage:beeline--nullemptystring=false version:0.13.0 (HIVE-4485)--numberformat=[pattern] Format numbers using a Decima
Lformat pattern. Usage:beeline--numberformat= "#,###,# #0"--outputformat=[table/vertical/csv/tsv/dsv/csv2/tsv2] Format mode for Result display. The Default is table.
Separated-value Output Formats below for description of recommended SV options. Usage:beeline--outputformat=TSV Version:dsv/csv2/tsv2 added in 0.14.0 (HIVE-8615)--showheader=[true/false] Show column names in query results (true ) or not (false).
The Default is true. Usage:beeline--showheader=false--shownestederrs=[true/false] Display nested errors.
The Default is false. Usage:beeline--shownestederrs=true--showwarnings=[true/false] Display warnings that are reported on the connection aft 
Er issuing any HIVEQL commands.
The Default is false. Usage:beeline--showwarnings=true--silent=[true/false] Reduce The amount of informational messages displayed (TRUE) or Not (false). It also stops displaying the "Log messages for" Query from HiveServer2 (Hive 0.14 and later).
The Default is false. Usage:beeline--silent=true--truncatetable=[true/false] If true, truncates table column in the console when it exceeds
Console length. version:0.14.0 (HIVE-6928)--verbose=[true/false] Show verbose error messages and debug information (true) or does not sho 
W (false).
The Default is false. Usage:beeline--verbose=true-d <driver class> The driver class to use. usage:beeline-d driver_class-e <query> Query that should is executed. Double or single quotes enclose the query string.
This option can is specified multiple times. Usage:beeline-e "Query_string" Icon only a single command PER-E option is supported. You can ' t provide multiple semicolon separated commands.
Use THE-E option multiple The times if you are want to achieve this. Bug fix (Null pointer exception): 0.13.0 (HIVE-5765) bug to is fixed (running-e in background): Workaround Available (HIV
E-6758) Bug fix (--headerinterval not honored): 0.14.0 (HIVE-7647)-F <file> Script file that should is executed. Usage:beeline-f filepath version:0.12.0 (HIVE-4268) note:if The script contains tabs, query compilation fails in Versi On 0.12.0.
This bug is the fixed in version 0.13.0 (HIVE-6359). Bug to is fixed (running-f in background): Workaround available (HIVE-6758)-N <username> the username to connect a S. usage:beeline-N valid_user-p <password> the password to connect as.
Usage:beeline-p valid_password-u <database url> the JDBC URL to connect to.  Usage:beeline-u Db_url





Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.