6

Pls help me on how to implement CREATE TABLE AS SELECT

For simple create table t1 as select * from t2; I can implement as

Create table t1 like t2;
insert into t1 as select * from t2;

But how to implement create table t1 as select c1,c2,c3 from t2;

Is there any way to implement this in impala?

  • As of 1.1, there is not a CREATE TABLE AS SELECT syntax (http://www.cloudera.com/content/cloudera-content/cloudera-docs/Impala/latest/Installing-and-Using-Impala/ciiu_langref_sql.html?scroll=create_table_unique_1). I don't even know if this is in Hive. – Sean Owen Oct 23 '13 at 07:39
  • It is implemented in Hive. According to this ticket( https://issues.cloudera.org/browse/IMPALA-161), next release of impala 1.2 will have it . Thanks – on_the_shores_of_linux_sea Oct 25 '13 at 06:33
  • Good to know! 1.2 is coming soon. – Sean Owen Oct 25 '13 at 07:11
  • What version of CDH and Impala are you using. I am using CDH4.6 and Impala 1.2.4 and this release supports DDL syntax such as CREATE TABLE and CREATE TABLE AS SELECT ... SQL like syntax With the earlier versions, DDL operations were not supported. – Raunak Jhawar Apr 20 '14 at 00:35

1 Answers1

4

As mentioned in the comments, CREATE TABLE AS SELECT is supported in Impala since 1.2: documentation, JIRA ticket.

Nickolay
  • 31,095
  • 13
  • 107
  • 185