为什么beeline cli参数在连接到beeline cli之后不起任何作用?

vngu2lb8  于 2021-06-27  发布在  Hive
关注(0)|答案(1)|浏览(496)

我有一个自动执行直线命令的shell脚本代码。代码能够连接到jdbc,但是它就在那里,它似乎没有执行shell脚本中的进一步代码,也就是说,它不截断表,不加载数据,不插入。下面是全部代码:


# ! /bin/bash

timestamp=$(date +%Y-%m-%d-%H:%M:%S:%N)
unix_time=$(date +%Y-%m-%d-%H:%M:%S)

export 

BEELINE_PREFIX='"jdbc:hive2://server:port,server:port,server:port/;serviceDiscoveryMode=zookeeper;zookeeperNamespace=hiveser

ver2;principal=hive/server@hello.COM"'

beeline -u $BEELINE_PREFIX -e use next;

echo "truncating the staging table tbl1..."
beeline -u $BEELINE_PREFIX -e  "TRUNCATE TABLE next.tbl1;"

echo "Loading the data in stating table tbl1"
beeline -u $BEELINE_PREFIX -e "LOAD DATA LOCAL INPATH 'path_to/tbl1.txt' INTO TABLE next.tbl1;"

echo "Appending the data into history table tbl1.."
beeline -u $BEELINE_PREFIX -e "insert into table next.hist_tbl1 select *,'$unix_time' from next.tbl1;"

When I execute ./tbl1.sh

我可以看到以下输出:

Connecting to 

jdbc:hive2://jdbc:hive2://server:port,server:port,server:port/;serviceDiscoveryMode=zookeeper;zookeeperNamespace=hiveserver2

;principal=hive/server@hello.COM
Connected to: Apache Hive
Driver: Hive JDBC
Transaction isolation: TRANSACTION_REPEATABLE_READ
Beeline version 1.2.1000.2.6.5.0-292 by Apache Hive

代码似乎只执行veru第一个“beeline-u”,即只执行jdbc连接。我注意到,当我使用ctrl+c时,它会前进,并抛出下面的错误

Error: Error while processing statement: FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.mr.MapRedTask. File file:/usr/ibmpacks/current/bigsql/hive/lib/hive-hbase-handler.jar does not exist (state=08S01,code=1)

你知道怎么回事吗?

enxuqcxy

enxuqcxy1#

这个问题已经解决了。我用的是多余的线 beeline -u $BEELINE_PREFIX 在使用配置单元数据库之前的原始代码中 "use database". 我把它注解掉了。脚本运行正常。

相关问题