问题描述
我有一个通过 oozie 协调器运行的 sqoop 作业。重大升级后,我们无法再使用 hive cli 并被告知使用直线。我不知道该怎么做?这是当前的流程:
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;
这很简单,制作一张舞台桌,然后用它来制作决赛桌...
hive cli -f $HOME/my/path/hive_ddl.hql
我对其中的大部分内容都不熟悉,不确定直线是什么,并且找不到任何示例说明如何使用它来完成与我的 hivecli 相同的事情。我希望它像以不同方式调用 hive_ddl.hql 文件一样简单,而不必重写所有内容。
非常感谢任何帮助。
解决方法
Beeline 是 hive 支持的命令行 shell。在您的情况下,您可以在同一个 .sh 文件中用 beeline 命令替换 hive cli。大致类似于下面给出的那个。
beeline -u hiveJDBCUrl 和 -f test.hql
您可以通过以下链接探索有关 beeline 命令选项的更多信息