Hive Beeline Update

Source: Internet
Author: User
Tags kinit

Hive CLI vs Beeline

The primary difference between the involves how the clients connect to Hive.

The hive CLI connects directly to the hive Driver and requires the hive is installed on the same machine as the client.

Beeline connects to HiveServer2 and does not require the installation of Hive libraries on the same machine as the client. Beeline is a thin client this also uses the Hive JDBC driver but instead executes queries through HIVESERVER2, W Hich allows multiple concurrent client connections and supports authentication.

1.Load Data local Inpath is not beeline.

solution:a. We can use the ' put ' and ' Load data inpath ' to replace the This command.

B. Create these stage table as external table, then we just add new partitions and then just put fi Le, not need load.

Beeline-n username-u "Jdbc:hive2://hiveserver:10000/dbname;principal=hive/[email protected]"

Run Kinit before run Beeline.

Echo ' Password ' | Kinit

drop table Evan_test2;

CREATE EXTERNAL TABLE Evan_test2 (

UserId BIGINT,

Type INT,

FileName String

)

COMMENT ' User infomation '

Partitioned by (country String)

ROW FORMAT delimited TERMINATED by ', '

STORED as Textfile

Location ' hdfs:////evan_test/';

ALTER TABLE EVAN_TEST2 Add partition (country= ' tet ');

2.

INSERT OVERWRITE LOCAL DIRECTORY ' temp '

Fields TERMINATED by ', '

SELECT * from Evan_test2;

This isn't a support in Beeline.

Solution:we can use Beeline's new command to implement the same function.

Beeline--showheader=false--outputformat=dsv--delimiterfordsv=$ ' \001 '-e ' select * from Evan_test3 ' & Gt;test.csv

Show Data Test.csv

cat-a test.csv

cat-a test.csv | tr $ ' \001 ' \ t '

Hive Beeline Update

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.