SELECT * FROM "customer_cur_data"."kpi_tracker" failed

0

Here the error message: INVALID_VIEW: line 1:15: Failed analyzing stored view 'awsdatacatalog.customer_cur_data.kpi_tracker': line 144:6: View 'awsdatacatalog.customer_cur_data.kpi_instance_all' is stale or in invalid state: column [account_id] of type varchar projected from query view at position 34 cannot be coerced to column [account_id] of type varchar(12) stored in view definition This query ran against the "customer_cur_data" database, unless qualified by the query. Please post the error message on our forum or contact customer support with Query Id: 68e5bb57-1d96-42e7-94f5-e3034791b115

asked 10 months ago412 views
1 Answer
0
Accepted Answer

Firstly, there is a known issue in the Athena Engine version 3 related to the creation of views, particularly those involving the UNNEST operation. The error message you're seeing is consistent with this issue, and the current workaround is to use Engine version 2​.

https://repost.aws/questions/QUXHNVR7hXQYe1hjyDWxpgqA/athena-engine-v-3-errors-in-view-with-unnest

Secondly, there appears to be a type of coercion issue. The error message suggests that there is a discrepancy between the type of the account_id column as projected from the query view and the type stored in the view definition. A similar issue has been reported in the context of Hive, where a view became stale because it was attempting to coerce a column of type char(n) to a column of type varchar stored in the view definition. This resulted in an error stating that the view was stale and needed to be recreated​

https://github.com/trinodb/trino/issues/6234.

To address your issue, you may want to consider the following steps:

Confirm the engine version of Athena you're using. If it's version 3, consider downgrading to version 2 as a workaround. Check the data types of the account_id column in your view definition and in the query view. If they don't match, you may need to update the view definition or adjust the query to ensure the types match. If the view is stale, consider recreating the view.

profile picture
EXPERT
answered 10 months ago
  • thanks, recreating the views the error wasn't there anymore

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.

Guidelines for Answering Questions