CodeTrainerMan opened a new pull request, #29306:
URL: https://github.com/apache/flink/pull/29306
## What is the purpose of the change
Two lookup joins on the same table that carry different `OPTIONS` hints are
currently deduplicated
into a single node, so that the second join silently reads with the
connector options of the first
one:
```sql
SELECT s.a, d.name
FROM MyTable AS s
JOIN LookupTable /*+ OPTIONS('data-id'='probeA') */ FOR SYSTEM_TIME AS OF
s.proctime AS d
ON s.a = d.id
UNION ALL
SELECT s.a, d.name
FROM MyTable AS s
JOIN LookupTable /*+ OPTIONS('data-id'='probeB') */ FOR SYSTEM_TIME AS OF
s.proctime AS d
ON s.a = d.id
```
plans to a single lookup join with the second branch replaced by
`Reused(reference_id=[1])`.
`CommonPhysicalTableSourceScan.explainTerms` adds a `hints` item, so two
scans with different
`OPTIONS` stay separate. A lookup join never received the hints of the
temporal table's scan:
`CommonLookupJoinRule` passed `tableScan.getTable` but not
`tableScan.getHints`, so the hints could
not reach `CommonPhysicalLookupJoin.explainTerms` and both nodes ended up
with the same digest.
This commit threads the scan's hints through the rule into the physical node
and adds them to the
digest, reusing the `hintsDigest` pattern of `CommonPhysicalTableSourceScan`.
## Brief change log
- `CommonLookupJoinRule`: pass the table scan's hints into
`transform`/`transformToLookupJoin`
(previously only the `RelOptTable` was passed on to the physical node)
- `CommonPhysicalLookupJoin`: new `hints` field, exposed in `explainTerms`
through `hintsDigest`
- `StreamPhysicalLookupJoin` / `BatchPhysicalLookupJoin`: carry the hints
through the constructors
and the `copy` methods
## Verifying this change
Added
`LookupJoinTest#testLookupJoinWithDifferentOptionsHintsIsNotDeduplicated`,
which plans a
`UNION ALL` of two lookup joins with different `OPTIONS` hints and asserts
that both hints survive
in the plan and that the plan contains no `Reused` node. The test fails
without the fix.
## Does this pull request potentially affect one of the following parts
- Dependencies (does it add or upgrade a dependency): no
- The public API, i.e., is any changed class annotated with
`@Public(Evolving)`: no
- The serializers: no
- The runtime per-record code paths (performance sensitive): no
- Anything that affects deployment or recovery: JobManager (and its
components), Checkpointing,
Kubernetes/Yarn, ZooKeeper: no
- The S3 file system connector: no
## Documentation
- Does this pull request introduce a new feature? no
- If yes, how is the feature documented? not applicable
--
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]