[
https://issues.apache.org/jira/browse/CALCITE-4522?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17296240#comment-17296240
]
Julian Hyde commented on CALCITE-4522:
--------------------------------------
Thanks, that's much better.
* Can you improve the javadoc for {{mLogN}}. Saying it computes mlogn is
circular.
* Remove {{Sort.getOffsetValue}}. Although it's convenient, there is a lot of
code that uses {{RexLiteral.intValue}}, so let's stick with the standard.
* Need a test. Modify {{RelMetadataTest.testRowCountSortLimit()}}? Refactor so
that {{checkRowCount(sql, 10d, 0D, 10d)}} becomes something like
{{sql(sql).assertRowCount(10d, 0D, 10d).assertCpu(5)}}.
* I don't think your formula for CPU in a LIMIT or LIMIT+OFFSET query is
correct. It reads only the first LIMIT+OFFSET rows.
> Sort operator returns the same cpu cost no matter the RelCollation is empty
> or not
> ----------------------------------------------------------------------------------
>
> Key: CALCITE-4522
> URL: https://issues.apache.org/jira/browse/CALCITE-4522
> Project: Calcite
> Issue Type: Improvement
> Components: core
> Reporter: hqx
> Priority: Minor
>
> The old method to compute the cost of sort has some problem.
> # when there is no need to sort, it still to compute the cpu cost of sort.
> # use n * log\(n) * rowBytes to estimate the cpu cost may be inaccurate,
> where n means the output row count of the sort operator, and rowBytes means
> the average bytes of one row .
> Instead, I give follow suggestion.
> # the cpu cost is zero if there is no need to sort.
> # use m * log\(n)* rowBytes to compute the cpu cost, where m is the sum of
> offset + limit and n means input row count.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)