[ 
https://issues.apache.org/jira/browse/CALCITE-7205?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18023683#comment-18023683
 ] 

Zhen Chen commented on CALCITE-7205:
------------------------------------

I'm trying to understand [~julianhyde]'s concerns. Please correct me if I'm 
wrong. During the implementation of the functional dependency feature, 
[~mbudiu] suggested splitting the functionality into two PRs to facilitate code 
review and maintain a clear separation between the functional dependency 
algorithm and the relational algebra plan. I agree with this suggestion, and it 
aligns with my initial thinking. I will subsequently refactor 
RelMdFunctionalDependencies based on this JIRA.

Regarding the test cases, since the current JIRA involves the implementation of 
the functional dependency algorithm and testing is necessary, I would like to 
create a separate test file specifically for it, possibly named 
FunctionalDependenciesTest. This file would test the implementation logic of 
the functional dependency algorithm. After refactoring 
RelMdFunctionalDependencies, I will move the tests related to the relational 
algebra plan to RelMetadataTest. Do you think this approach is appropriate?

If the above is acceptable, we need a class to represent functional dependency 
relationships. The current name used is FunctionalDependency, and I agree that 
this name is not specific enough. I am considering changing it to 
IndicesDependencyItem (I assume this name is acceptable, as I will mention it 
again later). I would like to know if this is suitable or if you have better 
suggestions. Additionally, we need a utility class to host the implementation 
of related algorithms. I am considering naming it FunctionalDependencies, as 
one common practice in Calcite for concrete implementations is to use the 
plural form. Of course, I am open to other more appropriate names.

In IndicesDependencyItem, I use an arrow("->") to represent the functional 
dependency relationship, which I think is quite clear in expressing the 
meaning. The dependency relationship defined in IndicesDependencyItem includes 
two variables: determinants and dependents. We can temporarily refer to them as 
the "determinant set" and the "dependent set." Both are sets, so they can 
describe one-to-one, one-to-many, many-to-one, and many-to-many relationships.

These are my thoughts. I look forward to your reply!

> Implement Core FD Algorithm Library for Functional Dependencies
> ---------------------------------------------------------------
>
>                 Key: CALCITE-7205
>                 URL: https://issues.apache.org/jira/browse/CALCITE-7205
>             Project: Calcite
>          Issue Type: Task
>          Components: core
>    Affects Versions: 1.40.0
>            Reporter: Zhen Chen
>            Assignee: Zhen Chen
>            Priority: Minor
>              Labels: pull-request-available
>
> This JIRA primarily provides foundational capabilities for *relational 
> algebra and metadata reasoning*.
> *Main Implementations:*
> * Encapsulates functional dependency (FD) sets, supporting basic operations 
> such as addition, deletion, and query.
> * Provides algorithms for closure computation, equivalence judgment, and 
> candidate key discovery.
> * Supports efficient attribute reasoning and dependency reasoning, 
> facilitating use by upper-layer optimizers and metadata modules.
> Please refer to the discussion in the PR for [more 
> details|https://github.com/apache/calcite/pull/4540#discussion_r2384265382].



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

Reply via email to