waterWang opened a new pull request, #19197: URL: https://github.com/apache/pinot/pull/19197
## Description When a lookup join condition includes a **literal** on a dimension table primary key column (e.g. `dim_tbl.currency = 'gbp'`), Calcite's `analyzeCondition()` classifies it as a non-equi condition rather than an equi-join key. The `LookupJoinOperator` builds the lookup key only from `leftKeys` (equi-join column-column pairs), so the literal component is missing from the key. The key becomes shorter than the dimension table's primary key, causing the lookup to always return null — producing 0 result rows. ## Root Cause The condition `dim_tbl.currency = 'gbp' AND dim_tbl.rate_start_date = fact_tbl.rate_start_date` is split by Calcite as: - **Equi-join key**: `dim_tbl.rate_start_date = fact_tbl.rate_start_date` → `leftKeys`/ `rightKeys` - **Non-equi condition**: `dim_tbl.currency = 'gbp'` (column vs literal) The operator builds the key from `leftKeys` only, producing a 1-component key. But the dimension table's primary key is `[currency, rate_start_date]` (2 components), so the lookup always fails. ## Fix Build the lookup key in the dimension table's **primary key column order**, filling each position from either: - The corresponding left column (via equi-join `leftKeys`/ `rightKeys` mapping) - A literal value extracted from non-equi conditions of the form `dim_col = literal` ## Testing Added `lookup_join_literal_key` test case to `LookupJoin.json` with: - Dim table PK: `[currency, rate_start_date]` - Join: `dim_tbl.currency = 'gbp' AND dim_tbl.rate_start_date = fact_tbl.rate_start_date` - Expected: 1 result row `['gbp', 125]` Closes #19188 -- 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
