Created 08-17-2017 08:50 AM
Hi i am doing some ETL with hiveQl I am creating new tables based on external hive tables, but then the external hive table is empty no empty table is created. How do i create a empty table if there is no records in the external table om selecting from. I am running the code from NIFI hiveql processor in nifi 2.x not supporting multiple hql statement. A oneliner would be beautiful Her is a example DROP TABLE IF EXISTS myname_t1; CREATE TABLE myname_t1 STORED AS ORC LOCATION '/archive/data/myname/T1'AS select*,INPUT__FILE__NAME ETL_FILENAME from myname;
Created 08-17-2017 01:43 PM
Hi I´m not sure if I understand this exactly but I´m going to try to answer it.
If you want to create an empty table from an empty external table the only thing you have to do is:
So, that should work with any major issue.
Created 08-17-2017 01:43 PM
Hi I´m not sure if I understand this exactly but I´m going to try to answer it.
If you want to create an empty table from an empty external table the only thing you have to do is:
So, that should work with any major issue.
Created 08-17-2017 02:19 PM
@palgaba You mean without major issue?
Created 08-17-2017 03:35 PM
Created 08-17-2017 03:04 PM
@Bala Vignesh N V is correct.
create table <new table> as
select * from <external_table>;
Will create a new empty table with the same as the external columns. The external table has to be created prior to executing the CTAS.
Created 08-18-2017 07:18 AM
@Simon, I tried the same scenario in Spark-shell with Hive.. I am able to create orc table from another external table.. Attaching snap. createasselect.png
Can you pls provide logs or error displayed while "create as select" ?
Created 08-18-2017 08:19 AM
@nramanaiahHi, yes i found out the same,it seems to be happening when running hive through JDBC and ODBC. My problem is that i am running this in NIFI PutHiveQL processor