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

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

Regarding metadata validation.

Whether the validation is done by the metadata provider or consumer or by the 
framework is a matter of taste. But clearly someone has to do it!

validateResult is the framework trying to apply a light sanity check. But 
consumers should also do some validation: I think it would be foolish for a 
consumer to divide by a value before they've checked that it is not null and 
greater than zero. 

It would seem to me that if a method has very few providers and a lot of 
consumers then it would be better to validate in the providers; and vice versa. 
I don't feel strongly about this. But if you decide to change the policy just 
make sure do it throughout calcite and change the documentation.

> 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