码迷,mamicode.com
首页 > 其他好文 > 详细

hive查询中文乱码问题

时间:2019-07-19 23:43:15      阅读:151      评论:0      收藏:0      [点我收藏+]

标签:ring   serve   其他   ext   数据   逗号   node   ble   cal   

问题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 目录中可以写入多个用逗号分隔的目录,这个分隔的目录中数据都是一样的,起到备份的目的。

 

hive查询中文乱码问题

标签:ring   serve   其他   ext   数据   逗号   node   ble   cal   

原文地址:https://www.cnblogs.com/huaxiaoyao/p/11216178.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!