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개 답변
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
답변함 일 년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인