Athena engine version 3 Responding with Given correlated subquery is not supported for cross join and subquery

0

Since upgrade to Athena engine version 3 a query with a subquery in the where clause is no longer supported. Athena responds with, "NOT_SUPPORTED: line 24:6: Given correlated subquery is not supported".

Example:

select
  sup1.dynamodb.keys.something.s something1,
  site.m.something.s something2,
  count(1) count
from
  "prefs" as sup1
  cross join unnest(sup1.dynamodb.newimage.somethings.l) as t(something)
where
  1 = 1
  and sup1.partition_0 = '2023'
  and sup1.partition_1 = '06'
  and sup1.partition_2 = '27'
  and sup1.partition_3 =
    (select
      max(sup2.partition_3)
    from
      "prefs" as sup2
    where
      sup2.partition_0 = sup1.partition_0
      and sup2.partition_1 = sup1.partition_1
      and sup2.partition_2 = sup1.partition_2
      and sup2.dynamodb.keys.something.s = sup1.dynamodb.keys.something.s)
group by
  sup1.dynamodb.keys.something.s,
  site.m.something.s
having
  count(1) > 1
order by
  1

asked a year ago323 views
2 Answers
0

Thank you Jason for reporting it. The team is aware of the issue and are working on the fix.

AWS
Anish P
answered a year ago
0

Correlated Subqueries don't support LIMIT

SELECT *
FROM (VALUES 1, 2, 3) table1(a)
LEFT JOIN LATERAL
(SELECT b FROM (VALUES 2,4) table2(b) WHERE b > a limit 1) ON TRUE

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

answered 2 months ago

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