Class JdbcSplitQueryBuilder
- java.lang.Object
-
- com.amazonaws.athena.connectors.jdbc.manager.JdbcSplitQueryBuilder
-
- Direct Known Subclasses:
DataLakeGen2QueryStringBuilder
,Db2As400QueryStringBuilder
,Db2QueryStringBuilder
,HiveQueryStringBuilder
,HiveQueryStringBuilder
,ImpalaQueryStringBuilder
,MySqlQueryStringBuilder
,OracleQueryStringBuilder
,PostGreSqlQueryStringBuilder
,SaphanaQueryStringBuilder
,SnowflakeQueryStringBuilder
,SqlServerQueryStringBuilder
,SynapseQueryStringBuilder
,TeradataQueryStringBuilder
public abstract class JdbcSplitQueryBuilder extends Object
Query builder for database table split.
-
-
Field Summary
Fields Modifier and Type Field Description protected String
emptyString
-
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 String
appendLimitOffset(Split split)
protected String
appendLimitOffset(Split split, Constraints constraints)
PreparedStatement
buildSql(Connection jdbcConnection, String catalog, String schema, String table, org.apache.arrow.vector.types.pojo.Schema tableSchema, Constraints constraints, Split split)
Common logic to build Split SQL including constraints translated in where clause.protected String
extractOrderByClause(Constraints constraints)
protected abstract String
getFromClauseWithSplit(String catalog, String schema, String table, Split split)
protected abstract List<String>
getPartitionWhereClauses(Split split)
protected PreparedStatement
prepareStatementWithSql(Connection jdbcConnection, String catalog, String schema, String table, org.apache.arrow.vector.types.pojo.Schema tableSchema, Constraints constraints, Split split, String columnNames)
protected String
quote(String name)
protected String
toPredicate(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, Constraints constraints, 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, Constraints constraints, Split split, String columnNames) throws SQLException
- Throws:
SQLException
-
extractOrderByClause
protected String extractOrderByClause(Constraints constraints)
-
getFromClauseWithSplit
protected abstract String getFromClauseWithSplit(String catalog, String schema, String table, 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(Split split, Constraints constraints)
-
-