Class JdbcSplitQueryBuilder


  • public abstract class JdbcSplitQueryBuilder
    extends Object
    Query builder for database table split.
    • Constructor Detail

      • JdbcSplitQueryBuilder

        public JdbcSplitQueryBuilder​(String quoteCharacters)
        Meant for connectors which do not yet support complex expressions.
      • JdbcSplitQueryBuilder

        public JdbcSplitQueryBuilder​(String quoteCharacters,
                                     FederationExpressionParser federationExpressionParser)
        Parameters:
        quoteCharacters - database quote character for enclosing identifiers.
    • Method Detail

      • buildSql

        public PreparedStatement buildSql​(Connection jdbcConnection,
                                          String catalog,
                                          String schema,
                                          String table,
                                          org.apache.arrow.vector.types.pojo.Schema tableSchema,
                                          com.amazonaws.athena.connector.lambda.domain.predicate.Constraints constraints,
                                          com.amazonaws.athena.connector.lambda.domain.Split split)
                                   throws SQLException
        Common logic to build Split SQL including constraints translated in where clause.
        Parameters:
        jdbcConnection - JDBC connection. See Connection.
        catalog - Athena provided catalog name.
        schema - table schema name.
        table - table name.
        tableSchema - table schema (column and type information).
        constraints - constraints passed by Athena to push down.
        split - table split.
        Returns:
        prepated statement with SQL. See PreparedStatement.
        Throws:
        SQLException - JDBC database exception.
      • prepareStatementWithSql

        protected PreparedStatement prepareStatementWithSql​(Connection jdbcConnection,
                                                            String catalog,
                                                            String schema,
                                                            String table,
                                                            org.apache.arrow.vector.types.pojo.Schema tableSchema,
                                                            com.amazonaws.athena.connector.lambda.domain.predicate.Constraints constraints,
                                                            com.amazonaws.athena.connector.lambda.domain.Split split,
                                                            String columnNames)
                                                     throws SQLException
        Throws:
        SQLException
      • extractOrderByClause

        protected String extractOrderByClause​(com.amazonaws.athena.connector.lambda.domain.predicate.Constraints constraints)
      • getFromClauseWithSplit

        protected abstract String getFromClauseWithSplit​(String catalog,
                                                         String schema,
                                                         String table,
                                                         com.amazonaws.athena.connector.lambda.domain.Split split)
      • getPartitionWhereClauses

        protected abstract List<String> getPartitionWhereClauses​(com.amazonaws.athena.connector.lambda.domain.Split split)
      • appendLimitOffset

        protected String appendLimitOffset​(com.amazonaws.athena.connector.lambda.domain.Split split)
      • appendLimitOffset

        protected String appendLimitOffset​(com.amazonaws.athena.connector.lambda.domain.Split split,
                                           com.amazonaws.athena.connector.lambda.domain.predicate.Constraints constraints)