[
https://issues.apache.org/jira/browse/CALCITE-5913?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17753636#comment-17753636
]
JingDas commented on CALCITE-5913:
----------------------------------
Thanks for your comment [~thomas.rebele] . It makes sense that the design of
`FunctionalDependencies` for alternative.
I think for the method as following:
{code:java}
ImmutableBitSet getFunctionalDependentColumns(ImmutableBitSet columns); {code}
It seems to be better that return `Set<ImmutableBitSet>`, it may by depends on
multi functional dependencies.
to the method as following, I does't have clear design for this, may be we can
design and implemt it in the future by the detailed scene.
{code:java}
List<FunctionalDependency> getNontrivialFunctionalDependencies() {code}
I think maybe I can implement the method design fristly as following.
{code:java}
interface FunctionalDependencies extends Metadata {
boolean functionallyDetermine(ImmutableBitSet columns, int column);
//or design like
boolean isFunctionallyDetermined(ImmutableBitSet columns, int column);
} {code}
the work for `FunctionalDependencies` is valuable and challenging. The extended
work for `FunctionalDependencies`, we can work it out step by step in specific
scene together.
> Support to get functional dependency metadata in RelMetadataQuery
> -----------------------------------------------------------------
>
> Key: CALCITE-5913
> URL: https://issues.apache.org/jira/browse/CALCITE-5913
> Project: Calcite
> Issue Type: New Feature
> Reporter: JingDas
> Assignee: JingDas
> Priority: Major
>
> Functional dependency analysis can be applied to various problems in query
> optimization:
> selectivity estimation, estimation of (intermediate) result sizes, *order
> optimization*
> *(in particular sort avoidance),* cost estimation, and various problems in
> the area of semantic query optimization, as said in the book《[Exploiting
> Functional Dependence in Query
> Optimization》|https://cs.uwaterloo.ca/research/tr/2000/11/CS-2000-11.thesis.pdf]
>
> In calcite, it may be metadata that something like 'FunctionalDependency'
> BuiltInMetadata as following:
> {code:java}
> public abstract class BuiltInMetadata {
> // ...
> public interface FunctionalDependency extends Metadata {
> /** Returns whether column is functionally dependent on columns. */
> Boolean functionallyDetermine(ImmutableBitSet columns, int column);
> }
> } {code}
>
> As the above book said, functional dependency analysis is a valuable and
> challenging work. I think support order optimization
> (in particular sort avoidance) by the relevant functional dependency metadata
> firstly, and then get complete functional dependency function step by step.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)