Unable to flat nested data from DocumentDB using Athena federated query

0

Currently I'm trying to perform a federated query to DocumentDB.

It is now returning information but I'm not able to flatten nested data even though I've tried the approach provided in https://docs.aws.amazon.com/athena/latest/ug/rows-and-structs.html (btw, I'm not casting the rows since I want to perform this transformation to the entire dataset) and also in https://developer.imdb.com/documentation/bulk-data-documentation/querying-in-athena/?ref_=side_nav .

Error being SYNTAX_ERROR: line 3:5: Expression XXXXX is not of type ROW

Could it be an issue with table schema?

Any help with this will be truly appreciated.

Thanks in advance

已提問 1 年前檢視次數 741 次
1 個回答
0

I would like to inform you that this type of error

“SYNTAX_ERROR: line 3:5: Expression XXXXX is not of type ROW”

usually occurs when the nested data are queried with “.” without using UNNEST function on the nested field of the table while performing the query. Further You can also face such error when your table name is same as any of your column name and as Athena is case insensitive so even upper and lower case difference can cause this issue. You can also use “json_extract_scalar” to flatten your data. I have added some documentation for your reference . If you still face any error please raise a case to premium support from the respective account along with following informations :-

  1. query_id
  2. small data set with same schema.

Reference:-

[1] https://topjun.medium.com/how-to-flatten-json-array-in-athena-dddd46db8240

[2] https://www.sledgeworx.io/querying-complex-json-objects-in-aws-athena/

AWS
已回答 1 年前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南