配置单元:创建按TIMESTAMP列的年和月划分的表

时间:2018-07-11 03:47:13

标签: hive hiveql hadoop-partitioning

我想知道是否可以创建按TIMESTAMP列的YEAR和MONTH分区的表?例如,类似于以下命令:

USE database;
CREATE TABLE credit_transactions(
  processdate TIMESTAMP,
  requestprocess STRING,
  cardno_hash STRING,
)
PARTITIONED BY (YEAR(processdate) INT, MONTH(processdate), INT)
CLUSTERED BY (cardno_hash) into 50 buckets stored as orc
TBLPROPERTIES("transactional"="true");

然后,是否可以简单地从csv文件添加数据并Hive自动对数据进行分区?例如:

LOAD DATA LOCAL INPATH '/root/usr/transact.csv' 
OVERWRITE INTO TABLE credit_transact 

0 个答案:

没有答案