本文介绍了使用tblproperties创建Hive外部表的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图在Hive中用tblproperties创建一个外部表。该表已创建,但不显示行。有任何想法吗?请在下面找到我使用的脚本:
感谢您提前给我们提供时间和建议。
数据是在递归文件夹中:/user/test/test1/test2/samplefile.csv
use dw_raw;
drop table if exists temp_external_tab1;
如果不存在,创建外部表temp_external_tab1(
col1 int,
col2字符串,
col3字符串,
col4字符串
)
行格式分隔字段以''结尾
行以'\ n'结尾
以文本文件存储
位置'/ user / test / test1 /'
tblproperties( hive.input.dir.recursive=TRUE,
hive.mapred.supports.subdirectories=TRUE,
hive.supports.subdirectories=TRUE,
mapred.input.dir.recursive=TRUE);
解决方案
这些不是表格属性,而是全局设置。 / p>
你应该使用'set'来设置它们,例如:
set hive.mapred.supports.subdirectories = TRUE;
set mapred.input.dir.recursive = true;
I am trying to create an external table with tblproperties in Hive. The table gets created but it does not display the rows. Any ideas? Please find the scripts i am using below:
Thanks for your time and suggestions in advance.
Data is in a recursive folder: /user/test/test1/test2/samplefile.csv
use dw_raw;
drop table if exists temp_external_tab1;
create external table if not exists temp_external_tab1 (
col1 int,
col2 string,
col3 string,
col4 string
)
row format delimited fields terminated by ','
lines terminated by '\n'
stored as textfile
location '/user/test/test1/'
tblproperties ("hive.input.dir.recursive" = "TRUE",
"hive.mapred.supports.subdirectories" = "TRUE",
"hive.supports.subdirectories" = "TRUE",
"mapred.input.dir.recursive" = "TRUE");
解决方案
These are not table properties, but global settings.
You should set these using 'set', i.e.:
set hive.mapred.supports.subdirectories=true;
set mapred.input.dir.recursive=true;
这篇关于使用tblproperties创建Hive外部表的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!