[ 
https://issues.apache.org/jira/browse/CALCITE-7757?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Darpan Lunagariya (e6data) updated CALCITE-7757:
------------------------------------------------
    Description: 
h2. Summary

{{RelMdFunctionalDependency}} currently infers functional dependencies that do 
not always hold under SQL null, grouping, ordinal, and value-equality semantics.

{{AggregateRemoveDuplicateKeysRule}} consumes this metadata and can 
consequently remove a necessary grouping key, changing query results.

h2. Correctness problems

# *Outer-join equality dependencies* - {{LEFT}} and {{RIGHT}} joins must not 
infer bidirectional functional dependencies from equality predicates when null 
generation invalidates one direction.
# *Dependencies from null-generated inputs* - Outer joins must not blindly 
preserve functional dependencies from the null-generated input because null 
padding can invalidate them.
# *Incorrect Aggregate ordinal mapping* - Aggregate input group ordinals must 
be mapped to packed output positions before exposing their functional 
dependencies.
# *Equality-derived dependencies for approximate numerics* - Equality 
predicates involving {{FLOAT}} or {{DOUBLE}} must not produce functional 
dependencies when SQL equality and grouping equality differ.
# *Unsafe derived-expression dependencies* - Determinism alone is insufficient 
for removing derived grouping expressions; unsafe scalar and nested types must 
be rejected.
# *Grouping-set aggregate dependencies* - Grouping columns must not be assumed 
to determine aggregate results when grouping sets can produce identical 
null-padded keys.
# *Projected TableScan ordinals* - Table keys expressed in base-table ordinals 
must not be applied directly to projected or reordered {{TableScan}} output 
columns.
# *Unsafe generic unary-node passthrough* - Unknown single-input relational 
nodes must not automatically inherit input functional dependencies because they 
may change schema, values, or cardinality.
# *Join offsets with system fields* - Functional-dependency ordinals for join 
inputs must account for system fields prefixed to the output, including semi 
and anti joins.
# *Equality-derived dependencies for collated values* - Equality using a custom 
collator can consider strings equal even when Enumerable grouping distinguishes 
their Java keys, making the inferred dependency unsafe.

  was:
h2. Summary

{{RelMdFunctionalDependency}} currently infers functional dependencies that do 
not always hold under SQL null, grouping, ordinal, and value-equality semantics.

{{AggregateRemoveDuplicateKeysRule}} consumes this metadata and can 
consequently remove a necessary grouping key, changing query results.

h2. Correctness problems

# *Outer-join equality dependencies* — {{LEFT}} and {{RIGHT}} joins must not 
infer bidirectional functional dependencies from equality predicates when null 
generation invalidates one direction.
# *Dependencies from null-generated inputs* — Outer joins must not blindly 
preserve functional dependencies from the null-generated input because null 
padding can invalidate them.
# *Incorrect Aggregate ordinal mapping* — Aggregate input group ordinals must 
be mapped to packed output positions before exposing their functional 
dependencies.
# *Equality-derived dependencies for approximate numerics* — Equality 
predicates involving {{FLOAT}} or {{DOUBLE}} must not produce functional 
dependencies when SQL equality and grouping equality differ.
# *Unsafe derived-expression dependencies* — Determinism alone is insufficient 
for removing derived grouping expressions; unsafe scalar and nested types must 
be rejected.
# *Grouping-set aggregate dependencies* — Grouping columns must not be assumed 
to determine aggregate results when grouping sets can produce identical 
null-padded keys.
# *Projected TableScan ordinals* — Table keys expressed in base-table ordinals 
must not be applied directly to projected or reordered {{TableScan}} output 
columns.
# *Unsafe generic unary-node passthrough* — Unknown single-input relational 
nodes must not automatically inherit input functional dependencies because they 
may change schema, values, or cardinality.
# *Join offsets with system fields* — Functional-dependency ordinals for join 
inputs must account for system fields prefixed to the output, including semi 
and anti joins.
# *Equality-derived dependencies for collated values* — Equality using a custom 
collator can consider strings equal even when Enumerable grouping distinguishes 
their Java keys, making the inferred dependency unsafe.


> RelMdFunctionalDependency can infer unsound dependencies and cause incorrect 
> query results
> ------------------------------------------------------------------------------------------
>
>                 Key: CALCITE-7757
>                 URL: https://issues.apache.org/jira/browse/CALCITE-7757
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 1.42.0
>            Reporter: Darpan Lunagariya (e6data)
>            Assignee: Darpan Lunagariya (e6data)
>            Priority: Major
>              Labels: pull-request-available
>
> h2. Summary
> {{RelMdFunctionalDependency}} currently infers functional dependencies that 
> do not always hold under SQL null, grouping, ordinal, and value-equality 
> semantics.
> {{AggregateRemoveDuplicateKeysRule}} consumes this metadata and can 
> consequently remove a necessary grouping key, changing query results.
> h2. Correctness problems
> # *Outer-join equality dependencies* - {{LEFT}} and {{RIGHT}} joins must not 
> infer bidirectional functional dependencies from equality predicates when 
> null generation invalidates one direction.
> # *Dependencies from null-generated inputs* - Outer joins must not blindly 
> preserve functional dependencies from the null-generated input because null 
> padding can invalidate them.
> # *Incorrect Aggregate ordinal mapping* - Aggregate input group ordinals must 
> be mapped to packed output positions before exposing their functional 
> dependencies.
> # *Equality-derived dependencies for approximate numerics* - Equality 
> predicates involving {{FLOAT}} or {{DOUBLE}} must not produce functional 
> dependencies when SQL equality and grouping equality differ.
> # *Unsafe derived-expression dependencies* - Determinism alone is 
> insufficient for removing derived grouping expressions; unsafe scalar and 
> nested types must be rejected.
> # *Grouping-set aggregate dependencies* - Grouping columns must not be 
> assumed to determine aggregate results when grouping sets can produce 
> identical null-padded keys.
> # *Projected TableScan ordinals* - Table keys expressed in base-table 
> ordinals must not be applied directly to projected or reordered {{TableScan}} 
> output columns.
> # *Unsafe generic unary-node passthrough* - Unknown single-input relational 
> nodes must not automatically inherit input functional dependencies because 
> they may change schema, values, or cardinality.
> # *Join offsets with system fields* - Functional-dependency ordinals for join 
> inputs must account for system fields prefixed to the output, including semi 
> and anti joins.
> # *Equality-derived dependencies for collated values* - Equality using a 
> custom collator can consider strings equal even when Enumerable grouping 
> distinguishes their Java keys, making the inferred dependency unsafe.



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

Reply via email to