- Subscribe to RSS Feed
- Mark Question as New
- Mark Question as Read
- Float this Question for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
Error while creating a table with 'LIKE' clause
- Labels:
-
Apache Hive
Created ‎04-22-2016 10:00 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am trying this
create table emp1 LIKE emp CLUSTERED BY () INTO 4 BUCKETS STORED AS ORC;
Its giving a parse exception :
- rg.apache.ambari.view.hive.client.HiveInvalidQueryException:Errorwhile compiling statement: FAILED:ParseException line 4:42 missing EOF at 'CLUSTERED' near 'emp'[ERROR_STATUS]
- org.apache.ambari.view.hive.client.HiveInvalidQueryException:Errorwhile compiling statement: FAILED:ParseException line 4:42 missing EOF at 'CLUSTERED' near 'emp'[ERROR_STATUS]
- at org.apache.ambari.view.hive.client.Utils.verifySuccess(Utils.java:46)
Created ‎04-22-2016 04:28 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You will need to specify the column you are clustering on, and then achieve it in multiple statements:
CREATE TABLE emp1 LIKE emp; ALTER TABLE emp1 SET FILEFORMAT ORC; ALTER TABLE emp1 CLUSTERED BY (empId) INTO 4 BUCKETS;
Created ‎04-22-2016 10:39 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I don't think you can define other attributes while creating table with "LIKE" option, in theory with "LIKE" it will copy the existing table definition and other attributes. Its better to use alter table after creating it with "LIKE".
EDITED: I think you can change no. of buckets with alter command if you already defined it previously.
Created ‎04-22-2016 04:28 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You will need to specify the column you are clustering on, and then achieve it in multiple statements:
CREATE TABLE emp1 LIKE emp; ALTER TABLE emp1 SET FILEFORMAT ORC; ALTER TABLE emp1 CLUSTERED BY (empId) INTO 4 BUCKETS;
