Conversation
|
CI doesn't like your changes |
32526d0 to
60bf738
Compare
|
CI is happy now. 😄 |
| } | ||
|
|
||
| /** | ||
| * Copies input dependencies into a join, optionally filtering dependencies |
There was a problem hiding this comment.
I don't understand this javadoc. Can you please say what each parameter is and what the function actually computes? There's no "join" to be seen of here.
|
|
||
| /** | ||
| * Returns whether a dependency's determinant contains a non-nullable input | ||
| * field. Such a determinant cannot collide with the all-NULL determinant of |
There was a problem hiding this comment.
why does this comment mention a LEFT JOIN? There is no left join here. Please make the comment describe this function does.
| * @param fdSet Functional dependency set | ||
| * @param offset Index offset | ||
| * @return Shifted functional dependency set | ||
| * Adds functional dependencies implied by a join condition. |
There was a problem hiding this comment.
where does it add the dependencies?
| * Extracts functional dependencies from equality and AND conditions. | ||
| * Handles col1 = col2, col1 IS NOT DISTINCT FROM col2, and AND conditions. | ||
| * Adds bidirectional dependencies for input-reference equalities in a | ||
| * condition. Callers are responsible for ensuring that every output row |
There was a problem hiding this comment.
every output row of what?
|
Updated all Javadocs raised in review. The helper methods now document their general behavior, parameters, return value where applicable, where inferred dependencies are recorded, and the relational-output requirement for equality-derived dependencies. |
|
| @Test void testKeepsDerivedGroupKeyForNestedDouble() { | ||
| // Determinism alone is insufficient for approximate values, including | ||
| // nested occurrences. Keep the derived key unless grouping equality is | ||
| // known to be congruent with the expression for ARRAY<DOUBLE>. |
There was a problem hiding this comment.
I cannot read this comment. What is "congruent with the expression"?
| ImmutableBitSet aggCols = | ||
| ImmutableBitSet.range(rel.getGroupCount(), rel.getRowType().getFieldCount()); | ||
| fdBuilder.addArrow(groupSet, aggCols); | ||
| fdBuilder.addArrow(ImmutableBitSet.range(rel.getGroupCount()), aggCols); |
There was a problem hiding this comment.
I think you also need to add to line 373 above a check Aggregate.isSimple(rel)
Some aggregates like ROLLUP are not simple; maybe you can add a suitable test case:
select a, count(*) c from t group by rollup(a)
503afd4 to
1348183
Compare
|
When this is ready please re-request a review |



Jira Link
CALCITE-7757
Changes Proposed
RelMdFunctionalDependency can currently expose unsound or incorrectly indexed dependencies, allowing AggregateRemoveDuplicateKeysRule to remove grouping keys that are still required.
This change:
A basic valid duplicate-key removal remains supported:
For this inner join, either equivalent equality key may be removed. The new safeguards prevent that reasoning from being applied where null generation, ordinal mapping, or non-reflexive type semantics make it unsound.
Testing
The focused test run completed 49 tests with 0 failures.