Class CalciteConnectionImpl

    • 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  
      • Fields inherited from class org.apache.calcite.avatica.AvaticaConnection

        driver, factory, handle, HELPER, id, info, maxRetriesPerExecute, meta, metaData, NUM_EXECUTE_RETRIES_DEFAULT, NUM_EXECUTE_RETRIES_KEY, PLAN_COLUMN_NAME, properties, ROWCOUNT_COLUMN_NAME, statementCount, statementMap
      • Fields inherited from interface java.sql.Connection

        TRANSACTION_NONE, TRANSACTION_READ_COMMITTED, TRANSACTION_READ_UNCOMMITTED, TRANSACTION_REPEATABLE_READ, TRANSACTION_SERIALIZABLE
    • 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 a Queryable object that can evaluate the query represented by a specified expression tree.
      <T> Queryable<T> createQuery​(Expression expression, java.lang.reflect.Type rowType)
      Constructs a Queryable 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 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
      • Methods inherited from interface java.sql.Wrapper

        isWrapperFor
    • 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 - Driver
        factory - Factory for JDBC objects
        url - Server URL
        info - Other connection properties
        rootSchema - Root schema, or null
        typeFactory - Type factory, or null
    • Method Detail

      • 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 interface java.sql.Wrapper
        Overrides:
        unwrap in class org.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 interface java.sql.Connection
        Overrides:
        createStatement in class org.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 interface java.sql.Connection
        Overrides:
        prepareStatement in class org.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
      • getCancelFlag

        public java.util.concurrent.atomic.AtomicBoolean getCancelFlag​(org.apache.calcite.avatica.Meta.StatementHandle handle)
                                                                throws org.apache.calcite.avatica.NoSuchStatementException
        Overrides:
        getCancelFlag in class org.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 interface CalciteConnection
        Returns:
        Root schema
      • 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 interface CalciteConnection
        Returns:
        properties
      • createQuery

        public <T> Queryable<T> createQuery​(Expression expression,
                                            java.lang.Class<T> rowType)
        Description copied from interface: QueryProvider
        Constructs a Queryable object that can evaluate the query represented by a specified expression tree.

        NOTE: The RawQueryable.getExpression() property of the returned Queryable object is equal to expression.

        Specified by:
        createQuery in interface QueryProvider
        Type Parameters:
        T - Row type
        Parameters:
        expression - Expression
        rowType - Row type
        Returns:
        Queryable
      • createQuery

        public <T> Queryable<T> createQuery​(Expression expression,
                                            java.lang.reflect.Type rowType)
        Description copied from interface: QueryProvider
        Constructs a Queryable object that can evaluate the query represented by a specified expression tree. The row type may contain generic information.
        Specified by:
        createQuery in interface QueryProvider
        Type Parameters:
        T - Row type
        Parameters:
        expression - Expression
        rowType - 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 interface QueryProvider
      • 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 a MethodCallExpression that represents a linq4j query.

        Specified by:
        execute in interface QueryProvider
      • 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 interface QueryProvider
        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()