HyukjinKwon commented on code in PR #59943:
URL: https://github.com/apache/spark/pull/59943#discussion_r4479850538


##########
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/PushDownUtils.scala:
##########
@@ -43,6 +43,32 @@ import org.apache.spark.util.collection.Utils
 
 object PushDownUtils extends Logging {
 
+  /** Returns whether [[pushFilters]] may push filters down to `scanBuilder`. 
*/
+  def supportsFilters(scanBuilder: ScanBuilder): Boolean = scanBuilder match {
+    case _: SupportsPushDownFilters | _: SupportsPushDownV2Filters |
+        _: SupportsPushDownCatalystFilters => true
+    case _ => false
+  }
+
+  /**
+   * Returns the filters of `filters` that [[pushFilters]] gives to 
`scanBuilder` in some form, in
+   * their order: those that it translates to data source filters or 
predicates, or the
+   * deterministic ones for a [[SupportsPushDownCatalystFilters]] builder. The 
others are only
+   * evaluated after the scan.
+   */
+  def filtersOfScanBuilder(

Review Comment:
   `filtersOfScanBuilder` left this PR with the filter pushdown, which moved to 
SPARK-60926 (#60129). Sharing one check with `pushFilters` is listed there.
   
   ---
   <!-- GITHUB_MCP_FOOTER: This attribution is automatically appended by GitHub 
MCP. -->
   _This comment was generated with [GitHub MCP](http://go/mcps)._



##########
sql/catalyst/src/main/java/org/apache/spark/sql/connector/catalog/TableCapability.java:
##########
@@ -170,5 +170,44 @@ public enum TableCapability {
    *
    * @since 4.4.0
    */
-  EXTERNAL_LOOKUP
+  EXTERNAL_LOOKUP,
+
+  /**
+   * Signals that the scans of the streaming reads of the table may only read 
the columns that the
+   * streaming query reads, which Spark asks a scan builder that implements
+   * {@link 
org.apache.spark.sql.connector.read.SupportsPushDownRequiredColumns} for, as it 
does
+   * for the scans of batch reads.
+   * <p>
+   * Spark builds the scan of a streaming read once, when the query starts, 
from the plan of the
+   * query optimized then, and creates the micro-batch or continuous stream of 
the read from that
+   * scan. By returning this capability, a table declares that the partition 
readers of such a
+   * stream return the columns of {@link 
org.apache.spark.sql.connector.read.Scan#readSchema()},
+   * as those of the batches of the scan do. Spark asks the scan for its read 
schema before it

Review Comment:
   Done in 89114e3: the docs of `STREAMING_COLUMN_PRUNING`, 
`SupportsPushDownRequiredColumns.pruneColumns` and `buildScan` say that Spark 
asks a pruned scan for its read schema before it creates the stream.
   
   ---
   <!-- GITHUB_MCP_FOOTER: This attribution is automatically appended by GitHub 
MCP. -->
   _This comment was generated with [GitHub MCP](http://go/mcps)._



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