Details
-
Bug
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
1.37.0
Description
The following test added to CalciteSqlOperatorTest will cause a ClassCastException:
@Test void testLibraries() { SqlOperatorFixture sqlOperatorFixture = fixture(); final SqlOperatorFixture f = sqlOperatorFixture.withOperatorTable( SqlLibraryOperatorTableFactory.INSTANCE .getOperatorTable( SqlLibrary.STANDARD, SqlLibrary.MYSQL, SqlLibrary.POSTGRESQL )); f.checkScalar("substr('a', 1, 2)", "a", "VARCHAR(1) NOT NULL"); }
Here is the top of the stack trace:
class org.apache.calcite.sql.type.FamilyOperandTypeChecker cannot be cast to class org.apache.calcite.sql.type.SqlOperandMetadata (org.apache.calcite.sql.type.FamilyOperandTypeChecker and org.apache.calcite.sql.type.SqlOperandMetadata are in unnamed module of loader 'app') java.lang.ClassCastException: class org.apache.calcite.sql.type.FamilyOperandTypeChecker cannot be cast to class org.apache.calcite.sql.type.SqlOperandMetadata (org.apache.calcite.sql.type.FamilyOperandTypeChecker and org.apache.calcite.sql.type.SqlOperandMetadata are in unnamed module of loader 'app') at org.apache.calcite.sql.validate.implicit.TypeCoercionImpl.userDefinedFunctionCoercion(TypeCoercionImpl.java:601) at org.apache.calcite.sql.SqlFunction.deriveType(SqlFunction.java:313) at org.apache.calcite.sql.SqlFunction.deriveType(SqlFunction.java:231) at org.apache.calcite.sql.validate.SqlValidatorImpl$DeriveTypeVisitor.visit(SqlValidatorImpl.java:6789) at org.apache.calcite.sql.validate.SqlValidatorImpl$DeriveTypeVisitor.visit(SqlValidatorImpl.java:6776) at org.apache.calcite.sql.SqlCall.accept(SqlCall.java:167) at org.apache.calcite.sql.validate.SqlValidatorImpl.deriveTypeImpl(SqlValidatorImpl.java:2006) at org.apache.calcite.sql.validate.SqlValidatorImpl.deriveType(SqlValidatorImpl.java:1993) at org.apache.calcite.sql.SqlNode.validateExpr(SqlNode.java:276) at org.apache.calcite.sql.SqlOperator.validateCall(SqlOperator.java:474) at org.apache.calcite.sql.validate.SqlValidatorImpl.validateCall(SqlValidatorImpl.java:6446) at org.apache.calcite.sql.SqlCall.validate(SqlCall.java:144) at org.apache.calcite.sql.SqlNode.validateExpr(SqlNode.java:275) at org.apache.calcite.sql.SqlOperator.validateCall(SqlOperator.java:474) at org.apache.calcite.sql.validate.SqlValidatorImpl.validateCall(SqlValidatorImpl.java:6446) at org.apache.calcite.sql.SqlCall.validate(SqlCall.java:144) at org.apache.calcite.sql.validate.SqlValidatorImpl.validateScopedExpression(SqlValidatorImpl.java:1143) at org.apache.calcite.sql.validate.SqlValidatorImpl.validate(SqlValidatorImpl.java:849) at org.apache.calcite.sql.test.AbstractSqlTester.parseAndValidate(AbstractSqlTester.java:162) at org.apache.calcite.sql.test.AbstractSqlTester.validateAndThen(AbstractSqlTester.java:250)
Calcite behaves correctly if either the MYSQL or the POSTGRES libraries are not supplied.
Attachments
Issue Links
- links to