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 02:59:00 UTC
[jira] [Updated] (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 updated CALCITE-2982:
----------------------------------
Summary: SqlItemOperator should throw understandable exception message for incorrect operand type (was: SqlItemOperator should throw understandable exception message for incorrect field type)
> 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: 1h 50m
> 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)