public class JdbcSQLQueryBuilder
extends Object
Note: All the withXXX
methods will be invoked at most once. The invocation order does not
matter, as all these clauses follow the natural SQL order: sample the table first, then filter,
then group by, then sort, then offset, then limit.
Constructor and Description |
---|
JdbcSQLQueryBuilder(JdbcDialect dialect,
org.apache.spark.sql.execution.datasources.jdbc.JDBCOptions options) |
Modifier and Type | Method and Description |
---|---|
String |
build()
Build the final SQL query that following dialect's SQL syntax.
|
JdbcSQLQueryBuilder |
withColumns(String[] columns)
The columns names that following dialect's SQL syntax.
|
JdbcSQLQueryBuilder |
withGroupByColumns(String[] groupByColumns)
Constructs the GROUP BY clause that following dialect's SQL syntax.
|
JdbcSQLQueryBuilder |
withLimit(int limit)
Saves the limit value used to construct LIMIT clause.
|
JdbcSQLQueryBuilder |
withOffset(int offset)
Saves the offset value used to construct OFFSET clause.
|
JdbcSQLQueryBuilder |
withPredicates(Predicate[] predicates,
org.apache.spark.sql.execution.datasources.jdbc.JDBCPartition part)
Constructs the WHERE clause that following dialect's SQL syntax.
|
JdbcSQLQueryBuilder |
withSortOrders(String[] sortOrders)
Constructs the ORDER BY clause that following dialect's SQL syntax.
|
JdbcSQLQueryBuilder |
withTableSample(org.apache.spark.sql.execution.datasources.v2.TableSampleInfo sample)
Constructs the table sample clause that following dialect's SQL syntax.
|
public JdbcSQLQueryBuilder(JdbcDialect dialect, org.apache.spark.sql.execution.datasources.jdbc.JDBCOptions options)
public String build()
public JdbcSQLQueryBuilder withColumns(String[] columns)
columns
- (undocumented)public JdbcSQLQueryBuilder withGroupByColumns(String[] groupByColumns)
groupByColumns
- (undocumented)public JdbcSQLQueryBuilder withLimit(int limit)
limit
- (undocumented)public JdbcSQLQueryBuilder withOffset(int offset)
offset
- (undocumented)public JdbcSQLQueryBuilder withPredicates(Predicate[] predicates, org.apache.spark.sql.execution.datasources.jdbc.JDBCPartition part)
predicates
- (undocumented)part
- (undocumented)public JdbcSQLQueryBuilder withSortOrders(String[] sortOrders)
sortOrders
- (undocumented)public JdbcSQLQueryBuilder withTableSample(org.apache.spark.sql.execution.datasources.v2.TableSampleInfo sample)
sample
- (undocumented)