[英]How to create hive table with date format 'dd-MMM-yyyy'?
我正在嘗試創建一個配置單元表,用於將csv數據導入到表中,其中csv文件中的日期格式為'dd-MMM-yyyy'(例如20-Mar-2018)。 當我在蜂巢中創建表格時,它會將整個日期列轉換為空值。 誰能建議我如何解決這個問題?
我的查詢:
create external table new_stock (Symbol String,Series String,Dat date,Prev_Close float,Open_Price float,High_Price float,Low_Price float,Last_Price float,Close_Price float,Avg_Price float,Volume int,Turn_Over float,Trades int,Del_Qty int,DQPQ_Per float) row format delimited fields terminated by ',' stored as textfile LOCATION '/stock_details/'
最后來自@leftjoin的一些幫助,我解決了使用選擇查詢將字符串日期格式為(dd-MMM-yyyy)轉換為(dd-MM-yyyy)的問題。 會很好的。
select from_unixtime(unix_timestamp(columnname ,'dd-MMM-yyyy'), 'dd-MM-yyyy') from tablename;
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.