[
https://issues.apache.org/jira/browse/CALCITE-987?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15030241#comment-15030241
]
Julian Hyde commented on CALCITE-987:
-------------------------------------
I don't think the default implementation of maxRowCount should call
{{getRows}}. The default implementation should return Double.POSITIVE_INFINITY.
We want to be able to remove limits based on maxRowCount, so it needs to be a
safe bound. If getRows returns 999 it is not safe to remove a limit 1000,
because getRows is allowed to be wrong. But if maxRowCount returns 999 we can
safely remove a limit 1000.
> Push limit 0 will result in an infinite loop
> --------------------------------------------
>
> Key: CALCITE-987
> URL: https://issues.apache.org/jira/browse/CALCITE-987
> Project: Calcite
> Issue Type: Bug
> Reporter: Pengcheng Xiong
> Assignee: Pengcheng Xiong
> Attachments: CALCITE-987.01.patch, CALCITE-987.02.patch,
> CALCITE-987.03.patch
>
>
> We use "checkInputForCollationAndLimit" in RelMdUtil.java to check the input
> #rows. However, it calls RelMetadataQuery.getRowCount which will validate the
> #rows. The validation will change #row=0 to #row=1. This will result in an
> infinite loop to push limit. The affected rules include
> SortUnionTransposeRule and any Sort***TransposeRules that call
> checkInputForCollationAndLimit.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)