Github user cloud-fan commented on a diff in the pull request:

    https://github.com/apache/spark/pull/12061#discussion_r57889469
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/Dataset.scala ---
    @@ -1860,7 +1860,12 @@ class Dataset[T] private[sql](
        * @since 1.6.0
        */
       @Experimental
    -  def filter(func: T => Boolean): Dataset[T] = 
mapPartitions(_.filter(func))
    +  def filter(func: T => Boolean): Dataset[T] = {
    +    val deserializer = unresolvedTEncoder.deserializer
    +    val function = Literal.create(func, ObjectType(classOf[Function1[T, 
Boolean]]))
    +    val condition = Invoke(function, "apply", BooleanType, deserializer :: 
Nil)
    +    withTypedPlan(Filter(condition, logicalPlan))
    --- End diff --
    
    Previously we need to deserialize input row, call function and serialize to 
row, but now we don't need to do the final serialization, it should be faster.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to