[
https://issues.apache.org/jira/browse/CALCITE-6518?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Mihai Budiu resolved CALCITE-6518.
----------------------------------
Fix Version/s: 1.38.0
Resolution: Fixed
Fixed in
https://github.com/apache/calcite/commit/b60598b47e86b2b21639d193b374f1d6d4dcd139
> ClassCastException during validation when loading multiple libraries
> --------------------------------------------------------------------
>
> Key: CALCITE-6518
> URL: https://issues.apache.org/jira/browse/CALCITE-6518
> Project: Calcite
> Issue Type: Bug
> Components: core
> Affects Versions: 1.37.0
> Reporter: Mihai Budiu
> Priority: Minor
> Labels: pull-request-available
> Fix For: 1.38.0
>
>
> The following test added to CalciteSqlOperatorTest will cause a
> ClassCastException:
> {code:java}
> @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");
> }
> {code}
> Here is the top of the stack trace:
> {code}
> 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)
> {code}
> Calcite behaves correctly if either the MYSQL or the POSTGRES libraries are
> not supplied.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)