title: Amazon Athena same query some times fails with HIVE_CURSOR_ERROR
body: <p>I have a large number of log files containing lines of JSON object stored in Amazon S3. This files are compressed using LZO.</p>
  
  <p>The format is using Hive partition like below</p>
  
  <pre><code>s3://bucket/logs/year=2017/month=01/day=01/log00_00.txt.lzo
  </code></pre>
  
  <p>The table definition is like below</p>
  
  <pre><code>CREATE EXTERNAL TABLE IF NOT EXISTS logs (
      attr1 string,
      attr2 string,
      attr3 string,
  )
  PARTITIONED BY (
      year string,
      month string,
      day string
  )
  ROW FORMAT SERDE 'org.apache.hive.hcatalog.data.JsonSerDe'
  WITH SERDEPROPERTIES (
    'serialization.format' = '1'
  ) LOCATION 's3://bucket/logs/'
  TBLPROPERTIES ('has_encrypted_data'='false');
  </code></pre>
  
  <p>When I tried executing query for a month like this</p>
  
  <pre><code>SELECT COUNT(*) FROM logs WHERE year = '2017' AND month = '05';
  </code></pre>
  
  <p>the query always fails</p>
  
  <pre><code>HIVE_CURSOR_ERROR: org.codehaus.jackson.JsonParseException: 
  Unexpected character ('c' (code 99)): expected a valid value
  (number, String, array, object, 'true', 'false' or 'null') at
  [Source: java.io.ByteArrayInputStream@381dc2b6; line: 1, column: 2]
  </code></pre>
  
  <p>I tried querying for smaller number of data, i.e. in a day like this</p>
  
  <pre><code>SELECT COUNT(*) FROM logs WHERE year = '2017' AND month = '05' AND day = '01'
  </code></pre>
  
  <p>This query some times fails with error like above, although the probability of success is very high.</p>
  
  <p>So now when I have to query for a month, I have to iterate for every day in the month and then rerun the execution for the failed day.</p>
  
  <p>Is there something that I can do to fix that? Or is this a bug from AWS Athena?</p>