hive - How PARTITIONED BY works? -


i have created below table, want understand how partition works, partition column logdate not part of table ddl how partition works , how data distribution & retrieval happens.

create table tbl_1 ( collecttimestamp timestamp, objectcolumnname varchar(256), objectdatabasename           varchar(256), typeofuse                    tinyint ) partitioned (logdate string) row format delimited fields terminated '\u0001' stored orc location '/tables/db1/tbl_1' ; 

the partition column ``definitely part of table ddl, because partitioned by ddl. partition folder, it's not necessary store partition key data in data files. partition information (partition key, location) stored in metastore database. partition column should last in insert overwrite sentence dynamic partition load. when query table, hive reads information partitions (keys, locations) metastore. location (folder) can attached partition:

alter table page_view add partition (dt='2008-08-08', country='us') location '/path/to/us/part080808' 

see docs here: https://cwiki.apache.org/confluence/display/hive/languagemanual+ddl


Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -