首页 > 其他 > 详细

Hive beeline update

时间:2015-07-24 08:02:00      阅读:418      评论: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
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!