milastdbx commented on code in PR #47611:
URL: https://github.com/apache/spark/pull/47611#discussion_r1711361390


##########
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/DataSourceV2Strategy.scala:
##########
@@ -650,10 +651,22 @@ private[sql] object DataSourceV2Strategy extends Logging {
 /**
  * Get the expression of DS V2 to represent catalyst predicate that can be 
pushed down.
  */
-object PushablePredicate {
-  def unapply(e: Expression): Option[Predicate] =
-    new V2ExpressionBuilder(e, true).build().map { v =>
+object PushablePredicate extends Logging {
+
+  def unapply(e: Expression): Option[Predicate] = {
+    val exprOpt = new V2ExpressionBuilder(e, true).build()
+
+    val modifiedExprOpt =
+      if (SQLConf.get.getConf(SQLConf.DATA_SOURCE_DONT_ASSERT_ON_PREDICATE) &&
+        exprOpt.isDefined &&
+        !exprOpt.get.isInstanceOf[Predicate]) {
+        logWarning(log"Predicate expected but got class: ${MDC(EXPR, 
exprOpt.get.describe())}")
+        None
+      } else { exprOpt }

Review Comment:
   Got it!
   
   Doc you shared is not specific around this tho. Even has different example:
   <img width="1145" alt="image" 
src="https://github.com/user-attachments/assets/43c9a0c0-0733-4ecd-b25b-68abadea06b3";>
   



-- 
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: reviews-unsubscr...@spark.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to