Interface QueryRewriter

  • All Known Implementing Classes:
    AbstractQueryRewriter, ImportFromJDBCQueryRewriter, ImportIntoTemporaryTableQueryRewriter

    public interface QueryRewriter
    This class is the common interface for all builders that re-write the push-down query.

    The Virtual Schema frontend sends a push-down query to the Virtual Schema backend and expects an SQL query back. In most cases this will be an IMPORT statement because it is easy to get this fast. But that is not the only option.

    SELECT ... FROM (VALUES ...) is another candidate that works in case of data sources that the Exasol core database can't import from directly (e.g. NoSQL databases).

    Last but not least you can combine your Virtual Schema Adapter with another UDF. In that case have the rewriter create a SQL statement that triggers an import through that UDF. This solution can be beneficial from a performance perspective since you can parallelize it.

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      String rewrite​(com.exasol.adapter.sql.SqlStatement statement, List<com.exasol.adapter.metadata.DataType> selectListDataTypes, com.exasol.ExaMetadata exaMetadata, com.exasol.adapter.AdapterProperties properties)
      Set the original push-down statement.
    • Method Detail

      • rewrite

        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
        Set the original push-down statement.
        Parameters:
        statement - SQL statement that represents the original push-down query
        selectListDataTypes - expected data types of result set
        properties - user-defined adapter properties
        exaMetadata - Exasol metadata
        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