【发布时间】:2019-10-04 14:44:43
【问题描述】:
我的表格结构如下:
0: jdbc:hive2://vw118287.ds.dev.accenture.com> desc sample2;
Getting log thread is interrupted, since query is done!
+-------------+------------+----------+--+
| col_name | data_type | comment |
+-------------+------------+----------+--+
| event_text | string | |
| load_date | string | |
+-------------+------------+----------+--+
现在,我想在向此表中插入数据时添加一个具有常量值的新列,因此我运行以下查询:
insert into table sample2 select event_text,'2019','Sample' as SampleColumn from ccs_service_optimization_9401.so_wireless_radius_summary ;
它抛出以下错误:
Caused by: org.apache.hadoop.hive.ql.parse.SemanticException: Line 1:18 Cannot insert into target table because column number/types are different 'sample2': Table insclause-0 has 2 columns, but query has 3 columns.
我在 SO 帖子中读到,这在 Hive 中是不可能的,但我相信一定有某种或其他方式。有人对此有任何想法吗??
【问题讨论】:
-
一种方法是将具有常量值的列作为分区列,然后将数据插入分区
标签: hadoop hive bigdata hiveql