Zhen Chen created CALCITE-7234:
----------------------------------

             Summary: Enable Trait Satisfaction for FD-Optimized Collations
                 Key: CALCITE-7234
                 URL: https://issues.apache.org/jira/browse/CALCITE-7234
             Project: Calcite
          Issue Type: Improvement
          Components: core
    Affects Versions: 1.40.0
            Reporter: Zhen Chen


**Problem:**

When "SortRemoveDuplicateKeysRule" removes redundant sort keys (based on 
functional dependencies), the Volcano optimizer rejects the simplified Sort 
because the optimized collation doesn't strictly match the original prefix.

**Example:**

- Original collation: [0, 1](sort by field 0, then field 1)
- Optimized collation: [0](field 1 is functionally determined by field 0)

The optimizer requires exact prefix matching, even though the optimized 
collation is semantically equivalent. This prevents 
"SortRemoveDuplicateKeysRule" from working effectively in VolcanoPlanner.

**Solution:**

Modify trait satisfaction logic to recognize FD-optimized collations as valid 
when they preserve semantic ordering.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to