You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Wenchen Fan (Jira)" <ji...@apache.org> on 2023/02/08 14:19:00 UTC
[jira] [Resolved] (SPARK-42131) Extract the function that construct the select statement for JDBC dialect.
[ https://issues.apache.org/jira/browse/SPARK-42131?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Wenchen Fan resolved SPARK-42131.
---------------------------------
Fix Version/s: 3.5.0
Resolution: Fixed
Issue resolved by pull request 39667
[https://github.com/apache/spark/pull/39667]
> 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
> Fix For: 3.5.0
>
>
> 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: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org