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

已提问 1 年前429 查看次数
1 回答
0
已接受的回答

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
专家
已回答 1 年前
  • thanks, recreating the views the error wasn't there anymore

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则