Is it possible to do a
create table <mytable> as select <query statement>
using
row format delimited fields terminated by '|';
or to do a
create table <mytable> like <other_table> row format delimited fields terminated by '|';
The Language Manual seems to indicate not.. but something tickles me I had achieved this in the past.
Try running a "show create table" command and it will show you the delimiter.
hive> CREATE TABLE IF NOT EXISTS employee ( eid int, name String, salary String, destination String) COMMENT 'Employee details' ROW FORMAT DELIMITED FIELDS TERMINATED BY '\t' LINES TERMINATED BY '\n' STORED AS TEXTFILE; If you add the option IF NOT EXISTS, Hive ignores the statement in case the table already exists.
Introduced in HIVE-5871, MultiDelimitSerDe allows user to specify multiple-character string as the field delimiter when creating a table.
Create Table as select (CTAS) is possible in Hive.
You can try out below command:
CREATE TABLE new_test row format delimited fields terminated by '|' STORED AS RCFile AS select * from source where col=1
Create table like is also possible in Hive.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With