我嘗試將csv文件加載到Hive中。我有datetime列和包含逗號的列的問題。分隔符和逗號一樣。Hive使用逗號和時間戳加載csv
CMBk7Y,HM - PEUVP,promo,11066,FRA,1401445,Asegment_DLBD,1,imp,2017-05-31 22:52:30,"U=dsp=mmh,bid=0000002,adv=189,cpg=3449,str=2117,cre=41836,exc=apn,pub=3296,sit=leboncoin.fr,pag=https%3A//www.leboncoin.fr/materiel_agricoles/%3Fth%3D1%2ot%3D0;ord=909215572"
我不能使用打開的CSVSerDe,因爲我需要日期時間格式的日期列。而CSVSerDe僅適用於字符串
我試圖用ROW FORMAT SERDE 'org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe' WITH SERDEPROPERTIES ( "separatorChar" = ",", "quoteChar" = "\"" )
但是它把一切都在一列。
我也試過這樣:ROW FORMAT SERDE 'org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe' WITH SERDEPROPERTIES ( 'serialization.format' = ',', 'field.delim' = ','
)
在這種情況下,它發生在最後一列第一個逗號之前的一切。
我認爲解決方案並不遙遠,但我找不到它。
在此先感謝您的幫助