[jira] [Commented] (CALCITE-6272) Improved LogicalPlan representation of distinct keyword

2024-02-19 Thread Julian Hyde (Jira)


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

Julian Hyde commented on CALCITE-6272:
--

I think you’re saying the current behavior is fine, and you want to add tests. 
I believe the current behavior is fine and we probably don’t need any more 
tests. 

> Improved LogicalPlan representation of distinct keyword
> ---
>
> Key: CALCITE-6272
> URL: https://issues.apache.org/jira/browse/CALCITE-6272
> Project: Calcite
>  Issue Type: Improvement
>  Components: core
>Affects Versions: 1.36.0
>Reporter: Caican Cai
>Priority: Minor
> Fix For: 1.37.0
>
>
> In the ToLogicalConvert test, the LogicalPlan parsed with or without the 
> distinct keyword is the same. I think this is an improvement.
>  
> {code:java}
> @Test void testdistnct() {
>   // Equivalent SQL:
>   //   SELECT DISTINCT *
>   //   FROM emp
>   final RelBuilder builder = builder();
>   final RelNode rel =
>   builder.scan("EMP")
>   .distinct()
>   .build();
>   String expectedPhysical = ""
>   + "EnumerableTableScan(table=[[scott, EMP]])\n";
>   String expectedLogical = ""
>   + "LogicalTableScan(table=[[scott, EMP]])\n";
>   verify(rel, expectedPhysical, expectedLogical);
> }
> @Test void test() {
>   // Equivalent SQL:
>   //   SELECT DISTINCT *
>   //   FROM emp
>   final RelBuilder builder = builder();
>   final RelNode rel =
>   builder.scan("EMP")
>   .build();
>   String expectedPhysical = ""
>   + "EnumerableTableScan(table=[[scott, EMP]])\n";
>   String expectedLogical = ""
>   + "LogicalTableScan(table=[[scott, EMP]])\n";
>   verify(rel, expectedPhysical, expectedLogical);
> } {code}
> I think it can be improved to something like
> {code:java}
> Logical Project (DISTINCT)
> +- Logical Scan (Table: employees){code}
>  
>  



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


[jira] [Commented] (CALCITE-6272) Improved LogicalPlan representation of distinct keyword

2024-02-19 Thread Caican Cai (Jira)


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

Caican Cai commented on CALCITE-6272:
-

[~julianhyde] Hi,I noticed your jira on [distinct|[CALCITE-1634] Make 
RelBuilder.distinct no-op if input is already distinct - ASF JIRA (apache.org)] 
processing, I think this jira can be turned off, should I add distinct test to 
ToLogicalConverterTest and modify the jira description.

> Improved LogicalPlan representation of distinct keyword
> ---
>
> Key: CALCITE-6272
> URL: https://issues.apache.org/jira/browse/CALCITE-6272
> Project: Calcite
>  Issue Type: Improvement
>  Components: core
>Affects Versions: 1.36.0
>Reporter: Caican Cai
>Priority: Minor
> Fix For: 1.37.0
>
>
> In the ToLogicalConvert test, the LogicalPlan parsed with or without the 
> distinct keyword is the same. I think this is an improvement.
>  
> {code:java}
> @Test void testdistnct() {
>   // Equivalent SQL:
>   //   SELECT DISTINCT *
>   //   FROM emp
>   final RelBuilder builder = builder();
>   final RelNode rel =
>   builder.scan("EMP")
>   .distinct()
>   .build();
>   String expectedPhysical = ""
>   + "EnumerableTableScan(table=[[scott, EMP]])\n";
>   String expectedLogical = ""
>   + "LogicalTableScan(table=[[scott, EMP]])\n";
>   verify(rel, expectedPhysical, expectedLogical);
> }
> @Test void test() {
>   // Equivalent SQL:
>   //   SELECT DISTINCT *
>   //   FROM emp
>   final RelBuilder builder = builder();
>   final RelNode rel =
>   builder.scan("EMP")
>   .build();
>   String expectedPhysical = ""
>   + "EnumerableTableScan(table=[[scott, EMP]])\n";
>   String expectedLogical = ""
>   + "LogicalTableScan(table=[[scott, EMP]])\n";
>   verify(rel, expectedPhysical, expectedLogical);
> } {code}
> I think it can be improved to something like
> {code:java}
> Logical Project (DISTINCT)
> +- Logical Scan (Table: employees){code}
>  
>  



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