LuciferYang commented on code in PR #37393:
URL: https://github.com/apache/spark/pull/37393#discussion_r942055045
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/internal/connector/PredicateUtils.scala:
##########
@@ -132,4 +133,18 @@ private[sql] object PredicateUtils {
case _ => None
}
}
+
+ def toV1(
+ predicates: Array[Predicate],
+ skipIfNotConvertible: Boolean): Array[Filter] = {
+ predicates.flatMap { predicate =>
+ val filter = toV1(predicate)
+ if (filter.isEmpty) {
+ if (!skipIfNotConvertible) {
+ throw
QueryCompilationErrors.unsupportedPredicateToFilterConversionError(predicate.name())
+ }
+ }
+ filter
+ }.toArray
Review Comment:
Yes, I double checked that Scala 2.13 doesn't need this `toArray`.
Moreover, the redundant `toArray` will make the performance worse when using
Scala 2.13 due `ArrayOps.toArray` will always do a memory copy even if the item
Type has not changed , but Scala 2.12 will directly return the original array
when the item Type is unchanged.
--
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]