hive - 为什么 HIVE 表返回空值
问题描述
我已经对此进行了编码以创建一个外部表:
CREATE EXTERNAL TABLE IF NOT EXISTS carss (
> maker STRING,
> model STRING,
> mileage FLOAT,
> manufacture_year INT,
> engine_displacement FLOAT,
> engine_power STRING,
> body_type STRING,
> color_slug STRING,
> stk_year FLOAT,
> transmission STRING,
> door_count INT,
> seat_count INT,
> fuel_type STRING,
> date_created DATE,
> date_last_seen DATE,
> price_eur FLOAT)
> ROW FORMAT DELIMITED FIELDS TERMINATED BY ','
> LOCATION '/BigData/Project2/'
> TBLPROPERTIES ("skip.header.line.count"="1", 'creator'='Janina', 'created_on'='2020-11-05', 'description'='dataset for classified Ads of cars in Germany and Czech Republic');
当我运行查询 SELECT * FROM carss LIMIT 1; 它返回空值和奇怪的字符
hive> SELECT * FROM carss LIMIT 1;
OK ��T�;��9fu7z�C�WHqd��Y�P�c��/�^�B�4���*G����Ç�ǿN������y�z ~>����Ǘ�?�Oo��ӿ��������r���������������������|������N� ���r����������o������������2}������x=�ʗ����/�||;���� ��9������������z~:���~��\��/��㏟�vZ)5�5��_i�4����erS�> �O��D��I�O����տ�?D���?�o��d��1�_V�K�����?�h����.�� ������|��<��ң^ w��X����c��������Ӕ����S���F$z��J�FywP�.���� �X�S��T��CM6lE9�^��j�h� NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 所用时间:0.059 秒,获取:1 行 hive>
解决方案
Is your file in /BigData/Project2/
encoded in utf-8? If not, you might need to specify the encoding of the underlying file when creating the external table:
create external table carss
...
row format
serde 'org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe'
with serdeproperties("serialization.encoding"='WINDOWS-1252')
location
...
This article might be helpful.
推荐阅读
- arrays - Rust:数组长度的宏
- python - Office365-REST-Python-客户端访问令牌问题
- excel - Excel 中的 DATEDIF 和 IF 语句,在 10 个月内不会返回正确的结果
- android - 如何使用 Room 库中的 createFromAsset 函数?
- java - 从静态上下文调用非静态方法
- vue.js - 如何在Vue中修复“观察者“isDark”的getter错误”
- mysql - AWS Aurora - 无法连接到 aws aurora db
- swift - 上传个人资料图片时 Firebase 应用程序崩溃
- atmel - sim800和sim900的区别
- android - React Native TextInput 多行底部