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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop explicit ROW constructor from SELECTs #63

Closed
wants to merge 2 commits into from

Conversation

ryannedolan
Copy link
Collaborator

@ryannedolan ryannedolan commented Mar 25, 2024

Summary

Drop explicit ROW(...) constructor from SELECTs in SQL output.

Details

Flink seems to choke on pipelines like INSERT INTO ... SELECT ROW(HEADER.NAME) FROM FOO. The Flink SQL parser is fine with ROW(...) but only if the expressions inside the constructor do not include a field access .. Some experiments:

  • SELECT ROW(HEADER) FROM FOO 馃憤
  • SELECT ROW(HEADER.NAME) FROM FOO 馃憥
  • SELECT (HEADER.NAME) FROM FOO 馃憤

This seems like a bug to me, but the last case points to a workaround: we can simply drop the explicit ROW, and rely on the parser treating (...) as the same thing.

Testing

This was difficult to test, so I did so manually. The artificially complicated subscription SELECT ROW("quantity") AS V, "product_id" AS KEY FROM INVENTORY."products_on_hand" is rendered as follows:

INSERT INTO `RAWKAFKA`.`products` (`V`, `KEY`) SELECT(`quantity`) AS `V`,
        `product_id` AS `KEY` FROM `INVENTORY`.`products_on_hand

...whereas previously this would have been rendered with a ROW(...) constructor. The Flink parser seems to be happy with the change.

@ryannedolan ryannedolan deleted the drop-row-constructor branch March 30, 2024 22:04
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.

None yet

1 participant