You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hive.apache.org by "Badrinath Narasimhan (JIRA)" <ji...@apache.org> on 2017/05/28 00:00:53 UTC
[jira] [Created] (HIVE-16783) Allow column list specification in
INSERT statement for a Partitioned ORC Table
Badrinath Narasimhan created HIVE-16783:
-------------------------------------------
Summary: Allow column list specification in INSERT statement for a Partitioned ORC Table
Key: HIVE-16783
URL: https://issues.apache.org/jira/browse/HIVE-16783
Project: Hive
Issue Type: Bug
Components: Parser, Query Processor, SQL
Affects Versions: 1.2.1
Environment: OS : Red Hat Enterprise Linux Server release 6.4
HDP 2.3.4
Hive version : 1.2.1.2.3.4.0-3485
Reporter: Badrinath Narasimhan
Priority: Critical
Original issue at HIVE-9481, this one relates to Partitioned ORC Table.
SQL allows insertion into a partitioned table for a select list of columns;The same functionality when executed on Hive ORC Partitioned table, fails.
Reproducing steps:
create table source (a int, b int);
insert into source values(1,1);
create table target2 (
x int,
y int,
z int)
PARTITIONED BY (log_date string)
stored as orc;
hive>
> insert into target2
> select a,b from source;
FAILED: SemanticException 1:12 Need to specify partition columns because the destination table is partitioned. Error encountered near token 'target2'
hive>
> insert into target2 partition (log_date='2017-05-08')
> select a,b from source;
FAILED: SemanticException [Error 10044]: Line 1:12 Cannot insert into target table because column number/types are different ''2017-05-08'': Table insclause-0 has 3 columns, but query has 2 columns.
hive>
> insert into target2(y,z)
> select a,b from source;
FAILED: SemanticException 1:12 Need to specify partition columns because the destination table is partitioned. Error encountered near token 'target2'
hive>
> insert into target2(y,z) partition (log_date='2017-05-08')
> select a,b from source;
NoViableAltException(192@[])
at org.apache.hadoop.hive.ql.parse.HiveParser.regularBody(HiveParser.java:41226)
at org.apache.hadoop.hive.ql.parse.HiveParser.queryStatementExpressionBody(HiveParser.java:40421)
at org.apache.hadoop.hive.ql.parse.HiveParser.queryStatementExpression(HiveParser.java:40291)
at org.apache.hadoop.hive.ql.parse.HiveParser.execStatement(HiveParser.java:1598)
at org.apache.hadoop.hive.ql.parse.HiveParser.statement(HiveParser.java:1117)
at org.apache.hadoop.hive.ql.parse.ParseDriver.parse(ParseDriver.java:202)
at org.apache.hadoop.hive.ql.parse.ParseDriver.parse(ParseDriver.java:166)
at org.apache.hadoop.hive.ql.Driver.compile(Driver.java:426)
at org.apache.hadoop.hive.ql.Driver.compile(Driver.java:314)
at org.apache.hadoop.hive.ql.Driver.compileInternal(Driver.java:1164)
at org.apache.hadoop.hive.ql.Driver.runInternal(Driver.java:1212)
at org.apache.hadoop.hive.ql.Driver.run(Driver.java:1101)
at org.apache.hadoop.hive.ql.Driver.run(Driver.java:1091)
at org.apache.hadoop.hive.cli.CliDriver.processLocalCmd(CliDriver.java:216)
at org.apache.hadoop.hive.cli.CliDriver.processCmd(CliDriver.java:168)
at org.apache.hadoop.hive.cli.CliDriver.processLine(CliDriver.java:379)
at org.apache.hadoop.hive.cli.CliDriver.executeDriver(CliDriver.java:739)
at org.apache.hadoop.hive.cli.CliDriver.run(CliDriver.java:684)
at org.apache.hadoop.hive.cli.CliDriver.main(CliDriver.java:624)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.apache.hadoop.util.RunJar.run(RunJar.java:221)
at org.apache.hadoop.util.RunJar.main(RunJar.java:136)
FAILED: ParseException line 1:25 cannot recognize input near 'partition' '(' 'log_date' in statement
hive> insert into target2 partition (log_date='2017-05-08')
> select a,b from source;
FAILED: SemanticException [Error 10044]: Line 1:12 Cannot insert into target table because column number/types are different ''2017-05-08'': Table insclause-0 has 3 columns, but query has 2 columns.
hive>
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)