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 table like with partitions


Copy link to this message
-
Create table like with partitions
Hi,

Using hive 0.10.0 over hadoop 1.0.4

I have a (non-partitioned) table with loads of columns.
I would like to create a partitioned table with the same set of columns.
So the approach that I have been taking is to use "CREATE TABLE copy LIKE original;"
then I can use ALTER TABLE to change the location and the INPUTFORMAT
and the OUTPUTFORMAT and the SERDE and properties and pretty much
everything else. However I don't seem to be able to make it partitioned.
Sure I can add partitions if it's already partitioned but I don't seem
to be able to make it partitioned if it's not already. I get errors like this:

hive> ALTER TABLE customerShortValues ADD PARTITION (aid='1') LOCATION 'E7/phase2/values/aid=1';
FAILED: Error in metadata: table is not partitioned but partition spec exists: {aid=1}
FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask

So, I guess that I could create the table I want by hand copying over all the
column definitions. But is there an easier way?

Z
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