以直线为例vs hive cli?

问题描述

我有一个通过 oozie 协调器运行的 sqoop 作业。重大升级后,我们无法再使用 hive cli 并被告知使用直线。我不知道该怎么做?这是当前的流程:

我有一个 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;

这很简单,制作一张舞台桌,然后用它来制作决赛桌...

然后在 .sh 文件调用它:

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 命令选项的更多信息

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

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...