Skip to content

AWS Athena - HIVE_CURSOR_ERROR: incorrect data check

0

HIVE_CURSOR_ERROR: incorrect data check This query ran against the "dbreport" database, unless qualified by the query. Please post the error message on our forum or contact customer support with Query Id: 1ba2a03e-aea9-4305-a4dc-9f9da5a05f46.

This is my first time using the forum, but my error message I should post here and include the Query Id above.

The above came from an automated process that ran successfully every day for a few weeks. Then about a week ago it started generating the above error every day since. I don't believe anything changed on the code or process side, so I'm not sure why this broke.

Below is the query producing the error.

select session_id, cid, domain_nm, case when calc_sub_domain like '%.%.%.%' then split_part(calc_sub_domain, '.', 3) || '.' || split_part(calc_sub_domain, '.', 4) when calc_sub_domain like '%.%.%' then split_part(calc_sub_domain, '.', 2) || '.' || split_part(calc_sub_domain, '.', 3) else calc_sub_domain end calc_domain, calc_sub_domain, end_dt, click_from_email_ind, page_ct, best_email_key, best_email_src_cd, best_email_group, best_email_technique, best_email_source_flag, best_email_opt_status, best_email_capture_context, best_email_click_thru_ind, best_email_conf_score, best_email_match_score, hmid, hmid_src_cd, hmid_group, hmid_technique, hmid_source_flag, hmid_opt_status, hmid_capture_context, hmid_click_thru_ind, hmid_conf_score, hmid_match_score, browse_total_ct, cart_created_ind, cart_total_ct, order_placed_ind, order_id, order_amt, order_product_ct, platform_application, platform_device, platform_os, first_page_url, to_db_dttm from ( select session_id, cid, domain_nm, replace(split_part(split_part(split_part(lower(trim(first_page_url)), '?', 1), '/', 3), ':', 1), 'www.', '') calc_sub_domain, end_dt, click_from_email_ind, page_ct, best_email_key, best_email_src_cd, nullif(split_part(best_email_src_cd, '|', 1), '') best_email_group, nullif(split_part(best_email_src_cd, '|', 2), '') best_email_technique, nullif(split_part(best_email_src_cd, '|', 3), '') best_email_source_flag, nullif(split_part(best_email_src_cd, '|', 4), '') best_email_opt_status, nullif(split_part(best_email_src_cd, '|', 5), '') best_email_capture_context, nullif(split_part(best_email_src_cd, '|', 6), '') best_email_click_thru_ind, best_email_conf_score, nullif(split_part(best_email_src_cd, '|', 8), '') best_email_match_score, hmid, hmid_src_cd, nullif(split_part(hmid_src_cd, '|', 1), '') hmid_group, nullif(split_part(hmid_src_cd, '|', 2), '') hmid_technique, nullif(split_part(hmid_src_cd, '|', 3), '') hmid_source_flag, nullif(split_part(hmid_src_cd, '|', 4), '') hmid_opt_status, nullif(split_part(hmid_src_cd, '|', 5), '') hmid_capture_context, nullif(split_part(hmid_src_cd, '|', 6), '') hmid_click_thru_ind, hmid_conf_score, nullif(split_part(hmid_src_cd, '|', 8), '') hmid_match_score, cast(browse_total_ct as integer) browse_total_ct, cart_created_ind, cast(cart_total_ct as integer) cart_total_ct, order_placed_ind, order_id, order_amt, cast(order_product_ct as integer) order_product_ct, platform_application, platform_device, platform_os, first_page_url, to_db_dttm, row_number () over (partition by session_id order by to_db_dttm desc) rnum from dbreport.rpt_session_base_view -- where case when length(session_id) = 60 then 1 else 0 end = 1 ) where rnum = 1 ;

asked 2 years ago366 views
1 Answer
1
Accepted Answer

The HIVE_CURSOR_ERROR: incorrect data check error is usually caused by corrupt or bad data.

If you've recently added any new objects to your S3 table, please verify that:

  • these objects aren't corrupt by downloading and inspecting these objects.
  • Additionally, if they are compressed, verify whether or not the compression is valid as well.
  • If you have partitions on your table, verify whether or not you are able to query individual partitions. This ties back with the first point because if there are new partitions you aren't able to query, they might contain invalid objects.

If you have any specific issue with respect to this query please raise a support case with AWS Glue team for more in depth support.

AWS
SUPPORT ENGINEER
answered 2 years ago
EXPERT
reviewed 2 years ago
  • Thank you for the information, Aishwarya. I was able to trace the problem to a corrupt file. I appreciate the help.

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.