You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@calcite.apache.org by "Mihai Budiu (Jira)" <ji...@apache.org> on 2024/08/06 17:41:00 UTC
[jira] [Created] (CALCITE-6518) ClassCastException during validation when loading multiple libraries
Mihai Budiu created CALCITE-6518:
------------------------------------
Summary: 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
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)