cloud-fan commented on a change in pull request #33352:
URL: https://github.com/apache/spark/pull/33352#discussion_r672380580
##########
File path:
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/jdbc/JDBCRDD.scala
##########
@@ -152,19 +191,27 @@ object JDBCRDD extends Logging {
requiredColumns: Array[String],
filters: Array[Filter],
parts: Array[Partition],
- options: JDBCOptions): RDD[InternalRow] = {
+ options: JDBCOptions,
+ requiredSchema: Option[StructType] = None,
+ aggregation: Option[Aggregation] = None): RDD[InternalRow] = {
val url = options.url
val dialect = JdbcDialects.get(url)
- val quotedColumns = requiredColumns.map(colName =>
dialect.quoteIdentifier(colName))
+ val quotedColumns = if (aggregation.isEmpty) {
+ requiredColumns.map(colName => dialect.quoteIdentifier(colName))
+ } else {
+ // these are already quoted in JDBCScanBuilder
+ requiredColumns
+ }
new JDBCRDD(
sc,
JdbcUtils.createConnectionFactory(options),
- pruneSchema(schema, requiredColumns),
+ pruneSchema(schema, requiredColumns, requiredSchema),
Review comment:
`requiredSchema.getOrElse(pruneSchema...)`, then we don't need to change
`pruneSchema` at all.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]