如何在没有任何中间文件的情况下创建配置单元表? [英] How do I create a hive table without any intermediate files?
本文介绍了如何在没有任何中间文件的情况下创建配置单元表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在不从磁盘加载任何内容的情况下创建和填充配置单元表.
I want to create and populate a hive table without loading anything from disk.
具体来说,我有
set idlist = (1,2,3);
set values = (2,3,5);
我想创建一个有 9 行的表格:
I want to create a table with 9 rows:
id value
1 2
1 3
1 5
2 2
2 3
2 5
3 2
3 3
3 5
再说一次,我不想写一个 csv
文件并将它加载到 hive 中.
Again, I do not want to write a csv
file and load it into hive.
用例:
- 迭代
- 为 SO 问题创建小型测试样本
推荐答案
create table my_table(id int, value int);
insert overwrite table my_table
select a.id as id, b.value as value from (
select count(*) from my_table
) t
lateral view explode(array(1,2,3)) a as id
lateral view explode(array(2,3,5)) b as value;
这篇关于如何在没有任何中间文件的情况下创建配置单元表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文