Hive:使用 select 1 将列插入配置单元 table
Hive: Insert into hive table with column using select 1
假设我有一个配置单元 table test_entry,其列名为 entry_id。
hive> desc test_entry;
OK
entry_id int
Time taken: 0.4 seconds, Fetched: 1 row(s)
假设我需要使用 select 1
(其中 returns 1)在上面 table 中插入一行。例如:语法如下所示:
hive> insert into table test_entry select 1;
但是我得到以下错误:
FAILED: NullPointerException null
如此有效,我想为 entry)id 插入一行,使用这样的 select 语句(不引用另一个 table),其值为 1。
如何做到这一点?
Hive 不支持您尝试执行的操作。在 Hive 0.13 中引入了基于 tables 的 ORC 插入。
在此之前,如果要执行 INSERT .. SELECT
,则必须指定 FROM 子句
解决方法可能是创建一个外部 table 一行并执行以下操作
INSERT .. SELECT 1 FROM table_with_one_row
假设我有一个配置单元 table test_entry,其列名为 entry_id。
hive> desc test_entry;
OK
entry_id int
Time taken: 0.4 seconds, Fetched: 1 row(s)
假设我需要使用 select 1
(其中 returns 1)在上面 table 中插入一行。例如:语法如下所示:
hive> insert into table test_entry select 1;
但是我得到以下错误:
FAILED: NullPointerException null
如此有效,我想为 entry)id 插入一行,使用这样的 select 语句(不引用另一个 table),其值为 1。
如何做到这一点?
Hive 不支持您尝试执行的操作。在 Hive 0.13 中引入了基于 tables 的 ORC 插入。
在此之前,如果要执行 INSERT .. SELECT
解决方法可能是创建一个外部 table 一行并执行以下操作
INSERT .. SELECT 1 FROM table_with_one_row