Wang Yanlin created CALCITE-3313:
------------------------------------

             Summary: AssertionError for an invalid type when using 
REGEXP_REPLACE
                 Key: CALCITE-3313
                 URL: https://issues.apache.org/jira/browse/CALCITE-3313
             Project: Calcite
          Issue Type: Bug
            Reporter: Wang Yanlin


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)

Reply via email to