impala-shell -o a.txt 查询中有中文时报错问题的处理
文章目录
-o 保存执行结果到文件
当使用impala-shell -o a.txt进入impala-shell之后,查询报错:
报错情况:
Query: select * from dim_sales_dept
Unknown Exception : 'ascii' codec can't encode characters in position 559-562: ordinal not in range(128)
解决方案:
问题在于python编码;
在impala-shell.py首部加入以下部分即可
28 import sys
29 import time
30 # add by niewj start
31 reload(sys)
32 sys.setdefaultencoding('utf-8')
33 # add by niewj end
34
[2016-08-12]
评论
登录后参与技术讨论,分享你的经验与见解。
登录 / 注册暂无评论