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

Stamatis Zampetakis commented on CALCITE-6029:
----------------------------------------------

Left some comments under the PR. Overall, I am not sure if it is desired to 
have non-standard (Babel) operators be part of the SqlOperatorTest that is 
meant to be extended and used in downstream projects. Also it may lead to 
duplication as we have other specialized tests for Babel (i.e., BabelTest, 
BabelParserTest).

> SqlOperatorTest cannot test operators that require the Babel parser
> -------------------------------------------------------------------
>
>                 Key: CALCITE-6029
>                 URL: https://issues.apache.org/jira/browse/CALCITE-6029
>             Project: Calcite
>          Issue Type: Bug
>          Components: babel, core
>    Affects Versions: 1.35.0
>            Reporter: Mihai Budiu
>            Priority: Minor
>              Labels: pull-request-available
>
> In SqlOperatorTest one can write code like this:
> {code:java}
> @Test void testDatePart() {
>     final SqlOperatorFixture f = fixture().withLibrary(SqlLibrary.POSTGRESQL)
>         .withParserConfig(p -> 
> p.withParserFactory(SqlBabelParserImpl.FACTORY));
> {code}
> This almost works, but the SqlOperatorTest.check function makes a connection 
> ignores the parserFactory, so parsing will fail:
> {code:java}
>     @Override public void check(SqlTestFactory factory, String query,
>         SqlTester.TypeChecker typeChecker,
>         SqlTester.ParameterChecker parameterChecker,
>         SqlTester.ResultChecker resultChecker) {
>       super.check(factory, query, typeChecker, parameterChecker, 
> resultChecker);
>       final RelDataTypeSystem typeSystem =
>           factory.typeSystemTransform.apply(RelDataTypeSystem.DEFAULT);
>       final ConnectionFactory connectionFactory =
>           factory.connectionFactory
>               .with(CalciteConnectionProperty.TYPE_SYSTEM, uri(FIELD));  /// 
> NO PARSER_FACTORY HERE
> {code}
> I am trying to fix this by adding a PARSER_FACTORY argument to the 
> connection, but then I get a class loader error from 
> AvaticaUtils.instantiatePlugin, which, in this case, cannot find the 
> SqlBabelParserImpl#FACTORY in the classpath.
> I would appreciate some help solving this last bit.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to