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 00:58:40 UTC

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

hqx871 commented on pull request #2363:
URL: https://github.com/apache/calcite/pull/2363#issuecomment-799021206


   I made a little change as julianhyde suggested at https://issues.apache.org/jira/browse/CALCITE-4522
   - If fetch is zero, cpu cost is zero; otherwise,
   
   - if there are no sort keys, cost is min(fetch + offset, inputRowCount) * bytesPerRow; otherwise
   
   - cost is inputRowCount * log(min(fetch + offset, inputRowCount)) * bytesPerRow.
   
   a method Util.nLogM(n, m) would be useful, where n is the number of input rows, and m is the number of active rows (and therefore determines the number of times each row is compared and/or moved). We would call it as follows: Util.nLogM(inputRowCount, fetch + offset)). It would make sure that m is at least e (and therefore log is at least 1), and make sure that m is no greater than n.


----------------------------------------------------------------
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