impala使用

1.登陆
impala-shell -i cslave1

2.refresh
refresh table_name:当有文件更新时
INVALIDATE METADATA;当有刚创建的表
3.中文code不支持问题
impala-shell -i cslave1
[cslave1:21000] >select count(1) from s_trade where receiver_name = '李丹';
Unknown Exception : 'ascii' codec can't encode characters in position: ordinal not in range
官方issue https://issues.cloudera.org/browse/IMPALA-607
解决:
vim /usr/lib/impala-shell/impala_shell.py
def do_select(self, args):
    """Executes a SELECT... query, fetching all rows"""
    return self.__execute_query(self.__create_beeswax_query("select %s" % args))
修改成:
def do_select(self, args):
    """Executes a SELECT... query, fetching all rows"""
    return self.__execute_query(self.__create_beeswax_query("select %s" %(args.encode('utf-8'),)))
修改后:
[cslave1:21000] > select count(1) from s_trade where receiver_name = '李丹';
Query: select count(1) from s_trade where receiver_name = '李丹'
+----------+
| count(1) |
+----------+
| 822      |
+----------+
Returned 1 row(s) in 1.62s

你可能感兴趣的:(impala ascii)