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

Julian Hyde commented on CALCITE-987:
-------------------------------------

Now regarding {{limit 0}} specifically. We knew it was a shortcut when we used 
*estimated* row count to avoid pushing limit twice. I like the idea that the 
estimated row count should never be less than one -- it seems appropriate for 
the vast majority of the things people use estimated row count for.

I think we should add a new kind of metadata, maximum row count. Use that, 
rather than estimated row count, to make sure that we don't push limit twice.

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

Reply via email to