I am trying to create a table using the OpenCSVSerde and some integer and date columns. But the columns get converted to String. Is this an expected outcome?
As a workaround, I do an explicit type-cast after this step (which makes the complete run slower)
hive> create external table if not exists response(response_id int,lead_id int,creat_date date ) ROW FORMAT SERDE 'org.apache.hadoop.hive.serde2.OpenCSVSerde' WITH SERDEPROPERTIES ('quoteChar' = '"', 'separatorChar' = ',', 'serialization.encoding'='UTF-8', 'escapeChar' = '~') location '/prod/hive/db/response' TBLPROPERTIES ("serialization.null.format"="");
OK
Time taken: 0.396 seconds
hive> describe formatted response;
OK
# col_name data_type comment
response_id string from deserializer
lead_id string from deserializer
creat_date string from deserializer
Source Code that explains change of datatype to String.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…