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

Julian Hyde commented on CALCITE-4156:
--------------------------------------

I'm sorry you had a problem that was tough to debug. I've been there too, and 
it sounds like a nightmare.

I can see that changing the assert to an 'if ... throw' made things easier for 
you. I just want to state for the record that the assert was not the cause of 
this problem.

Most important, I want to prevent a witch-hunt that would drive all asserts out 
our code. If we force developers to write something less concise and more 
expensive at run time, they will document fewer of their invariants.

> ReflectiveRelMetadataProvider constructor should throw an exception (instead 
> of assertion) when called with an empty map
> ------------------------------------------------------------------------------------------------------------------------
>
>                 Key: CALCITE-4156
>                 URL: https://issues.apache.org/jira/browse/CALCITE-4156
>             Project: Calcite
>          Issue Type: Task
>          Components: core
>            Reporter: Ruben Q L
>            Assignee: Ruben Q L
>            Priority: Minor
>              Labels: pull-request-available
>             Fix For: 1.25.0
>
>          Time Spent: 1h 50m
>  Remaining Estimate: 0h
>
> ReflectiveRelMetadataProvider's constructor verifies that it is not created 
> with an empty map, using an assertion. However, this is not the most reliable 
> way of verifying this situation, since assertions can be deactivated. In such 
> scenario, we could silently end up having an invalid 
> ReflectiveRelMetadataProvider, with no actual methods attached.
> Also, since the map is private and has no getter, there is no way for a 
> caller module to verify this situation on its side.
> For this reason, it is proposed a minor change: replace the assertion with an 
> IllegalArgumentException, which will work in 100% of the cases and will 
> always prevent constructing an invalid ReflectiveRelMetadataProvider.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to