简体   繁体   English

以直线为例(与 hive cli 相比)?

[英]Using Beeline as an example (vs hive cli)?

I have a sqoop job ran via oozie coordinator.我有一个通过 oozie 协调器运行的 sqoop 工作。 After a major upgrade we can no longer use hive cli and were told to use beeline.重大升级后,我们不能再使用 hive cli 并被告知使用直线。 I'm not sure how to do this?我不知道该怎么做? Here is the current process:这是当前的过程:

I have a hive file: hive_ddl.hql我有一个 hive 文件:hive_ddl.hql

use schema_name;

SET hive.exec.dynamic.partition=true;
SET hive.exec.dynamic.partition.mode=nonstrict;
SET hive.exec.max.dynamic.partitions=100000;
SET hive.exec.max.dynamic.partitions.pernode=100000;
SET mapreduce.map.memory.mb=16384;
SET mapreduce.map.java.opts=-Xmx16G;
SET hive.exec.compress.output=true;
SET mapreduce.output.compression.codec=org.apache.hadoop.io.compress.SnappyCodec;

drop table if exists 'table_name_stg' purge;

create external table if not exists 'table_name_stg'
(
col1 string,
col2 string,
...
)
row format delimited
fields terminated by '\001'
stored as textfile
location 'my/location/table_name_stg';

drop table if exists 'table_name' purge;

create table if not exists 'table_name'
stored as parquet
tblproperties('parquet.compress'='snappy') as 
select * from schema.tablename_stg

drop table if exists 'table_name_stg' purge;

This is pretty straight forward, make a stage table, then use that to make the final table stuff...这很简单,制作一个舞台表,然后用它来制作决赛桌的东西......

it's then called in a.sh file as such:然后在 a.sh 文件中调用它:

hive cli -f $HOME/my/path/hive_ddl.hql

I'm new to most of this and not sure what beeline is, and couldn't find any examples of how to use it to accomplish the same thing my hivecli is.我对其中的大部分内容都很陌生,不确定直线是什么,也找不到任何示例来说明如何使用它来完成我的 hivecli 的相同事情。 I'm hoping it's as simple as calling the hive_ddl.hql file differently, versus having to rewrite everything.我希望它就像以不同方式调用 hive_ddl.hql 文件一样简单,而不必重写所有内容。

Any help is greatly appreciated.任何帮助是极大的赞赏。

Beeline is a command line shell supported in hive. Beeline 是 hive 中支持的命令行 shell。 In your case you can replace hive cli with a beeline command in the same.sh file.在您的情况下,您可以在 same.sh 文件中用 beeline 命令替换 hive cli。 Would look roughly like the one given below.看起来大致像下面给出的那个。

beeline -u hiveJDBCUrl and -f test.hql直线 -u hiveJDBCUrl 和 -f test.hql

You can explore more about the beeline command options by going to the below link您可以通过以下链接了解有关直线命令选项的更多信息

https://cwiki.apache.org/confluence/display/Hive/HiveServer2+Clients#HiveServer2Clients-Beeline%E2%80%93CommandLineShell https://cwiki.apache.org/confluence/display/Hive/HiveServer2+Clients#HiveServer2Clients-Beeline%E2%80%93CommandLineShell

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM