hive -e "show tables"提示cannot recognize input near 'show' '<EOF>' '<EOF>' in ddl statement

6 篇文章 0 订阅

一、前言

      项目需要,需要知道hive的支持的最大并发用户数目是否满足需求,因此,写了个小程序测试 ,方式是java调用命令行程序的方式进行。

即:

 Process executor = Runtime.getRuntime().exec(command,env);

但是这样做面临一个问题,就是在命令行输入hive -e "show tables"一切正常,如下所示。

[niy@niy-computer /]$ hive -e "show tables"

Logging initialized using configuration in file:/home/niy/workspace1/hive/trunk/conf/hive-log4j.properties
Hive history file=/tmp/niy/hive_job_log_niy_201305201234_366682237.txt
OK
alter2
niytab
part_nowhitelist_test
part_whitelist_test
poke
poke1
poke3
raw
src_rc_concatenate_test
table1
table3
test_table
test_table_like
xx
Time taken: 6.217 seconds, Fetched: 14 row(s)
而采用java程序调用 命令行的方式 上面的command 的参数就是hive -e "show tables",则运行失败,提示


 

二 解决方案


提示 cannot recognize input near 'show' '<EOF>' '<EOF>' in ddl statement,即告知 show 以后的语句“ tables”没有读取成功,换成"show databases"可以发现错误依旧。

调试发现程序 在运行到

Process executor = Runtime.getRuntime().exec(command,env);

command 的值是hive -e "show tables",即交给hive 时是准确无误的,可以断定解析出错是hive 本身的问题。

由于时间有限,暂给出解决方案,采用hive -f 来避开该问题,至于这问题的正面解决方案以后有时间 再处理,初步感觉可能是hive 的bug。

首先将hive ql语句 写入 文件/home/niy/tmp.ql (.ql后缀)

采用hive -v -f  /home/niy/tmp.ql

搞定。

三 总结


问题的解决有时不是兵来将挡,水来土埋的正面回应,也可以是采用迂回战术。
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 4
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值