You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Hongze Zhang (JIRA)" <ji...@apache.org> on 2019/04/26 03:41:00 UTC

[jira] [Resolved] (CALCITE-2982) SqlItemOperator should throw understandable exception message for incorrect operand type

     [ https://issues.apache.org/jira/browse/CALCITE-2982?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Hongze Zhang resolved CALCITE-2982.
-----------------------------------
    Resolution: Fixed

Fixed in [eed664de8c45af1423d692af88cc98395adcb072|https://gitbox.apache.org/repos/asf?p=calcite.git;a=commit;h=eed664de8c45af1423d692af88cc98395adcb072]. Thanks, [~pzw2018]!

> SqlItemOperator should throw understandable exception message for incorrect operand type
> ----------------------------------------------------------------------------------------
>
>                 Key: CALCITE-2982
>                 URL: https://issues.apache.org/jira/browse/CALCITE-2982
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>            Reporter: pengzhiwei
>            Assignee: pengzhiwei
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 1.20.0
>
>          Time Spent: 2h
>  Remaining Estimate: 0h
>
> In the following sql:
> {code:java}
> select name[0] from dept
> {code}
> _name_ is a field of _VARCHAR_ type, the follow exception message is thrown out:
> {code:java}
> java.lang.AssertionError: VARCHAR
> at org.apache.calcite.sql.fun.SqlItemOperator.getChecker(SqlItemOperator.java:109)
> at org.apache.calcite.sql.fun.SqlItemOperator.checkOperandTypes(SqlItemOperator.java:91)
> at org.apache.calcite.sql.SqlOperator.validateOperands(SqlOperator.java:432)
> at org.apache.calcite.sql.SqlOperator.deriveType(SqlOperator.java:516)
> at org.apache.calcite.sql.validate.SqlValidatorImpl$DeriveTypeVisitor.visit(SqlValidatorImpl.java:5607)
> at org.apache.calcite.sql.validate.SqlValidatorImpl$DeriveTypeVisitor.visit(SqlValidatorImpl.java:5594)
> at org.apache.calcite.sql.SqlCall.accept(SqlCall.java:139)
> {code}
> The exception message is hard to understand  for user. I think a message like "Cannot apply item opeator to VARCHAR type for filed "name"  at line xx column xx " is more friendly to the user.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)