[ https://issues.apache.org/jira/browse/CALCITE-2982?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
pengzhiwei updated CALCITE-2982: -------------------------------- Summary: SqlItemOperator should throw understandable exception message for incorrect field type (was: SqlItemOpeator should throw understandable exception message for incorrect field type) > SqlItemOperator should throw understandable exception message for incorrect > field 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 > Fix For: 1.20.0 > > > In the follow 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)