2015-05-27 18 views
0

我已經按照年份爲外部表分隔文件。我爲每年添加了分區。我跑的節目表擴展的命令,它顯示:應該'顯示錶擴展'列出分區下的文件?

partitioned:true 
partitionColumns:struct partition_columns { i32 year} 
totalNumberFiles:0 
totalFileSize:0 

如果它列出每個分區的位置的文件?

DROP TABLE IF EXISTS myTable; 

CREATE EXTERNAL TABLE myTable(
    somefield STRING, 
    somefield2 STRING, 
    GMTDateTime TIMESTAMP 
    ) 

PARTITIONED BY (year INT) 
ROW FORMAT DELIMITED FIELDS TERMINATED BY ',' 
STORED AS TEXTFILE LOCATION 'wasb://{hdinsight instance}@{storage name}.blob.core.windows.net/data00/'; 

alter table myTable add partition (year = 2015) location '{hdinsight instance}@{storage name}.blob.core.windows.net/data2015/' ; 
alter table myTable add partition (year = 2014) location '{hdinsight instance}@{storage name}.blob.core.windows.net/data2014/' ; 
+0

參考以下鏈接 http://stackoverflow.com/questions/22056402/hive-describe-partitions-to-show-partition-url –

+0

當我運行 分析表TABLENAME分區(the_partition)計算統計NOPASS ; 我得到: 失敗:ParseException的線路1:55外部輸入「NOPASS」期待EOF「」附近 – Roger

回答

0

抱歉.. 我們可以看到各個分區的位置下面的命令.. DESCRIBE [擴展| FORMATTED]的幫助[DB_NAME] table_name的PARTITION partition_spec ...

但沒有這樣的命令知道所有的分區與網址。我們必須找出它由個別分區。

+0

作爲新的蜂巢和HDFS,它只是讓我感到驚訝的是,當你定義一個表,並添加分區到不同的位置,即show table extended不會列出所有分區中的所有文件。 – Roger

相關問題