Class JdbcSplitQueryBuilder
- java.lang.Object
-
- com.amazonaws.athena.connectors.jdbc.manager.JdbcSplitQueryBuilder
-
public abstract class JdbcSplitQueryBuilder extends Object
Query builder for database table split.
-
-
Field Summary
Fields Modifier and Type Field Description protected StringemptyString
-
Constructor Summary
Constructors Constructor Description JdbcSplitQueryBuilder(String quoteCharacters)Meant for connectors which do not yet support complex expressions.JdbcSplitQueryBuilder(String quoteCharacters, FederationExpressionParser federationExpressionParser)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected StringappendLimitOffset(com.amazonaws.athena.connector.lambda.domain.Split split)protected StringappendLimitOffset(com.amazonaws.athena.connector.lambda.domain.Split split, com.amazonaws.athena.connector.lambda.domain.predicate.Constraints constraints)PreparedStatementbuildSql(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)Common logic to build Split SQL including constraints translated in where clause.protected StringextractOrderByClause(com.amazonaws.athena.connector.lambda.domain.predicate.Constraints constraints)protected abstract StringgetFromClauseWithSplit(String catalog, String schema, String table, com.amazonaws.athena.connector.lambda.domain.Split split)protected abstract List<String>getPartitionWhereClauses(com.amazonaws.athena.connector.lambda.domain.Split split)protected PreparedStatementprepareStatementWithSql(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)protected Stringquote(String name)protected StringtoPredicate(String columnName, String operator, Object value, org.apache.arrow.vector.types.pojo.ArrowType type, List<TypeAndValue> accumulator)
-
-
-
Field Detail
-
emptyString
protected final String emptyString
- See Also:
- Constant Field Values
-
-
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. SeeConnection.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)
-
toPredicate
protected String toPredicate(String columnName, String operator, Object value, org.apache.arrow.vector.types.pojo.ArrowType type, List<TypeAndValue> accumulator)
-
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)
-
-