Class CalciteConnectionImpl
- java.lang.Object
-
- org.apache.calcite.avatica.AvaticaConnection
-
- org.apache.calcite.jdbc.CalciteConnectionImpl
-
- All Implemented Interfaces:
java.lang.AutoCloseable
,java.sql.Connection
,java.sql.Wrapper
,CalciteConnection
,QueryProvider
- Direct Known Subclasses:
CalciteJdbc41Factory.CalciteJdbc41Connection
abstract class CalciteConnectionImpl extends org.apache.calcite.avatica.AvaticaConnection implements CalciteConnection, QueryProvider
Implementation of JDBC connection in the Calcite engine.Abstract to allow newer versions of JDBC to add methods.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static class
CalciteConnectionImpl.CalciteQueryable<T>
Implementation of Queryable.private static class
CalciteConnectionImpl.CalciteServerImpl
Implementation of Server.(package private) static class
CalciteConnectionImpl.CalciteServerStatementImpl
Implementation ofCalciteServerStatement
.(package private) static class
CalciteConnectionImpl.ContextImpl
Implementation of Context.(package private) static class
CalciteConnectionImpl.DataContextImpl
Implementation of DataContext.(package private) static class
CalciteConnectionImpl.RootSchema
Schema that has no parents.private static class
CalciteConnectionImpl.SlimDataContext
Implementation ofDataContext
that has few variables and isSerializable
.
-
Field Summary
Fields Modifier and Type Field Description (package private) Function0<CalcitePrepare>
prepareFactory
(package private) CalciteSchema
rootSchema
(package private) CalciteServer
server
(package private) static org.apache.calcite.avatica.AvaticaConnection.Trojan
TROJAN
JavaTypeFactory
typeFactory
-
Constructor Summary
Constructors Modifier Constructor Description protected
CalciteConnectionImpl(Driver driver, org.apache.calcite.avatica.AvaticaFactory factory, java.lang.String url, java.util.Properties info, CalciteSchema rootSchema, JavaTypeFactory typeFactory)
Creates a CalciteConnectionImpl.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CalciteConnectionConfig
config()
DataContext
createDataContext(java.util.Map<java.lang.String,java.lang.Object> parameterValues, CalciteSchema rootSchema)
CalcitePrepare.Context
createPrepareContext()
Creates a context for preparing a statement for execution.<T> Queryable<T>
createQuery(Expression expression, java.lang.Class<T> rowType)
Constructs aQueryable
object that can evaluate the query represented by a specified expression tree.<T> Queryable<T>
createQuery(Expression expression, java.lang.reflect.Type rowType)
Constructs aQueryable
object that can evaluate the query represented by a specified expression tree.CalciteStatement
createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability)
<T> Enumerable<T>
enumerable(org.apache.calcite.avatica.Meta.StatementHandle handle, CalcitePrepare.CalciteSignature<T> signature)
<T> T
execute(Expression expression, java.lang.Class<T> type)
Executes the query represented by a specified expression tree.<T> T
execute(Expression expression, java.lang.reflect.Type type)
Executes the query represented by a specified expression tree.<T> Enumerator<T>
executeQuery(Queryable<T> queryable)
Executes a queryable, and returns an enumerator over the rows that it yields.java.util.concurrent.atomic.AtomicBoolean
getCancelFlag(org.apache.calcite.avatica.Meta.StatementHandle handle)
(package private) org.apache.calcite.avatica.UnregisteredDriver
getDriver()
(package private) org.apache.calcite.avatica.AvaticaFactory
getFactory()
java.util.Properties
getProperties()
Returns an instance of the connection properties.SchemaPlus
getRootSchema()
Returns the root schema.JavaTypeFactory
getTypeFactory()
Returns the type factory.(package private) void
init()
Called after the constructor has completed and the model has been loaded.(package private) CalciteMetaImpl
meta()
(package private) <T> CalcitePrepare.CalciteSignature<T>
parseQuery(CalcitePrepare.Query<T> query, CalcitePrepare.Context prepareContext, long maxRowCount)
CalcitePreparedStatement
prepareStatement(java.lang.String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability)
private CalcitePreparedStatement
prepareStatement_(CalcitePrepare.Query<?> query, int resultSetType, int resultSetConcurrency, int resultSetHoldability)
<T> T
unwrap(java.lang.Class<T> iface)
-
Methods inherited from class org.apache.calcite.avatica.AvaticaConnection
abort, checkOpen, clearWarnings, close, commit, createArrayOf, createBlob, createClob, createNClob, createResultSet, createSQLXML, createStatement, createStatement, createStruct, createTrojan, executeBatchUpdateInternal, executeQueryInternal, getAutoCommit, getCatalog, getClientInfo, getClientInfo, getHoldability, getKerberosConnection, getMetaData, getNetworkTimeout, getSchema, getService, getTimeZone, getTransactionIsolation, getTypeMap, getWarnings, invokeWithRetries, isClosed, isReadOnly, isValid, isWrapperFor, lookupStatement, nativeSQL, openConnection, prepareAndExecuteInternal, prepareAndUpdateBatch, prepareCall, prepareCall, prepareCall, prepareStatement, prepareStatement, prepareStatement, prepareStatement, prepareStatement, releaseSavepoint, rollback, rollback, setAutoCommit, setCatalog, setClientInfo, setClientInfo, setHoldability, setKerberosConnection, setNetworkTimeout, setReadOnly, setSavepoint, setSavepoint, setSchema, setService, setTransactionIsolation, setTypeMap
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.calcite.jdbc.CalciteConnection
getSchema, setSchema
-
Methods inherited from interface java.sql.Connection
abort, beginRequest, clearWarnings, close, commit, createArrayOf, createBlob, createClob, createNClob, createSQLXML, createStatement, createStatement, createStruct, endRequest, getAutoCommit, getCatalog, getClientInfo, getClientInfo, getHoldability, getMetaData, getNetworkTimeout, getTransactionIsolation, getTypeMap, getWarnings, isClosed, isReadOnly, isValid, nativeSQL, prepareCall, prepareCall, prepareCall, prepareStatement, prepareStatement, prepareStatement, prepareStatement, prepareStatement, releaseSavepoint, rollback, rollback, setAutoCommit, setCatalog, setClientInfo, setClientInfo, setHoldability, setNetworkTimeout, setReadOnly, setSavepoint, setSavepoint, setShardingKey, setShardingKey, setShardingKeyIfValid, setShardingKeyIfValid, setTransactionIsolation, setTypeMap
-
-
-
-
Field Detail
-
typeFactory
public final JavaTypeFactory typeFactory
-
rootSchema
final CalciteSchema rootSchema
-
prepareFactory
final Function0<CalcitePrepare> prepareFactory
-
server
final CalciteServer server
-
TROJAN
static final org.apache.calcite.avatica.AvaticaConnection.Trojan TROJAN
-
-
Constructor Detail
-
CalciteConnectionImpl
protected CalciteConnectionImpl(Driver driver, org.apache.calcite.avatica.AvaticaFactory factory, java.lang.String url, java.util.Properties info, CalciteSchema rootSchema, JavaTypeFactory typeFactory)
Creates a CalciteConnectionImpl.Not public; method is called only from the driver.
- Parameters:
driver
- Driverfactory
- Factory for JDBC objectsurl
- Server URLinfo
- Other connection propertiesrootSchema
- Root schema, or nulltypeFactory
- Type factory, or null
-
-
Method Detail
-
meta
CalciteMetaImpl meta()
-
config
public CalciteConnectionConfig config()
- Specified by:
config
in interfaceCalciteConnection
- Overrides:
config
in classorg.apache.calcite.avatica.AvaticaConnection
-
createPrepareContext
public CalcitePrepare.Context createPrepareContext()
Description copied from interface:CalciteConnection
Creates a context for preparing a statement for execution.- Specified by:
createPrepareContext
in interfaceCalciteConnection
-
init
void init()
Called after the constructor has completed and the model has been loaded.
-
unwrap
public <T> T unwrap(java.lang.Class<T> iface) throws java.sql.SQLException
- Specified by:
unwrap
in interfacejava.sql.Wrapper
- Overrides:
unwrap
in classorg.apache.calcite.avatica.AvaticaConnection
- Throws:
java.sql.SQLException
-
createStatement
public CalciteStatement createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws java.sql.SQLException
- Specified by:
createStatement
in interfacejava.sql.Connection
- Overrides:
createStatement
in classorg.apache.calcite.avatica.AvaticaConnection
- Throws:
java.sql.SQLException
-
prepareStatement
public CalcitePreparedStatement prepareStatement(java.lang.String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws java.sql.SQLException
- Specified by:
prepareStatement
in interfacejava.sql.Connection
- Overrides:
prepareStatement
in classorg.apache.calcite.avatica.AvaticaConnection
- Throws:
java.sql.SQLException
-
prepareStatement_
private CalcitePreparedStatement prepareStatement_(CalcitePrepare.Query<?> query, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws java.sql.SQLException
- Throws:
java.sql.SQLException
-
parseQuery
<T> CalcitePrepare.CalciteSignature<T> parseQuery(CalcitePrepare.Query<T> query, CalcitePrepare.Context prepareContext, long maxRowCount)
-
getCancelFlag
public java.util.concurrent.atomic.AtomicBoolean getCancelFlag(org.apache.calcite.avatica.Meta.StatementHandle handle) throws org.apache.calcite.avatica.NoSuchStatementException
- Overrides:
getCancelFlag
in classorg.apache.calcite.avatica.AvaticaConnection
- Throws:
org.apache.calcite.avatica.NoSuchStatementException
-
getRootSchema
public SchemaPlus getRootSchema()
Description copied from interface:CalciteConnection
Returns the root schema.You can define objects (such as relations) in this schema, and also nested schemas.
- Specified by:
getRootSchema
in interfaceCalciteConnection
- Returns:
- Root schema
-
getTypeFactory
public JavaTypeFactory getTypeFactory()
Description copied from interface:CalciteConnection
Returns the type factory.- Specified by:
getTypeFactory
in interfaceCalciteConnection
- Returns:
- Type factory
-
getProperties
public java.util.Properties getProperties()
Description copied from interface:CalciteConnection
Returns an instance of the connection properties.NOTE: The resulting collection of properties is same collection used by the connection, and is writable, but behavior if you modify the collection is undefined. Some implementations might, for example, see a modified property, but only if you set it before you create a statement. We will remove this method when there are better implementations of stateful connections and configuration.
- Specified by:
getProperties
in interfaceCalciteConnection
- Returns:
- properties
-
createQuery
public <T> Queryable<T> createQuery(Expression expression, java.lang.Class<T> rowType)
Description copied from interface:QueryProvider
Constructs aQueryable
object that can evaluate the query represented by a specified expression tree.NOTE: The
RawQueryable.getExpression()
property of the returnedQueryable
object is equal toexpression
.- Specified by:
createQuery
in interfaceQueryProvider
- Type Parameters:
T
- Row type- Parameters:
expression
- ExpressionrowType
- Row type- Returns:
- Queryable
-
createQuery
public <T> Queryable<T> createQuery(Expression expression, java.lang.reflect.Type rowType)
Description copied from interface:QueryProvider
Constructs aQueryable
object that can evaluate the query represented by a specified expression tree. The row type may contain generic information.- Specified by:
createQuery
in interfaceQueryProvider
- Type Parameters:
T
- Row type- Parameters:
expression
- ExpressionrowType
- Row type- Returns:
- Queryable
-
execute
public <T> T execute(Expression expression, java.lang.reflect.Type type)
Description copied from interface:QueryProvider
Executes the query represented by a specified expression tree. The row type may contain type parameters.- Specified by:
execute
in interfaceQueryProvider
-
execute
public <T> T execute(Expression expression, java.lang.Class<T> type)
Description copied from interface:QueryProvider
Executes the query represented by a specified expression tree.This method executes queries that return a single value (instead of an enumerable sequence of values). Expression trees that represent queries that return enumerable results are executed when the
Queryable
object that contains the expression tree is enumerated.The Queryable standard query operator methods that return singleton results call
execute
. They pass it aMethodCallExpression
that represents a linq4j query.- Specified by:
execute
in interfaceQueryProvider
-
executeQuery
public <T> Enumerator<T> executeQuery(Queryable<T> queryable)
Description copied from interface:QueryProvider
Executes a queryable, and returns an enumerator over the rows that it yields.- Specified by:
executeQuery
in interfaceQueryProvider
- Parameters:
queryable
- Queryable- Returns:
- Enumerator over rows
-
enumerable
public <T> Enumerable<T> enumerable(org.apache.calcite.avatica.Meta.StatementHandle handle, CalcitePrepare.CalciteSignature<T> signature) throws java.sql.SQLException
- Throws:
java.sql.SQLException
-
createDataContext
public DataContext createDataContext(java.util.Map<java.lang.String,java.lang.Object> parameterValues, CalciteSchema rootSchema)
-
getDriver
org.apache.calcite.avatica.UnregisteredDriver getDriver()
-
getFactory
org.apache.calcite.avatica.AvaticaFactory getFactory()
-
-