Home | About | Sematext search-lucene.com search-hadoop.com
NEW: Monitor These Apps!
elasticsearch, apache solr, apache hbase, hadoop, redis, casssandra, amazon cloudwatch, mysql, memcached, apache kafka, apache zookeeper, apache storm, ubuntu, centOS, red hat, debian, puppet labs, java, senseiDB
 Search Hadoop and all its subprojects:

Switch to Threaded View
Hive >> mail # user >> create external table as select with location?


Copy link to this message
-
create external table as select with location?
Is it possible to do something like this:

CREATE EXTERNAL TABLE T
LOCATION 's3://...'
AS
SELECT ...;

I would rather not fix the schema for T so that I can easily change the
SELECT query and its underlying tables.
Because of that, I don't want to define the table first. Instead, I have to
save the data into a temp table:

CREATE TABLE tmp AS
SELECT ...;

CREATE EXTERNAL TABLE T LIKE tmp
LOCATION 's3://...';

INSERT OVERWRITE TABLE T
SELECT * FROM tmp;

which seems to be slower than using a single INSERT with the original
SELECT.
NEW: Monitor These Apps!
elasticsearch, apache solr, apache hbase, hadoop, redis, casssandra, amazon cloudwatch, mysql, memcached, apache kafka, apache zookeeper, apache storm, ubuntu, centOS, red hat, debian, puppet labs, java, senseiDB