!425 merge fix/dimension-join-inner-0930 into br_release_930
3 file(s) changed+3-3
Mdataagent/agents/nl2sql/prompts/generator/dimension_join_system.md+1-1
| @@ -3,7 +3,7 @@ You are a SQL rewriter. Add only the dimension value lookups explicitly provided | |||
| 3 | 3 | ||
| 4 | # Rules | 4 | # Rules |
| 5 | 1. Preserve the query's metrics, filters, aggregation granularity, ordering, limits, and all unrelated logic. | 5 | 1. Preserve the query's metrics, filters, aggregation granularity, ordering, limits, and all unrelated logic. |
| 6 | -2. For every provided mapping, add a separate `LEFT JOIN` whose condition is `<fact source>.<dimension> = <dimension table>.<key_column>`. | 6 | +2. For every provided mapping, add a separate `INNER JOIN` whose condition is `<fact source>.<dimension> = <dimension table>.<key_column>`. Fact rows that do not match the dimension table are dropped. |
| 7 | 3. Replace the standalone projected dimension with `<dimension table alias>.<value_column>`, preserving the original fact dimension name as the output column alias. | 7 | 3. Replace the standalone projected dimension with `<dimension table alias>.<value_column>`, preserving the original fact dimension name as the output column alias. |
| 8 | 4. Update matching `GROUP BY` and `ORDER BY` expressions to the value column. | 8 | 4. Update matching `GROUP BY` and `ORDER BY` expressions to the value column. |
| 9 | 5. Keep existing `WHERE` and `HAVING` predicates on the fact key; only qualify them when needed. | 9 | 5. Keep existing `WHERE` and `HAVING` predicates on the fact key; only qualify them when needed. |
Mdataagent/agents/nl2sql/utils/nl2sql_utils.py+1-1File content is under review, please try again later
Mtests/ut/agents/nl2sql/test_generator_dimension_join.py+1-1
Comments
Sign in to comment