1
我創建了一個按日期分區的表。但是不能在where子句中使用分區。 下面是該過程步驟1 :蜂巢。無法引用where子句中的分區
CREATE TABLE new_table (
a string,
b string
)
PARTITIONED BY (dt string);
第二步:創建
Insert overwrite table new_table partition (dt=$date)
Select a, b from my_table
where dt = '$date
表。
Describe new_table;
a string
b string
dt string
問題:
select * from new_table where dt='$date'
返回空集。
而
select * from new_table
返回一個,b和DT。
有誰知道這可能是什麼原因?
謝謝
如果你運行'SHOW PARTITIONS NEW_TABLE會發生什麼插入;'? – dhore
嘗試過,但無法重現您的問題;做了幾個排列,包括動態分區。正如已經建議的那樣,驗證你的查詢,檢查分區等。 – libjack
我的不好,我在做; > hive -e'select * from new_table其中dt ='$ date'' 和單引號引起了問題。我花了3個小時看到這個:)謝謝你的答案 – sahara