码迷,mamicode.com
首页 > 其他好文 > 详细

Hive beeline update

时间:2015-07-24 08:03:51      阅读:189      评论:0      收藏:0      [点我收藏+]

标签:

Hive cli vs beeline

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

The Hive CLI connects directly to the Hive Driver and requires that Hive be 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 that also uses the Hive JDBC driver but instead executes queries through HiveServer2, which allows multiple concurrent client connections and supports authentication.

 

1.load data local inpath is not support in beeline.

Solution:  a. we can use ‘put‘  and ‘load data inpath‘ to replace this command.

                   b. create these stage table as external table, then we just add new partitions and then just put file, not need load.

beeline -n username -u "jdbc:hive2://hiveserver:10000/dbname;principal=hive/hiveserve@domain"

   

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 FIELDS 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 is not 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‘ >test.csv

Show data test.csv

Cat -a test.csv

Cat -a test.csv | tr $‘\001‘ ‘\t‘

Hive beeline update

标签:

原文地址:http://www.cnblogs.com/huaxiaoyao/p/4672316.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!