Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CORAL-TRINO] Bug: Showcase nested subquery translation failure #506

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

findinpath
Copy link
Contributor

What changes are proposed in this pull request, and why are they necessary?

The translation of a nested subquery causes inexistent table references in the output query.

Table

CREATE TABLE test.table_id_value (id int, value varchar(255))

Hive View

CREATE VIEW IF NOT EXISTS test.view_max_values AS
SELECT value FROM test.table_id_value  WHERE id IN (SELECT MAX(id) FROM test.table_id_value)

Coral to Trino Translation outcome

SELECT "table_id_value"."value" AS "value"
FROM "test"."table_id_value" AS "table_id_value"
INNER JOIN (
        SELECT MAX("table_id_value0"."id")
        FROM (
                SELECT MAX("table_id_value0"."id")
                FROM "test"."table_id_value" AS "table_id_value0") AS "t0"
                GROUP BY MAX("table_id_value0"."id")
        ) AS "t1"
  ON "table_id_value"."id" = MAX("table_id_value0"."id")

The JOIN expression ON "table_id_value"."id" = MAX("table_id_value0"."id") is referencing an inexistent table - table_id_value0.

How was this patch tested?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant