我想创建的内容在下面解释。在Hive中可以做到吗?
我可以使用Pandas在Python中做到这一点并替换列,但是我想知道Hive中的查询可以做到吗?
我已经在Hive中上载了Source表并在Cloudera HUE中也创建了如下所示的维表,因此可以通过使用维表 id 值并在源表?
我有“源”表:
我从源表创建维表:
我想创建事实表:
答案 0 :(得分:1)
通过源表中的值联接并选择ID:
insert overwrite table fact
select pr.id as property, t.id as type, pl.id as place, s.price
from source_table s
left join property_dim pr on s.property=pr.property
left join type_dim t on s.type=t.type
left join place_dim pl on s.place=pl.place