zoukankan      html  css  js  c++  java
  • hive e "show tables"提示cannot recognize input near 'show' '<EOF>' '<EOF>' in ddl statement

    一、前言

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

    即:

    [java] view plaincopy
    1. Process executor = Runtime.getRuntime().exec(command,env);  

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

    [plain] view plaincopy
    1. [niy@niy-computer /]$ hive -e "show tables"  
    2.   
    3. Logging initialized using configuration in file:/home/niy/workspace1/hive/trunk/conf/hive-log4j.properties  
    4. Hive history file=/tmp/niy/hive_job_log_niy_201305201234_366682237.txt  
    5. OK  
    6. alter2  
    7. niytab  
    8. part_nowhitelist_test  
    9. part_whitelist_test  
    10. poke  
    11. poke1  
    12. poke3  
    13. raw  
    14. src_rc_concatenate_test  
    15. table1  
    16. table3  
    17. test_table  
    18. test_table_like  
    19. xx  
    20. 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"可以发现错误依旧。

    调试发现程序 在运行到

    [java] view plaincopy
    1. 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

    搞定。

    三 总结


    问题的解决有时不是兵来将挡,水来土埋的正面回应,也可以是采用迂回战术。
  • 相关阅读:
    简单介绍 CPU 的工作原理
    Converting a MatchCollection to string array
    Ubuntu18.04安装pycharm如何显示锁定图标到收藏夹
    MFC使用控制台
    将CString输出到控制台的方法
    Python 字符串前面加u,r,b的含义
    Converting a MatchCollection to string array
    git命令查看版本记录
    git命令查看版本记录
    SQL Server游标
  • 原文地址:https://www.cnblogs.com/java20130722/p/3207026.html
Copyright © 2011-2022 走看看