vishalmore90 opened a new pull request, #41068:
URL: https://github.com/apache/beam/pull/41068
<!--
Thank you for your contribution! Follow this checklist to help us
incorporate your contribution quickly and easily:
- [ ] If this contribution is large, please file an Apache [Individual
Contributor License Agreement](https://www.apache.org/licenses/icla.pdf).
- [x] Replace these instructions with a description of your change and why
you have made it.
- [x] Mention the appropriate issue in your description (for example:
`addresses #123` or `fixes #456`).
- [x] Update `CHANGES.md` with noteworthy changes.
See [CONTRIBUTING.md]() for more details.
-->
Fixes #41052.
### Description
In Beam YAML, `_SqlJoinTransform` generated invalid SQL queries when joining
three or more inputs in topologies or dictionary key orderings that did not
match a star topology centered at `tables[0]`. This caused two failure modes:
1. Tables joining downstream tables were left without an `ON` clause (`INNER
JOIN tableB INNER JOIN tableC ON ...`), leading to Calcite `SqlParseException`.
2. Tables were referenced in preceding `ON` clauses before being joined into
the query scope.
3. In `_parse_fields`, specifying `'*'` as explicitly documented in
`_SqlJoinTransform` raised a `ValueError`.
This PR:
- Replaces the linear table iteration with an adjacency graph traversal
(BFS) starting at `tables[0]`. Each newly joined table is connected to already
visited tables with all connecting predicates placed into its `ON` clause,
guaranteeing valid SQL scoping and syntax.
- Supports `cols == '*'` in `_parse_fields`.
- Adds unit tests in `yaml_join_test.py` covering multi-table arbitrary
order joins, cycle/triangle joins, and wildcard field parsing.
- Updates `CHANGES.md`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]