Class JdbcDriver

java.lang.Object
org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.avatica.UnregisteredDriver
org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.jdbc.Driver
org.apache.beam.sdk.extensions.sql.impl.JdbcDriver
All Implemented Interfaces:
Driver

@AutoService(java.sql.Driver.class) public class JdbcDriver extends org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.jdbc.Driver
Calcite JDBC driver with Beam defaults.

Connection URLs have this form:

jdbc:beam:param1=value1;param2=value2;param3=value3

The querystring-style parameters are parsed as PipelineOptions.

  • Nested Class Summary

    Nested classes/interfaces inherited from class org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.avatica.UnregisteredDriver

    org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.avatica.UnregisteredDriver.JdbcVersion
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
     
    static final JdbcDriver
     

    Fields inherited from class org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.avatica.UnregisteredDriver

    factory, handler
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    Configures Beam-specific options and opens a JDBC connection to Calcite.
    connect(CatalogManager catalogManager, PipelineOptions options)
    Like connect(TableProvider, PipelineOptions), but overrides the top-level schema with a CatalogManager.
    connect(TableProvider tableProvider, PipelineOptions options)
    Connects to the driver using standard connect(String, Properties) call, but overrides the initial schema factory.
    protected org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.avatica.AvaticaFactory
     
    protected String
     

    Methods inherited from class org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.jdbc.Driver

    createDriverVersion, createHandler, createMeta, createPrepareFactory, getConnectionProperties, getFactoryClassName

    Methods inherited from class org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.avatica.UnregisteredDriver

    acceptsURL, getDriverVersion, getMajorVersion, getMinorVersion, getParentLogger, getPropertyInfo, instantiateFactory, jdbcCompliant, register

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

    • JdbcDriver

      public JdbcDriver()
  • Method Details

    • createFactory

      protected org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.avatica.AvaticaFactory createFactory()
      Overrides:
      createFactory in class org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.avatica.UnregisteredDriver
    • getConnectStringPrefix

      protected String getConnectStringPrefix()
      Overrides:
      getConnectStringPrefix in class org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.jdbc.Driver
    • connect

      public Connection connect(String url, Properties info) throws SQLException
      Configures Beam-specific options and opens a JDBC connection to Calcite.

      If originalConnectionProperties doesn't have the Beam-specific properties, populates them with defaults (e.g. sets the default schema name to "beam").

      Returns null if url doesn't begin with CONNECT_STRING_PREFIX. This seems to be how JDBC decides whether a driver can handle a request. It tries to connect to it, and if the result is null it picks another driver.

      Returns an instance of JdbcConnection which is a Beam wrapper around CalciteConnection.

      Specified by:
      connect in interface Driver
      Overrides:
      connect in class org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.avatica.UnregisteredDriver
      Throws:
      SQLException
    • connect

      public static JdbcConnection connect(TableProvider tableProvider, PipelineOptions options)
      Connects to the driver using standard connect(String, Properties) call, but overrides the initial schema factory. Default factory would load up all table providers. The one specified here doesn't load any providers. We then override the top-level schema with the tableProvider.

      This is called in tests and BeamSqlEnv, core part of SqlTransform. CLI uses standard JDBC driver registry, and goes through connect(String, Properties) instead, not this path. The CLI ends up using the schema factory that populates the default schema with all table providers it can find. See BeamCalciteSchemaFactory.

    • connect

      public static JdbcConnection connect(CatalogManager catalogManager, PipelineOptions options)
      Like connect(TableProvider, PipelineOptions), but overrides the top-level schema with a CatalogManager.