[
https://issues.apache.org/jira/browse/SPARK-42131?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Wenchen Fan reassigned SPARK-42131:
-----------------------------------
Assignee: jiaan.geng
> Extract the function that construct the select statement for JDBC dialect.
> --------------------------------------------------------------------------
>
> Key: SPARK-42131
> URL: https://issues.apache.org/jira/browse/SPARK-42131
> Project: Spark
> Issue Type: Sub-task
> Components: SQL
> Affects Versions: 3.4.0
> Reporter: jiaan.geng
> Assignee: jiaan.geng
> Priority: Major
>
> Currently, JDBCRDD uses fixed format for SELECT statement.
> {code:java}
> val sqlText = options.prepareQuery +
> s"SELECT $columnList FROM ${options.tableOrQuery} $myTableSampleClause"
> +
> s" $myWhereClause $getGroupByClause $getOrderByClause $myLimitClause
> $myOffsetClause"
> {code}
> But some databases have different syntax that uses different keyword or sort.
> For example, MS SQL Server uses keyword TOP to describe LIMIT clause or Top N.
> The LIMIT clause of MS SQL Server.
> {code:java}
> SELECT TOP(1) Model, Color, Price
> FROM dbo.Cars
> WHERE Color = 'blue'
> {code}
> The Top N of MS SQL Server.
> {code:java}
> SELECT TOP(1) Model, Color, Price
> FROM dbo.Cars
> WHERE Color = 'blue'
> ORDER BY Price ASC
> {code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]