2017-05-05 50 views
1

我正在寻找Hive版本0.13.1的等价查询。如何将多行数据插入配置单元(0.13.1)表中?

INSERT INTO TABLE table1 VALUES 
(151, 'cash', 'lunch'), 
(152, 'credit', 'lunch'), 
(153, 'cash', 'dinner'); 

this答案是明确的 “INSERT ....价值观” 0.14版本后,可查询。
那么对于给定的配置单元版本,上述查询的等价物是什么?

+0

@Jared - 我问过OP多个值插入到打开一个新的问题。 –

+1

顺便说一句,任何你使用3年前版本的原因? –

+0

我对此毫无头绪。更好的人会成为我管理层的人,他为我提供这个蜂巢版本,以回答它:)。 –

回答

3

如果要插入多个值,那么你可以选择联盟

INSERT INTO TABLE table1 
    select 151, 'cash', 'lunch' 
    union all 
    select 152, 'credit', 'lunch' 
    union all 
    select 153, 'cash', 'dinner'; 
0
INSERT INTO TABLE table1 
select inline(array 
     (
      struct (151 ,'cash' ,'lunch') 
      ,struct (152 ,'credit' ,'lunch') 
      ,struct (153 ,'cash' ,'dinner') 
     )) 
+0

我没有Hive 0.13,但'inline'在配置单元0.10上引入,因此它应该可以工作。它在更新的版本上工作。 –

+0

我在运行上面命令时出现这个错误'FAILED:NullPointerException null' –

相关问题