Class JdbcDriver
- java.lang.Object
-
- org.apache.beam.vendor.calcite.v1_40_0.org.apache.calcite.avatica.UnregisteredDriver
-
- org.apache.beam.vendor.calcite.v1_40_0.org.apache.calcite.jdbc.Driver
-
- org.apache.beam.sdk.extensions.sql.impl.JdbcDriver
-
- All Implemented Interfaces:
java.sql.Driver
@AutoService(java.sql.Driver.class) public class JdbcDriver extends org.apache.beam.vendor.calcite.v1_40_0.org.apache.calcite.jdbc.DriverCalcite JDBC driver with Beam defaults.Connection URLs have this form:
jdbc:beam:param1=value1;param2=value2;param3=value3The querystring-style parameters are parsed as
PipelineOptions.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringCONNECT_STRING_PREFIXstatic JdbcDriverINSTANCE
-
Constructor Summary
Constructors Constructor Description JdbcDriver()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description @Nullable java.sql.Connectionconnect(java.lang.String url, java.util.Properties info)Configures Beam-specific options and opens a JDBC connection to Calcite.static JdbcConnectionconnect(CatalogManager catalogManager, org.apache.beam.sdk.options.PipelineOptions options)Likeconnect(TableProvider, PipelineOptions), but overrides the top-level schema with aCatalogManager.static JdbcConnectionconnect(TableProvider tableProvider, org.apache.beam.sdk.options.PipelineOptions options)Connects to the driver using standardconnect(String, Properties)call, but overrides the initial schema factory.protected org.apache.beam.vendor.calcite.v1_40_0.org.apache.calcite.avatica.AvaticaFactorycreateFactory()protected java.lang.StringgetConnectStringPrefix()-
Methods inherited from class org.apache.beam.vendor.calcite.v1_40_0.org.apache.calcite.jdbc.Driver
createDriverVersion, createHandler, createMeta, createPrepare, createPrepareFactory, getConnectionProperties, getFactoryClassName, withPrepareFactory
-
-
-
-
Field Detail
-
INSTANCE
public static final JdbcDriver INSTANCE
-
CONNECT_STRING_PREFIX
public static final java.lang.String CONNECT_STRING_PREFIX
- See Also:
- Constant Field Values
-
-
Method Detail
-
createFactory
protected org.apache.beam.vendor.calcite.v1_40_0.org.apache.calcite.avatica.AvaticaFactory createFactory()
- Overrides:
createFactoryin classorg.apache.beam.vendor.calcite.v1_40_0.org.apache.calcite.avatica.UnregisteredDriver
-
getConnectStringPrefix
protected java.lang.String getConnectStringPrefix()
- Overrides:
getConnectStringPrefixin classorg.apache.beam.vendor.calcite.v1_40_0.org.apache.calcite.jdbc.Driver
-
connect
public @Nullable java.sql.Connection connect(java.lang.String url, java.util.Properties info) throws java.sql.SQLExceptionConfigures Beam-specific options and opens a JDBC connection to Calcite.If
originalConnectionPropertiesdoesn't have the Beam-specific properties, populates them with defaults (e.g. sets the default schema name to "beam").Returns null if
urldoesn't begin withCONNECT_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
JdbcConnectionwhich is a Beam wrapper aroundCalciteConnection.- Specified by:
connectin interfacejava.sql.Driver- Overrides:
connectin classorg.apache.beam.vendor.calcite.v1_40_0.org.apache.calcite.avatica.UnregisteredDriver- Throws:
java.sql.SQLException
-
connect
public static JdbcConnection connect(TableProvider tableProvider, org.apache.beam.sdk.options.PipelineOptions options)
Connects to the driver using standardconnect(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 thetableProvider.This is called in tests and
BeamSqlEnv, core part ofSqlTransform. CLI uses standard JDBC driver registry, and goes throughconnect(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. SeeBeamCalciteSchemaFactory.
-
connect
public static JdbcConnection connect(CatalogManager catalogManager, org.apache.beam.sdk.options.PipelineOptions options)
Likeconnect(TableProvider, PipelineOptions), but overrides the top-level schema with aCatalogManager.
-
-