I have daily csv files in AWS S3 partitioned by month and year. The csv files have all the data enclosed in double quotes e.g.
"Time","ItemCode","Volume","Available"
"1/07/2019 12:00:00 AM","12148A","71","True"
"1/07/2019 12:00:00 AM","12149Z","23","False"
When I create a standard crawler over this data, the schema has interpreted the following data types:
Time: string
ItemCode: string
Volume: bigint
Available: boolean
Input format: org.apache.hadoop.mapred.TextInputFormat
Output format: org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat
Serde serialization lib: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
Serde parameters: field.delim ,
However when I query this data in Athena via "select * ...", I can only see the data in the Time and ItemCode columns (and partition columns). All the other columns are empty. So I get the result:
Time ItemCode Volume Available Month Year
"1/07/2019 12:00:00 AM" "12148A" 07 2019
"1/07/2019 12:00:00 AM" "12149Z" 07 2019
I'm not sure what's going on. It seems that only the string data shows within Athena.
I also want 'Time' to have type 'timestamp'. I'm not sure how to correct all this. I have to rerun the crawler every month, so there is no point in manually editing the schema, as a rerun will reset the schema.
Do I have to create a Glue job to strip all the double quotes from the csv files and save them to new csv files, and crawl over these new files?
Thanks for any advice on how to fix this problem, or how to handle this the best way.