huaxingao commented on a change in pull request #34291:
URL: https://github.com/apache/spark/pull/34291#discussion_r730357003



##########
File path: 
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/jdbc/JDBCScan.scala
##########
@@ -28,10 +29,19 @@ case class JDBCScan(
     prunedSchema: StructType,
     pushedFilters: Array[Filter],
     pushedAggregateColumn: Array[String] = Array(),
-    groupByColumns: Option[Array[String]]) extends V1Scan {
+    groupByColumns: Option[Array[String]]) extends V1Scan with 
SupportsPushDownLimit {
 
   override def readSchema(): StructType = prunedSchema
 
+  private var limit: Option[Limit] = None
+
+  override def pushLimit(limit: Limit): Unit = {
+    if (!relation.jdbcOptions.pushDownLimit) return
+    this.limit = Some(limit)
+  }
+
+  override def pushedLimit: Limit = if (limit.nonEmpty) limit.get else null

Review comment:
       This null bothers me too, but the abstract method is in java `Limit 
pushedLimit();`, that's why I didn't put it in Option.




-- 
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]

Reply via email to