gatorsmile commented on code in PR #47611:
URL: https://github.com/apache/spark/pull/47611#discussion_r1709886585
##########
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:
In our code base, the suggested indentation should be like this
```
} else {
exprOpt
}
```
--
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]