I want to create an external table on AWS Athena based on a CSV file, using OpenCSVSerde.
CREATE EXTERNAL TABLE `table`(name string, value double, group string)
ROW FORMAT SERDE 'org.apache.hadoop.hive.serde2.OpenCSVSerde'
WITH SERDEPROPERTIES ("separatorChar" = ",", "escapeChar" = "\\","skip.header.line.count"="1", "serialization.null.format"="")
LOCATION 's3://path' ;
The file contains some missing values for the 'value' field (double type). It looks like this:
name,value,group
name1,0.5,a
name2,0.2,a
name3,,a
name4,0.11,b
After creating it, when I try to run some queries (like a simple "select * from table"), Athena gives this error:
HIVE_BAD_DATA: Error parsing column '1': empty String
As you can see from the create external table query, I tried to add 'serialization.null.format'='' but it doesn't seem to be working. The only solution I found was to define the column 'value' as a string, but it's obviously not the ideal one (especially if you have many columns like this).
Do you have any idea of how to resolve this?
Thank you