[
https://issues.apache.org/jira/browse/CALCITE-7216?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18024148#comment-18024148
]
Julian Hyde edited comment on CALCITE-7216 at 10/1/25 9:15 PM:
---------------------------------------------------------------
I saw you added a {{{}SqlOperatorTest{}}}, but I'd also add a test to
{{{}SqlValidatorTest{}}}. It's worth making sure that the mechanism for
throwing user errors with the correct position really works.
That string also occurs in {{{}SqlCoalesceOperator{}}}.
And there are a few places where the value from {{inferReturnType}} is passed
to {{{}requireNonNull{}}}, with error messages such as "{{{}inferred array
element type{}}}" (5 places), "{{{}inferred CONCAT element type{}}}" (1 place),
"{{{}inferred BETWEEN element type{}}}" (1 place).
was (Author: julianhyde):
I saw you added a {{{}SqlOperatorTest{}}}, but I'd also add a test to
{{{}SqlValidatorTest{}}}. It's worth making sure that the mechanism for
throwing user errors with the correct position really works.
That string also occurs in {{{}SqlCoalesceOperator{}}}.
And there are a few places where the value from {{inferReturnType}} is passed
to {{{}requireNonNull{}}}, with error messages such as "{{{}inferred array
element type{}}}" (5 places), "{{{}inferred CONCAT element type{}}}" (1 place),
"{{{}inferred BETWEEN element type{}}}"
> SqlOperator.inferReturnType throws the wrong exception on error
> ---------------------------------------------------------------
>
> Key: CALCITE-7216
> URL: https://issues.apache.org/jira/browse/CALCITE-7216
> Project: Calcite
> Issue Type: Bug
> Components: core
> Affects Versions: 1.40.0
> Reporter: Mihai Budiu
> Assignee: Mihai Budiu
> Priority: Minor
> Labels: pull-request-available
> Fix For: 1.41.0
>
>
> This code fragment:
> {code:java}
> RelDataType returnType = returnTypeInference.inferReturnType(opBinding);
> if (returnType == null) {
> throw new IllegalArgumentException("Cannot infer return type for "
> + opBinding.getOperator() + "; operand types: "
> + opBinding.collectOperandTypes());
> }
> {code}
> throws IllegalArgumentException. I think it should throw a
> CalciteContextException.
> Exceptions that are not CalciteExceptions should be used only to signal bugs
> in the compiler, but not illegal input programs.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)