Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Edited formatting

...

Option

Description

-u <database URL>

The JDBC URL to connect to.

Usage: beeline -u db_URL 

-r

Reconnect to last used url URL (If if a user has previously \used !connect-ed to a url URL and \used !save-ed to a beeline.properties file)

Usage: beeline -r

Version: 2.1.0 (HIVE-13670)

-n <username>

The username to connect as.

Usage: beeline -n valid_user

-p <password>

The password to connect as.

Usage: beeline -p valid_password

-d <driver class>

The driver class to use.

Usage: beeline -d driver_class

-e <query>

Query that should be executed. Double or single quotes enclose the query string. This option can be specified multiple times.

Usage: beeline -e "query_string"

Support to run multiple SQL statements separated by semicolons in a single query_string: 1.2.0 (HIVE-9877)
Bug fix (null pointer exception): 0.13.0 (HIVE-5765)
Bug fix (--headerInterval not honored): 0.14.0 (HIVE-7647)
Bug fix (running -e in background): 1.3.0 and 2.0.0 (HIVE-6758); workaround available for earlier versions 

-f <file>

Script file that should be executed.

Usage: beeline -f filepath

Version: 0.12.0 (HIVE-4268)
Note: If the script contains tabs, query compilation fails in version 0.12.0. This bug is fixed in version 0.13.0 (HIVE-6359).
Bug fix (running -f in background): 1.3.0 and 2.0.0 (HIVE-6758); workaround available for earlier versions 

-w (or) --password-file <password file>

The password file to read password from.

Version: 1.2.0 (HIVE-7175)

--hiveconf property=value

Use value for the given configuration property. Properties that are listed in hive.conf.restricted.list cannot be reset with hiveconf (see Restricted List 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 be set at the session level and referenced in Hive commands or queries.

Usage: beeline --hivevar var1=value1

--color=[true/false]

Control whether color is used for display. Default is false.

Usage: beeline --color=true

(Not supported for Separated-Value Output formats. See HIVE-9770)

--showHeader=[true/false]

Show column names in query results (true) or not (false). Default is true.

Usage: beeline --showHeader=false

--headerInterval=ROWS

The interval for redisplaying column headers, in number of rows, when outputformat is table. Default is 100.

Usage: beeline --headerInterval=50

(Not supported for Separated-Value Output formats. See HIVE-9770)

--fastConnect=[true/false]

When connecting, skip building a list of all tables and columns for tab-completion of HiveQL statements (true) or build the list (false). Default is true.

Usage: beeline --fastConnect=false

--autoCommit=[true/false]

Enable/disable automatic transaction commit. Default is false.

Usage: beeline --autoCommit=true

--verbose=[true/false]

Show verbose error messages and debug information (true) or do not show (false). Default is false.

Usage: beeline --verbose=true

--showWarnings=[true/false]

Display warnings that are reported on the connection after issuing any HiveQL commands. Default is false.

Usage: beeline --showWarnings=true

--showNestedErrs=[true/false]

Display nested errors. Default is false.

Usage: beeline --showNestedErrs=true

--numberFormat=[pattern]

Format numbers using a DecimalFormat pattern.

Usage: beeline --numberFormat="#,###,##0.00"

--force=[true/false]

Continue running script even after errors (true) or do not continue (false). Default is false.

Usage: beeline--force=true

--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

--maxColumnWidth=MAXCOLWIDTH

The maximum column width, in characters, when outputformat is table. Default is 15.

Usage: beeline --maxColumnWidth=25

--silent=[true/false]

Reduce the amount of informational messages displayed (true) or not (false). It also stops displaying the log messages for the query from HiveServer2 (Hive 0.14 and later) and the HiveQL commands (Hive 1.2.0 and later). Default is false.

Usage: beeline --silent=true

--autosave=[true/false]

Automatically save preferences (true) or do not autosave (false). Default is false.

Usage: beeline --autosave=true

--outputformat=[table/vertical/csv/tsv/dsv/csv2/tsv2]

Format mode for result display. Default is table. See 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)

--truncateTable=[true/false]

If true, truncates table column in the console when it exceeds console length.

Version: 0.14.0 (HIVE-6928)

--delimiterForDSV= DELIMITER

The delimiter for delimiter-separated values output format. Default is '|' character.

Version: 0.14.0 (HIVE-7390)

--isolation=LEVEL

Set the transaction isolation level to TRANSACTION_READ_COMMITTED
or TRANSACTION_SERIALIZABLE.
See the "Field Detail" section in the Java Connection documentation.

Usage: beeline --isolation=TRANSACTION_SERIALIZABLE

--nullemptystring=[true/false]

Use historic behavior of printing null as empty string (true) or use current behavior of printing null as NULL (false). Default is false.

Usage: beeline --nullemptystring=false

Version: 0.13.0 (HIVE-4485)

--incremental=[true/false]

Defaults to false. When set to false, the entire result set is fetched and buffered before being displayed, yielding optimal display column sizing. When set to true, result rows are displayed immediately as they are fetched, yielding lower latency and memory usage at the price of extra display column padding. Setting --incremental=true is recommended if you encounter an OutOfMemory on the client side (due to the fetched result set size being large).

--help

Display a usage message.

Usage: beeline --help

...

For versions earlier than 0.14, see the version note above.

Connection URL When

...

ZooKeeper Service Discovery Is Enabled

ZooKeeper-Zookeeper based service discovery introduced in Hive 0.14.0 via  JiraserverASF JIRAcolumnskey,summary,type,created,updated,due,assignee,reporter,priority,status,resolutionserverId5aa69414-a9e9-3523-82ec-879b028fb15bkey(HIVE-7935 enables ) enables high availability and rolling upgrade for HiveServer2. A JDBC url URL that specifies zookeeper quorum <zookeeper quorum> needs to be used to make use of these features.

With further changes in Hive 2.0.0 , and 1.3.0 (unreleased JiraserverASF JIRAcolumnskey,summary,type,created,updated,due,assignee,reporter,priority,status,resolutionserverId5aa69414-a9e9-3523-82ec-879b028fb15bkey, HIVE-11581  ), none of the additional configuration parameters such as authentication mode, transport mode, or ssl SSL parameters need to be specified, as they are retrieved from the zookeeper ZooKeeper entries along with the hostname.

The JDBC connection URL:  jdbc jdbc:hive2://<zookeeper quorum>/;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2 hiveserver2 .

The <zookeeper quorum> is the same as the value of hive.zookeeper.quorum configuration parameter in hive-site.xml/hivserver2-site.xml used by hiveserver2HiveServer2.

Named

...

Connection URLs

As of Hive 2.1 via JiraserverASF JIRAcolumnskey,summary,type,created,updated,due,assignee,reporter,priority,status,resolutionserverId5aa69414-a9e9-3523-82ec-879b028fb15bkey.0 (HIVE-13670), Beeline now also supports named url URL connect strings via usage of environment variables. If you try to do a "!connect" to a name that does not look like a URL, then beeline Beeline will attempt to see if there is an env environment variable called BEELINE_URL_<name>. For instance, if you specify "!connect blue", it will look for BEELINE_URL_BLUE, and use that to connect. This should make it easier for sysadmins system administrators to specify env environment variables for users, and users need not type in the full URL each time to connect.

Reconnecting

Traditionally, "!reconnect" has worked to refresh a connection that has already been established. It is not able to do a fresh connect after "!close" has been run. As of Hive 2.1 via  JiraserverASF JIRAcolumnskey,summary,type,created,updated,due,assignee,reporter,priority,status,resolutionserverId5aa69414-a9e9-3523-82ec-879b028fb15bkey.0 (HIVE-13670), Beeline remembers the last successful URL successfully connected - to url in a session, and is able to reconnect even after a "!close" has been run. In addition, if a user does a "!save", then this is saved in the beeline.properties file, which then allows "!reconnect" to connect to this saved last-connected-to url URL across multiple beeline sessions. In addition, this then opens up a possible This also allows the use of "beeline -r" from the commandline command line to do a reconnect on startup.

...

For versions earlier than 0.14, see the version note above.