Class AbstractQueryRewriter

    • Field Detail

      • dialect

        protected final SqlDialect dialect
        Dialect implementation
      • remoteMetadataReader

        protected final RemoteMetadataReader remoteMetadataReader
        Remote metadata reader
    • Constructor Detail

    • Method Detail

      • rewrite

        public String rewrite​(com.exasol.adapter.sql.SqlStatement statement,
                              List<com.exasol.adapter.metadata.DataType> selectListDataTypes,
                              com.exasol.ExaMetadata exaMetadata,
                              com.exasol.adapter.AdapterProperties properties)
                       throws com.exasol.adapter.AdapterException,
                              SQLException
        Description copied from interface: QueryRewriter
        Set the original push-down statement.
        Specified by:
        rewrite in interface QueryRewriter
        Parameters:
        statement - SQL statement that represents the original push-down query
        selectListDataTypes - expected data types of result set
        exaMetadata - Exasol metadata
        properties - user-defined adapter properties
        Returns:
        rewritten query
        Throws:
        com.exasol.adapter.AdapterException - if rewriting fails
        SQLException - if any SQL commands executed on the remote data source failed during rewriting
      • getConnectionInformation

        protected com.exasol.ExaConnectionInformation getConnectionInformation​(com.exasol.ExaMetadata exaMetadata,
                                                                               com.exasol.adapter.AdapterProperties properties)
                                                                        throws com.exasol.adapter.AdapterException
        Read the connection information from the metadata.
        Parameters:
        exaMetadata - metadata
        properties - adapter properties
        Returns:
        connection information
        Throws:
        com.exasol.adapter.AdapterException - if access fails
      • generateImportStatement

        protected String generateImportStatement​(String connectionDefinition,
                                                 List<com.exasol.adapter.metadata.DataType> selectListDataTypes,
                                                 String pushdownQuery)
                                          throws SQLException
        This method provides backwards compatibility. A class extending the AbstractQueryRewriter has two options:
        Parameters:
        connectionDefinition - connection definition to be used when connecting to the external source
        selectListDataTypes - expected data types of result set
        pushdownQuery - source data for the `IMPORT...FROM` statement
        Returns:
        IMPORT statement to be executed on the Exasol database
        Throws:
        SQLException - if any problem occurs
      • generateImportStatement

        protected abstract String generateImportStatement​(String connectionDefinition,
                                                          String pushdownQuery)
                                                   throws SQLException
        Generate an IMPORT statement to be executed in the Exasol database, using the passed pushdown query to be executed in the external source be as source data.
        Parameters:
        connectionDefinition - connection definition to be used when connecting to the external source
        pushdownQuery - source data for the `IMPORT...FROM` statement
        Returns:
        IMPORT statement to be executed on the Exasol database
        Throws:
        SQLException - if any problem occurs