[jira] [Commented] (CALCITE-6029) SqlOperatorTest cannot test operators that require the Babel parser
[ 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)
[jira] [Commented] (CALCITE-6029) SqlOperatorTest cannot test operators that require the Babel parser
[ https://issues.apache.org/jira/browse/CALCITE-6029?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17769916#comment-17769916 ] Julian Hyde commented on CALCITE-6029: -- SqlOperatorTest runs in a gradle module (core? testkit?) that does not have access to babel. To get around the class-path problem, you will need to run a variant of SqlOperatorTest in the babel module. > 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)
[jira] [Commented] (CALCITE-6029) SqlOperatorTest cannot test operators that require the Babel parser
[ https://issues.apache.org/jira/browse/CALCITE-6029?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17769858#comment-17769858 ] Mihai Budiu commented on CALCITE-6029: -- I want to write a test for an operator which can only be parsed with the Babel parser. I don't want a parser test, I want an operator test. In particular, I was trying to test the DATE_PART function. Loading the Postgres library is not enough, you also need the Babel parser for that. But I have discovered in this process 2 bugs, this one and [CALCITE-6030], which I have fixed separately. But leaving this aside, I think that it's a bug that you can specify the parserConfig in the test fixture and the parserConfig is ignored by the test connection created by the tester. See the PR attached, which fixes this bug. With this change one should be able to test any operator using the SqlOperatorTest and its fixtures. > 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)
[jira] [Commented] (CALCITE-6029) SqlOperatorTest cannot test operators that require the Babel parser
[ https://issues.apache.org/jira/browse/CALCITE-6029?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17769857#comment-17769857 ] Ran Tao commented on CALCITE-6029: -- hi [~mbudiu] I'm wondering why you test DATE_PART by using BabelParserFactory? why don't use {code:java} @Test void testDatePart() { final SqlOperatorFixture f = fixture().withLibrary(SqlLibrary.POSTGRESQL);{code} I think if we test a Function in SqlOperatorTest, just withLibrary is enough. Just like other Spark/PG functions. If you decide to test some special syntax for postgresql, i think you can test it in babel module, not testkit module. If i'm wrong, pls correct me. > 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)
[jira] [Commented] (CALCITE-6029) SqlOperatorTest cannot test operators that require the Babel parser
[ https://issues.apache.org/jira/browse/CALCITE-6029?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17769849#comment-17769849 ] Mihai Budiu commented on CALCITE-6029: -- I think I have figured out the classloader problem. I will submit a fix for this bug. > 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 > > 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)
[jira] [Commented] (CALCITE-6029) SqlOperatorTest cannot test operators that require the Babel parser
[ https://issues.apache.org/jira/browse/CALCITE-6029?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17769847#comment-17769847 ] Mihai Budiu commented on CALCITE-6029: -- I have added this to build.gradle.kts for testkit: {code} dependencies { api(project(":core")) api(project(":babel")) // added this {code} but it's not enough. > 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 > > 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)