You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@spark.apache.org by qiuhai <98...@qq.com> on 2015/09/23 07:57:33 UTC

Why Filter return a DataFrame object in DataFrame.scala?

Hi,
  Recently,I am reading source code(1.5 version) about sparksql .
    In DataFrame.scala, there is a funtion named filter in the 737 row 

        *def filter(condition: Column): DataFrame = Filter(condition.expr,
logicalPlan)*

  The fucntion return  a Filter object,but it require a DataFrame object.


  thanks.



--
View this message in context: http://apache-spark-developers-list.1001551.n3.nabble.com/Why-Filter-return-a-DataFrame-object-in-DataFrame-scala-tp14295.html
Sent from the Apache Spark Developers List mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@spark.apache.org
For additional commands, e-mail: dev-help@spark.apache.org


Re: Why Filter return a DataFrame object in DataFrame.scala?

Posted by Reynold Xin <rx...@databricks.com>.
There is an implicit conversion in scope

https://github.com/apache/spark/blob/master/sql/core/src/main/scala/org/apache/spark/sql/DataFrame.scala#L153


  /**
   * An implicit conversion function internal to this class for us to avoid
doing
   * "new DataFrame(...)" everywhere.
   */
  @inline private implicit def logicalPlanToDataFrame(logicalPlan:
LogicalPlan): DataFrame = {
    new DataFrame(sqlContext, logicalPlan)
  }


On Tue, Sep 22, 2015 at 10:57 PM, qiuhai <98...@qq.com> wrote:

> Hi,
>   Recently,I am reading source code(1.5 version) about sparksql .
>   In DataFrame.scala, there is a funtion named filter in the 737 row
>
>         *def filter(condition: Column): DataFrame = Filter(condition.expr,
> logicalPlan)*
>
>   The fucntion return  a Filter object,but it require a DataFrame object.
>
>
>   thanks.
>
>
>
> --
> View this message in context:
> http://apache-spark-developers-list.1001551.n3.nabble.com/Why-Filter-return-a-DataFrame-object-in-DataFrame-scala-tp14295.html
> Sent from the Apache Spark Developers List mailing list archive at
> Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@spark.apache.org
> For additional commands, e-mail: dev-help@spark.apache.org
>
>

Re: Why Filter return a DataFrame object in DataFrame.scala?

Posted by qiuhai <98...@qq.com>.
Thank you very much



--
View this message in context: http://apache-spark-developers-list.1001551.n3.nabble.com/Why-Filter-return-a-DataFrame-object-in-DataFrame-scala-tp14295p14298.html
Sent from the Apache Spark Developers List mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@spark.apache.org
For additional commands, e-mail: dev-help@spark.apache.org


Re: Why Filter return a DataFrame object in DataFrame.scala?

Posted by Reynold Xin <rx...@databricks.com>.
There is an implicit conversion in scope

https://github.com/apache/spark/blob/master/sql/core/src/main/scala/org/apache/spark/sql/DataFrame.scala#L153


  /**
   * An implicit conversion function internal to this class for us to avoid
doing
   * "new DataFrame(...)" everywhere.
   */
  @inline private implicit def logicalPlanToDataFrame(logicalPlan:
LogicalPlan): DataFrame = {
    new DataFrame(sqlContext, logicalPlan)
  }


On Tue, Sep 22, 2015 at 10:57 PM, qiuhai <98...@qq.com> wrote:

> Hi,
>   Recently,I am reading source code(1.5 version) about sparksql .
>   In DataFrame.scala, there is a funtion named filter in the 737 row
>
>         *def filter(condition: Column): DataFrame = Filter(condition.expr,
> logicalPlan)*
>
>   The fucntion return  a Filter object,but it require a DataFrame object.
>
>
>   thanks.
>
>
>
> --
> View this message in context:
> http://apache-spark-developers-list.1001551.n3.nabble.com/Why-Filter-return-a-DataFrame-object-in-DataFrame-scala-tp14295.html
> Sent from the Apache Spark Developers List mailing list archive at
> Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@spark.apache.org
> For additional commands, e-mail: dev-help@spark.apache.org
>
>