title: AWS Athena query output format
body: <p>I have S3 bucket that contains csv files (see 'Data sample').</p>
  
  <p>The files were created as a result of an Athena query.</p>
  
  <p>I want to treat the 'time' column as decimal(17,7) and the 'size' column as bigint.</p>
  
  <p>I define a table (see 'Table definition') and using the query (see 'Query' below)
  I get the 'Error' below.</p>
  
  <p><strong>My questions are</strong>:<br>
  Is there a way to control the Athena query output format and get a csv without the quotes around the fields? (1545980216.9581780,1349 vs "1545980216.9581780","1349")</p>
  
  <p>Assuming the answer to the previous question is negative. How can I query the data in the table '`del_me_later_4' and treat the fields as decimal and bigint.</p>
  
  <p><strong>Data sample</strong></p>
  
  <pre><code>"time","size"
  "1545751457.8957720","432"
  "1545751458.0753407","583"
  "1545751458.1407920","583"
  "1545751458.1683733","560"
  </code></pre>
  
  <p><strong>Table definition</strong></p>
  
  <pre><code>CREATE EXTERNAL TABLE `del_me_later_4`(
    `time` string, 
    `size` string)
  ROW FORMAT DELIMITED 
    FIELDS TERMINATED BY ',' 
  STORED AS INPUTFORMAT 
    'org.apache.hadoop.mapred.TextInputFormat' 
  OUTPUTFORMAT 
    'org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat'
  LOCATION
    's3://del-me-later/'
  TBLPROPERTIES (
    'skip.header.line.count'='1'  
  )
  </code></pre>
  
  <p><strong>Query</strong></p>
  
  <pre><code>SELECT cast(time AS decimal(17,7)) as time,
         cast(size AS bigint) as size  
  FROM "del_me_later_4"
  </code></pre>
  
  <p><strong>Error</strong></p>
  
  <pre><code>INVALID_CAST_ARGUMENT: Cannot cast VARCHAR '"1545751457.8957720"' to DECIMAL(17, 7)
  </code></pre>