You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@calcite.apache.org by GitBox <gi...@apache.org> on 2021/03/15 06:06:45 UTC

[GitHub] [calcite] hqx871 removed a comment on pull request #2363: [CALCITE-4522] Sort cost should account for the number of columns in collation

hqx871 removed a comment on pull request #2363:
URL: https://github.com/apache/calcite/pull/2363#issuecomment-795271299


   hi, 
   I found duplicate code in EnumerableLimitSort. Shall I close the pr or change the EnumerableLimitSort?. code as follow
   ```
   @Override public @Nullable RelOptCost computeSelfCost(RelOptPlanner planner,
         RelMetadataQuery mq) {
       final double rowCount = mq.getRowCount(this.input).doubleValue();
       double toSort = getValue(this.fetch, rowCount);
       if (this.offset != null) {
         toSort += getValue(this.offset, rowCount);
       }
       // we need to sort at most rowCount rows
       toSort = Math.min(rowCount, toSort);
   
       // we need to process rowCount rows, and for every row
       // we search the key in a TreeMap with at most toSort entries
       final double lookup = Math.max(1., Math.log(toSort));
       final double bytesPerRow = this.getRowType().getFieldCount() * 4.;
       final double cpu = (rowCount * lookup) * bytesPerRow;
   
       RelOptCost cost = planner.getCostFactory().makeCost(rowCount, cpu, 0);
       return cost;
     }
   ```


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org