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

Julian Hyde commented on CALCITE-6622:
--------------------------------------

Not sure I agree. Code in {{class SqlFunctions}} has only one goal - to be a 
target for generated code. It is not necessary for the functions to obey usual 
Java conventions like throwing particular subclasses of Throwable. Nor is it 
necessary for there to be a 1-1 correspondence between SQL functions and 
methods in that class. 

It *is* necessary that when an error happens during query processing we get a 
good SQL error message. The mechanism for generating that error is up for 
discussion.

> Negative logarithms should throw an ArithmeticException, not an 
> IllegalArgumentException
> ----------------------------------------------------------------------------------------
>
>                 Key: CALCITE-6622
>                 URL: https://issues.apache.org/jira/browse/CALCITE-6622
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 1.38.0
>            Reporter: Claude Brisson
>            Priority: Minor
>
> Since |CALCITE-6312], {{log}} functions in {{SqlFunctions}} do throw an 
> {{{}IllegalArgumentException{}}}, instead as an {{ArithmeticException}} as 
> before.
> In terms of errors categorization, it is more precise to revert to the former 
> behavior, as {{IllegalArgumentException}} is more suited to structural errors 
> which do not depend on the actual values, whereas we would expect negative 
> logarithms to throw the same kind of error as an integer division by zero for 
> instance.
> An engine implementation could choose to have a different behaviors depending 
> on the thrown errors, for instance to just abort the constants reduction for 
> an illegal argument versus letting the arithmetic exception propagate to 
> alert the user.
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to