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


##########
sql/catalyst/src/main/java/org/apache/spark/sql/connector/read/SupportsPushDownFilters.java:
##########
@@ -34,6 +34,10 @@ public interface SupportsPushDownFilters extends ScanBuilder 
{
    * <p>
    * Rows should be returned from the data source if and only if all of the 
filters match. That is,
    * filters must be interpreted as ANDed together.
+   * <p>
+   * The scans of streaming queries get the filters too, since 4.4.0, if the 
table returns
+   * {@link 
org.apache.spark.sql.connector.catalog.TableCapability#STREAMING_FILTER_PUSHDOWN}.

Review Comment:
   Done in feca8d3: both notes now name 
`spark.sql.streaming.v2FilterPushdown.enabled`, as the note of `pruneColumns` 
names `spark.sql.streaming.v2ColumnPruning.enabled`.
   



##########
common/utils/src/main/resources/error/error-conditions.json:
##########
@@ -8296,6 +8296,24 @@
     },
     "sqlState" : "0A000"
   },
+  "STREAMING_SCAN_FILTERS_CHANGED" : {
+    "message" : [
+      "The streaming query no longer applies the filters <filters> to all the 
rows that it reads from the source <source>, which the scan of the source got 
when the query started. The scan may drop rows that the query keeps, so the 
micro-batch fails before it reads them. This happens when the value of an 
expression in these filters changes after the query starts, for example, a 
function of the time that Spark does not replace when the query starts, or 
after the configuration of the optimizer changes in the session of the query. 
Set <config> to \"false\" so that the scans of streaming sources get no filter."

Review Comment:
   Done in feca8d3: the message and the Scaladoc of `checkPushedFilters` now 
name the third cause: the optimizer of the micro-batch rewrote these filters in 
a way that Spark doesn't follow, for example with an equality that it infers 
through a join. The first sentence of the message also says "or Spark cannot 
tell that it does", since in that case the query may still apply them.
   



##########
sql/catalyst/src/test/scala/org/apache/spark/sql/connector/catalog/InMemoryBaseTable.scala:
##########
@@ -1187,7 +1312,8 @@ object InMemoryBaseTable {
 /**

Review Comment:
   Done in feca8d3: they're merged into one Scaladoc, which describes the rows 
of a micro-batch that pass the filters of its stream, each with its position in 
the micro-batch.
   



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