Skip to content

Introduce ProxyingMetadataHandlerProvider to decouple JaninoRelMetadataProvider from SQL Federation#34980

Closed
linghengqian wants to merge 1 commit intoapache:masterfrom
linghengqian:opengauss
Closed

Introduce ProxyingMetadataHandlerProvider to decouple JaninoRelMetadataProvider from SQL Federation#34980
linghengqian wants to merge 1 commit intoapache:masterfrom
linghengqian:opengauss

Conversation

@linghengqian
Copy link
Member

@linghengqian linghengqian commented Mar 13, 2025

Fixes #33139 .

Changes proposed in this pull request:

JUnit Jupiter:OpenGaussTest:assertShardingInLocalTransactions()
    MethodSource [className = 'org.apache.shardingsphere.test.natived.proxy.databases.OpenGaussTest', methodName = 'assertShardingInLocalTransactions', methodParameterTypes = '']
    => org.opengauss.util.PSQLException: [127.0.0.1:37032/127.0.0.1:35543] ERROR: SQL federation does not support SQL 'select version()'.
More details: java.lang.RuntimeException: Error while compiling generated Java code:
public org.apache.calcite.linq4j.Enumerable bind(final org.apache.calcite.DataContext root) {
  final org.apache.calcite.linq4j.Enumerable _inputEnumerable = org.apache.calcite.linq4j.Linq4j.asEnumerable(new Integer[] {
    0});
  return new org.apache.calcite.linq4j.AbstractEnumerable(){
      public org.apache.calcite.linq4j.Enumerator enumerator() {
        return new org.apache.calcite.linq4j.Enumerator(){
            public final org.apache.calcite.linq4j.Enumerator inputEnumerator = _inputEnumerable.enumerator();
            public void reset() {
              inputEnumerator.reset();
            }

            public boolean moveNext() {
              return inputEnumerator.moveNext();
            }

            public void close() {
              inputEnumerator.close();
            }

            public Object current() {
              return org.apache.shardingsphere.sqlfederation.optimizer.function.opengauss.impl.OpenGaussSystemFunction.version();
            }

          };
      }

    };
}


public Class getElementType() {
  return java.lang.String.class;
}



       org.opengauss.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2901)
       org.opengauss.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2630)
       org.opengauss.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:362)
       org.opengauss.core.SetupQueryRunner.run(SetupQueryRunner.java:53)
       org.opengauss.core.v3.ConnectionFactoryImpl.queryGaussdbVersion(ConnectionFactoryImpl.java:875)
       org.opengauss.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:331)
       org.opengauss.core.ConnectionFactory.openConnection(ConnectionFactory.java:53)
       org.opengauss.jdbc.PgConnection.<init>(PgConnection.java:256)
       org.opengauss.Driver.makeConnection(Driver.java:561)
       org.opengauss.Driver.connect(Driver.java:314)
       [...]

Before committing this PR, I'm sure that I have checked the following options:

  • My code follows the code of conduct of this project.
  • I have self-reviewed the commit code.
  • I have (or in comment I request) added corresponding labels for the pull request.
  • I have passed maven check locally : ./mvnw clean install -B -T1C -Dmaven.javadoc.skip -Dmaven.jacoco.skip -e.
  • I have made corresponding changes to the documentation.
  • I have added corresponding unit tests for my changes.
  • I have updated the Release Notes of the current development version. For more details, see Update Release Note

Copy link
Member Author

@linghengqian linghengqian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would not be a reasonable way forward, since calcite would still be stuck with its use of janino.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant