César Correa
César Correa

Reputation: 188

Athena: Queries of this type are not supported

I have the current query in athena.

SELECT col1,
       col_2,
       A.col_3
    FROM 
        (SELECT col_1,
                col_3
        FROM table_1
        JOIN col_3
        WHERE col_1 IN 
            (SELECT DISTINCT col_1
            FROM table_2
            JOIN table_1
                ON table_1.col_1 = table_2.col_1
            ) 
        ) AS A
            LEFT JOIN 
                (SELECT col_2,
                        col_3
                FROM table_3
                JOIN col_3
                WHERE col_2 IN 
                    (SELECT DISTINCT col_2
                    FROM table_2
                    JOIN table_4
                        ON table_2.col_1 = table_4.col_1
                    JOIN table_3
                        ON table_4.col_2 = table_3.col_2
                    ) 
                ) AS B
                        ON B.col_3 = A.col_3

Which works in SQLite. But when I run it in AWS Athena I got the following error:

Queries of this type are not supported (Service: AmazonAthena; Status Code: 400; Error Code: InvalidRequestException; Request ID: some_id)

I assume that some part of this query is not supported by AWS Athena, but I am new to the Framework.

Upvotes: 10

Views: 29426

Answers (2)

Trey Copeland
Trey Copeland

Reputation: 3527

If you're running into this issue and still haven't figured it out, it might be because your lambda or user doesn't have permissions to run select statements.

You'll need something like this in your policy:

    - Effect: 'Allow'
      Resource: '*'
      Action: lakeformation:*

Note: you should restrict these down to specific resource and action. The wildcard is not best practices.

Upvotes: 0

Theo
Theo

Reputation: 132852

"Queries of this type are not supported" is Athena's generic way of saying that it doesn't understand your SQL, but that it's not a simple syntax error. You're using SQL that Athena does not support, in other words.

Run the innermost part of the query by itself, and if you don't get the error, add the SQL that wraps it, and so on until you find the fragment that causes the error. If you don't know how to fix it ask a new question focused on that.

Upvotes: 22

Related Questions