Package org.apache.spark.sql.jdbc
Class JdbcSQLQueryBuilder
Object
org.apache.spark.sql.jdbc.JdbcSQLQueryBuilder
- Direct Known Subclasses:
- DB2Dialect.DB2SQLQueryBuilder,- MsSqlServerDialect.MsSqlServerSQLQueryBuilder,- MySQLDialect.MySQLSQLQueryBuilder,- OracleDialect.OracleSQLQueryBuilder
The builder to build a single SELECT query.
 
 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.
 
- Since:
- 3.5.0
- 
Constructor SummaryConstructorsConstructorDescriptionJdbcSQLQueryBuilder(JdbcDialect dialect, org.apache.spark.sql.execution.datasources.jdbc.JDBCOptions options) 
- 
Method SummaryModifier and TypeMethodDescriptionbuild()Build the final SQL query that following dialect's SQL syntax.withAliasedColumns(String[] columns, scala.Option<String>[] aliases) withColumns(String[] columns) The columns names that following dialect's SQL syntax.withGroupByColumns(String[] groupByColumns) Constructs the GROUP BY clause that following dialect's SQL syntax.withJoin(JdbcSQLQueryBuilder left, JdbcSQLQueryBuilder right, String leftSideQualifier, String rightSideQualifier, String[] columns, String joinType, String joinCondition) withLimit(int limit) Saves the limit value used to construct LIMIT clause.withOffset(int offset) Saves the offset value used to construct OFFSET clause.withPredicates(Predicate[] predicates, org.apache.spark.sql.execution.datasources.jdbc.JDBCPartition part) Constructs the WHERE clause that following dialect's SQL syntax.withSortOrders(String[] sortOrders) Constructs the ORDER BY clause that following dialect's SQL syntax.withTableSample(org.apache.spark.sql.execution.datasources.v2.TableSampleInfo sample) Constructs the table sample clause that following dialect's SQL syntax.
- 
Constructor Details- 
JdbcSQLQueryBuilderpublic JdbcSQLQueryBuilder(JdbcDialect dialect, org.apache.spark.sql.execution.datasources.jdbc.JDBCOptions options) 
 
- 
- 
Method Details- 
buildBuild the final SQL query that following dialect's SQL syntax.- Returns:
- (undocumented)
 
- 
withAliasedColumns
- 
withColumnsThe columns names that following dialect's SQL syntax. e.g. The column name is the raw name or quoted name.- Parameters:
- columns- (undocumented)
- Returns:
- (undocumented)
 
- 
withGroupByColumnsConstructs the GROUP BY clause that following dialect's SQL syntax.- Parameters:
- groupByColumns- (undocumented)
- Returns:
- (undocumented)
 
- 
withJoinpublic JdbcSQLQueryBuilder withJoin(JdbcSQLQueryBuilder left, JdbcSQLQueryBuilder right, String leftSideQualifier, String rightSideQualifier, String[] columns, String joinType, String joinCondition) 
- 
withLimitSaves the limit value used to construct LIMIT clause.- Parameters:
- limit- (undocumented)
- Returns:
- (undocumented)
 
- 
withOffsetSaves the offset value used to construct OFFSET clause.- Parameters:
- offset- (undocumented)
- Returns:
- (undocumented)
 
- 
withPredicatespublic JdbcSQLQueryBuilder withPredicates(Predicate[] predicates, org.apache.spark.sql.execution.datasources.jdbc.JDBCPartition part) Constructs the WHERE clause that following dialect's SQL syntax.- Parameters:
- predicates- (undocumented)
- part- (undocumented)
- Returns:
- (undocumented)
 
- 
withSortOrdersConstructs the ORDER BY clause that following dialect's SQL syntax.- Parameters:
- sortOrders- (undocumented)
- Returns:
- (undocumented)
 
- 
withTableSamplepublic JdbcSQLQueryBuilder withTableSample(org.apache.spark.sql.execution.datasources.v2.TableSampleInfo sample) Constructs the table sample clause that following dialect's SQL syntax.- Parameters:
- sample- (undocumented)
- Returns:
- (undocumented)
 
 
-