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

Jinfeng Ni commented on CALCITE-606:
------------------------------------

Re 2.  In the testcase, collations are supposedly to kick in when logical SCAN 
is converted into physical SCAN.  collations are not know in logical SCAN phase.

{code}
Line :299
      call.transformTo(new PhysTable(rel.getCluster()));

Line 383
    public PhysTable(RelOptCluster cluster) {
      super(cluster, cluster.traitSet().replace(PHYSICAL).replace(COLLATION));
{code}

I think the assumption of knowing traits only in physical stage makes senses :  
in logical plan, we have 

{code}
           Aggregate
              \
              PROJECT
                 \
                SCAN
{code}

We know the collation of SCAN only In physical stage. If the table has the 
required collation, no SORT is required. If no collation exists, Calcite either 
generates a plan by inserting SORT and do a SORT-based aggregation, or 
generates a plan which uses hash-based aggregation.   In that way, the logical 
aggregate could be converted into SORT-based AGG or hash-based AGG, depending 
on the collation of SCAN known in physical stage.

PS.  I also have getStatistics, and use unwrap(). The only change I made is to 
provide an empty collation list to logical SCAN.

{code}
       @Override public Statistic getStatistic() {
          return Statistics.of(100d, ImmutableList.<ImmutableBitSet>of(),
              ImmutableList.<RelCollation>of());    // empty collation list for 
logical SCAN. 
              // ImmutableList.of(COLLATION));
 {code}



> Fix Trait Propagation and add test case
> ---------------------------------------
>
>                 Key: CALCITE-606
>                 URL: https://issues.apache.org/jira/browse/CALCITE-606
>             Project: Calcite
>          Issue Type: Bug
>            Reporter: Jacques Nadeau
>            Assignee: Jacques Nadeau
>             Fix For: next
>
>
> Per my email to the dev list, it seems like we need to have a Trait 
> propagation test case.  Some things also seem broken.  Dev list email: 
> http://mail-archives.apache.org/mod_mbox/incubator-calcite-dev/201503.mbox/browser



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to