You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Julian Hyde (Jira)" <ji...@apache.org> on 2019/09/05 03:00:05 UTC

[jira] [Commented] (CALCITE-3313) AssertionError for using an invalid type parameter in REGEXP_REPLACE

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

Julian Hyde commented on CALCITE-3313:
--------------------------------------

Did you know that the first line of that stack, "If you see this, assign operandTypeChecker a value or override this function", is intended for you, the developer. It is a hint how to fix the bug.

> AssertionError for using an invalid type parameter in REGEXP_REPLACE
> --------------------------------------------------------------------
>
>                 Key: CALCITE-3313
>                 URL: https://issues.apache.org/jira/browse/CALCITE-3313
>             Project: Calcite
>          Issue Type: Bug
>            Reporter: Wang Yanlin
>            Priority: Minor
>              Labels: pull-request-available
>          Time Spent: 1h 40m
>  Remaining Estimate: 0h
>
> When using REGEXP_REPLACE function with an invalid type parameter, like this
> {code:sql}
> select regexp_replace(12, 'b', 'X', 1, 3, 'i')
> {code}
>  we got
> {code:java}
> java.lang.AssertionError: If you see this, assign operandTypeChecker a value or override this function
> 	at org.apache.calcite.sql.SqlOperator.getAllowedSignatures(SqlOperator.java:730)
> 	at org.apache.calcite.sql.SqlOperator.getAllowedSignatures(SqlOperator.java:721)
> 	at org.apache.calcite.sql.SqlCallBinding.newValidationSignatureError(SqlCallBinding.java:283)
> 	at org.apache.calcite.sql.type.FamilyOperandTypeChecker.checkSingleOperandType(FamilyOperandTypeChecker.java:96)
> 	at org.apache.calcite.sql.fun.SqlRegexpReplaceFunction.checkOperandTypes(SqlRegexpReplaceFunction.java:56)
> 	at org.apache.calcite.sql.SqlOperator.validateOperands(SqlOperator.java:432)
> 	at org.apache.calcite.sql.SqlFunction.deriveType(SqlFunction.java:298)
> 	at org.apache.calcite.sql.SqlFunction.deriveType(SqlFunction.java:216)
> 	at org.apache.calcite.sql.validate.SqlValidatorImpl$DeriveTypeVisitor.visit(SqlValidatorImpl.java:5626)
> 	at org.apache.calcite.sql.validate.SqlValidatorImpl$DeriveTypeVisitor.visit(SqlValidatorImpl.java:5613)
> 	at org.apache.calcite.sql.SqlCall.accept(SqlCall.java:139)
> 	at org.apache.calcite.sql.validate.SqlValidatorImpl.deriveTypeImpl(SqlValidatorImpl.java:1688)
> 	at org.apache.calcite.sql.validate.SqlValidatorImpl.deriveType(SqlValidatorImpl.java:1673)
> 	at org.apache.calcite.sql.validate.SqlValidatorImpl.expandSelectItem(SqlValidatorImpl.java:476)
> 	at org.apache.calcite.sql.validate.SqlValidatorImpl.validateSelectList(SqlValidatorImpl.java:4104)
> 	at org.apache.calcite.sql.validate.SqlValidatorImpl.validateSelect(SqlValidatorImpl.java:3392)
> 	at org.apache.calcite.sql.validate.SelectNamespace.validateImpl(SelectNamespace.java:60)
> 	at org.apache.calcite.sql.validate.AbstractNamespace.validate(AbstractNamespace.java:84)
> 	at org.apache.calcite.sql.validate.SqlValidatorImpl.validateNamespace(SqlValidatorImpl.java:1005)
> 	at org.apache.calcite.sql.validate.SqlValidatorImpl.validateQuery(SqlValidatorImpl.java:965)
> 	at org.apache.calcite.sql.SqlSelect.validate(SqlSelect.java:216)
> {code}
> Better to give a more detailed message of the allowed signatures.



--
This message was sent by Atlassian Jira
(v8.3.2#803003)