hive查询中文乱码问题

小咪咪 2021-11-23 04:42 405阅读 0赞

问题1. hue中中文字符乱码问题,重现步骤如下

create external table test_1_txt (id int, name varchar(100)) location ‘/tmp/test1’

insert into test_1_txt values ( 1,’中国人’)

create external table test_2_orc (id int, name varchar(100) ) stored as orc location ‘/tmp/test2’;

insert overwrite talbe test_2_orc select * from test_1_txt;

select * from test_2_orc

这个时候发现查出来的数据是乱码

create external table test_3_string (id int, name string) stored as orc location ‘/tmp/test3’;

insert overwrite table test_3_string select * from test_1_txt;

select * from test_3_string

发现查出来的数据是正确显示的。

当时在测试环境中没有这个问题,开发环境中有这个问题,经过对比环境变量,发现是下面的问题:

ubuntu 系统 /etc/default/locale目录

LANG=en_US.UTF-8

LC_CTYPE=en_US.UTF-8

把hive-server所在的服务器配置成上述即可,为了保持一致性,避免其他可能的问题,使用统一的locale配置。

2.dfs.namenode.name.dir 目录中可以写入多个用逗号分隔的目录,这个分隔的目录中数据都是一样的,起到备份的目的。

转载于:https://www.cnblogs.com/huaxiaoyao/p/11216178.html

发表评论

表情:
评论列表 (有 0 条评论,405人围观)

还没有评论,来说两句吧...

相关阅读

    相关 Hive注释问题

    在HIVE中建表的时候,有时候难免要表中文注释,然而如果不经过配置,会导致desc某个表名的时候,直接以?的方式返回。 因此也来解决一下HIVE中文注释乱码的问题。由于HI

    相关 sublime中文问题

    Sublime Text 3是我MacBook Pro最喜欢的代码编辑器,没有之一,因为她的性感高亮代码配色,更因为它的小巧,但是它默认不支持GBK的编码格式,因此打开GBK的