You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by HyukjinKwon <gi...@git.apache.org> on 2017/05/31 10:00:37 UTC

[GitHub] spark pull request #18160: [SPARK-20938][SQL] Keep/print the string represen...

GitHub user HyukjinKwon opened a pull request:

    https://github.com/apache/spark/pull/18160

    [SPARK-20938][SQL] Keep/print the string representation of catalyst filters in metadata for CatalystScan

    ## What changes were proposed in this pull request?
    
    Actual pushed-down catalyst predicate expressions look not being represented correctly (but only sources filters). For example, the below case
    
    ```scala
    df.filter("cast(a as string) == '1' and a < 3").explain()
    ```
    
    prints the plan as below:
    
    ```
    == Physical Plan ==
    *Filter (cast(a#0L as string) = 1)
    +- *Scan SimpleCatalystScan(0,10) [a#0L] PushedFilters: [*LessThan(a,3)], ReadSchema: struct<a:bigint>
    ```
    
    Actual predicates via `buildScan(requiredColumns: Seq[Attribute], filters: Seq[Expression])` are as below:
    
    ```scala
    println(filters.mkString("[", ", ", "]"))
    ```
    
    ```
    [(cast(a#0L as string) = 1), (a#0L < 3)]
    ```
    
    
    **After**
    
    ```scala
    df.filter("cast(a as string) == '1' and a < 3").explain()
    ```
    
    ```
    == Physical Plan ==
    *Filter (cast(a#0L as string) = 1)
    +- *Scan SimpleCatalystScan(0,10) [a#0L] PushedCatalystFilters: [(cast(a#0L as string) = 1), *(a#0L < 3)], ReadSchema: struct<a:bigint>
    ```
    
    
    ## How was this patch tested?
    
    Unit tests in `FilteredScanSuite` and `CatalystScanSuite`.


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/HyukjinKwon/spark catalyst-predicates

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/spark/pull/18160.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #18160
    
----
commit 1c159d26b116ea65bfef5147f471fc520efc9a0b
Author: hyukjinkwon <gu...@gmail.com>
Date:   2017-05-31T09:18:19Z

    Metadata should keep the pushed filters in PushedFilters/PushedCatalystFilters

----


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #18160: [SPARK-20938][SQL] Keep/print the string representation ...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/18160
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/77657/
    Test PASSed.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #18160: [SPARK-20938][SQL] Keep/print the string representation ...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/18160
  
    **[Test build #77589 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/77589/testReport)** for PR 18160 at commit [`872b7e7`](https://github.com/apache/spark/commit/872b7e781e9d96514bc714370182e99705f818a0).
     * This patch passes all tests.
     * This patch merges cleanly.
     * This patch adds no public classes.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request #18160: [SPARK-20938][SQL] Keep/print the string represen...

Posted by HyukjinKwon <gi...@git.apache.org>.
Github user HyukjinKwon commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18160#discussion_r120001877
  
    --- Diff: sql/core/src/test/scala/org/apache/spark/sql/sources/CatalystScanSuite.scala ---
    @@ -0,0 +1,73 @@
    +/*
    +* Licensed to the Apache Software Foundation (ASF) under one or more
    --- End diff --
    
    Just FYI, I opened a issue in scalastyle - `https://github.com/scalastyle/scalastyle/issues/252`.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #18160: [SPARK-20938][SQL] Keep/print the string representation ...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/18160
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/77589/
    Test PASSed.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request #18160: [SPARK-20938][SQL] Keep/print the string represen...

Posted by gatorsmile <gi...@git.apache.org>.
Github user gatorsmile commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18160#discussion_r120023053
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceStrategy.scala ---
    @@ -370,18 +368,26 @@ case class DataSourceStrategy(conf: SQLConf) extends Strategy with Logging with
         // These metadata values make scan plans uniquely identifiable for equality checking.
         // TODO(SPARK-17701) using strings for equality checking is brittle
         val metadata: Map[String, String] = {
    -      val pairs = ArrayBuffer.empty[(String, String)]
    -
    +      val schemaString = StructType.fromAttributes(projects.map(_.toAttribute)).catalogString
           // Mark filters which are handled by the underlying DataSource with an Astrisk
    -      if (pushedFilters.nonEmpty) {
    -        val markedFilters = for (filter <- pushedFilters) yield {
    +      relation match {
    +        case LogicalRelation(_: CatalystScan, _, _) if candidatePredicates.nonEmpty =>
    +          val markedPredicates = for (predicate <- candidatePredicates) yield {
    +            if (handledPredicates.contains(predicate)) s"*$predicate" else s"$predicate"
    +          }
    +          Map(
    +            "PushedCatalystFilters" -> markedPredicates.mkString("[", ", ", "]"),
    +            "ReadSchema" -> schemaString)
    +        case _ if pushedFilters.nonEmpty =>
    +          val markedFilters = for (filter <- pushedFilters) yield {
                 if (handledFilters.contains(filter)) s"*$filter" else s"$filter"
    -        }
    -        pairs += ("PushedFilters" -> markedFilters.mkString("[", ", ", "]"))
    +          }
    +          Map(
    +            "PushedFilters" -> markedFilters.mkString("[", ", ", "]"),
    +            "ReadSchema" -> schemaString)
    +        case _ =>
    +          Map("ReadSchema" -> schemaString)
           }
    -      pairs += ("ReadSchema" ->
    --- End diff --
    
    Instead, we need to pass it as named fields.  We need to clean up the related codes. Removing the metadata from `SparkPlan`


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #18160: [SPARK-20938][SQL] Keep/print the string representation ...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/18160
  
    **[Test build #77585 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/77585/testReport)** for PR 18160 at commit [`1c159d2`](https://github.com/apache/spark/commit/1c159d26b116ea65bfef5147f471fc520efc9a0b).


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request #18160: [SPARK-20938][SQL] Keep/print the string represen...

Posted by gatorsmile <gi...@git.apache.org>.
Github user gatorsmile commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18160#discussion_r120022842
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceStrategy.scala ---
    @@ -370,18 +368,26 @@ case class DataSourceStrategy(conf: SQLConf) extends Strategy with Logging with
         // These metadata values make scan plans uniquely identifiable for equality checking.
         // TODO(SPARK-17701) using strings for equality checking is brittle
         val metadata: Map[String, String] = {
    -      val pairs = ArrayBuffer.empty[(String, String)]
    -
    +      val schemaString = StructType.fromAttributes(projects.map(_.toAttribute)).catalogString
           // Mark filters which are handled by the underlying DataSource with an Astrisk
    -      if (pushedFilters.nonEmpty) {
    -        val markedFilters = for (filter <- pushedFilters) yield {
    +      relation match {
    +        case LogicalRelation(_: CatalystScan, _, _) if candidatePredicates.nonEmpty =>
    +          val markedPredicates = for (predicate <- candidatePredicates) yield {
    +            if (handledPredicates.contains(predicate)) s"*$predicate" else s"$predicate"
    +          }
    +          Map(
    +            "PushedCatalystFilters" -> markedPredicates.mkString("[", ", ", "]"),
    +            "ReadSchema" -> schemaString)
    +        case _ if pushedFilters.nonEmpty =>
    +          val markedFilters = for (filter <- pushedFilters) yield {
                 if (handledFilters.contains(filter)) s"*$filter" else s"$filter"
    -        }
    -        pairs += ("PushedFilters" -> markedFilters.mkString("[", ", ", "]"))
    +          }
    +          Map(
    +            "PushedFilters" -> markedFilters.mkString("[", ", ", "]"),
    +            "ReadSchema" -> schemaString)
    +        case _ =>
    +          Map("ReadSchema" -> schemaString)
           }
    -      pairs += ("ReadSchema" ->
    --- End diff --
    
    `ReadSchema` can be removed. 


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request #18160: [SPARK-20938][SQL] Keep/print the string represen...

Posted by HyukjinKwon <gi...@git.apache.org>.
Github user HyukjinKwon closed the pull request at:

    https://github.com/apache/spark/pull/18160


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #18160: [SPARK-20938][SQL] Keep/print the string representation ...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/18160
  
    **[Test build #77657 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/77657/testReport)** for PR 18160 at commit [`5e8860e`](https://github.com/apache/spark/commit/5e8860e88058f9eec8bc016716ef1a7ce3331729).


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #18160: [SPARK-20938][SQL] Keep/print the string representation ...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/18160
  
    **[Test build #77585 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/77585/testReport)** for PR 18160 at commit [`1c159d2`](https://github.com/apache/spark/commit/1c159d26b116ea65bfef5147f471fc520efc9a0b).
     * This patch **fails Spark unit tests**.
     * This patch merges cleanly.
     * This patch adds no public classes.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #18160: [SPARK-20938][SQL] Keep/print the string representation ...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/18160
  
    Merged build finished. Test PASSed.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request #18160: [SPARK-20938][SQL] Keep/print the string represen...

Posted by dongjoon-hyun <gi...@git.apache.org>.
Github user dongjoon-hyun commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18160#discussion_r119638677
  
    --- Diff: sql/core/src/test/scala/org/apache/spark/sql/sources/CatalystScanSuite.scala ---
    @@ -0,0 +1,73 @@
    +/*
    +* Licensed to the Apache Software Foundation (ASF) under one or more
    --- End diff --
    
    Nit, indentation?


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #18160: [SPARK-20938][SQL] Keep/print the string representation ...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/18160
  
    Merged build finished. Test PASSed.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request #18160: [SPARK-20938][SQL] Keep/print the string represen...

Posted by dongjoon-hyun <gi...@git.apache.org>.
Github user dongjoon-hyun commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18160#discussion_r119642765
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceStrategy.scala ---
    @@ -370,18 +368,26 @@ case class DataSourceStrategy(conf: SQLConf) extends Strategy with Logging with
         // These metadata values make scan plans uniquely identifiable for equality checking.
         // TODO(SPARK-17701) using strings for equality checking is brittle
         val metadata: Map[String, String] = {
    -      val pairs = ArrayBuffer.empty[(String, String)]
    -
    +      val schemaString = StructType.fromAttributes(projects.map(_.toAttribute)).catalogString
           // Mark filters which are handled by the underlying DataSource with an Astrisk
    -      if (pushedFilters.nonEmpty) {
    -        val markedFilters = for (filter <- pushedFilters) yield {
    +      relation match {
    +        case LogicalRelation(_: CatalystScan, _, _) if candidatePredicates.nonEmpty =>
    +          val markedPredicates = for (predicate <- candidatePredicates) yield {
    +            if (handledPredicates.contains(predicate)) s"*$predicate" else s"$predicate"
    +          }
    +          Map(
    +            "PushedCatalystFilters" -> markedPredicates.mkString("[", ", ", "]"),
    --- End diff --
    
    In this case, for all filters, `PushedCatalystFilters` instead of `PushedFilters` ?


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #18160: [SPARK-20938][SQL] Keep/print the string representation ...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/18160
  
    Merged build finished. Test FAILed.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #18160: [SPARK-20938][SQL] Keep/print the string representation ...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/18160
  
    **[Test build #77589 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/77589/testReport)** for PR 18160 at commit [`872b7e7`](https://github.com/apache/spark/commit/872b7e781e9d96514bc714370182e99705f818a0).


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #18160: [SPARK-20938][SQL] Keep/print the string representation ...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/18160
  
    Test FAILed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/77585/
    Test FAILed.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request #18160: [SPARK-20938][SQL] Keep/print the string represen...

Posted by HyukjinKwon <gi...@git.apache.org>.
Github user HyukjinKwon commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18160#discussion_r119751315
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceStrategy.scala ---
    @@ -370,18 +368,26 @@ case class DataSourceStrategy(conf: SQLConf) extends Strategy with Logging with
         // These metadata values make scan plans uniquely identifiable for equality checking.
         // TODO(SPARK-17701) using strings for equality checking is brittle
         val metadata: Map[String, String] = {
    -      val pairs = ArrayBuffer.empty[(String, String)]
    -
    +      val schemaString = StructType.fromAttributes(projects.map(_.toAttribute)).catalogString
           // Mark filters which are handled by the underlying DataSource with an Astrisk
    -      if (pushedFilters.nonEmpty) {
    -        val markedFilters = for (filter <- pushedFilters) yield {
    +      relation match {
    +        case LogicalRelation(_: CatalystScan, _, _) if candidatePredicates.nonEmpty =>
    +          val markedPredicates = for (predicate <- candidatePredicates) yield {
    +            if (handledPredicates.contains(predicate)) s"*$predicate" else s"$predicate"
    +          }
    +          Map(
    +            "PushedCatalystFilters" -> markedPredicates.mkString("[", ", ", "]"),
    --- End diff --
    
    Yes, I think all filters (if exists) are pushed for `CatalystScan` and these are catalyst ones - https://github.com/apache/spark/blob/f3ed62a381897711d86fde27ab80bb70ed0b0513/sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceStrategy.scala#L271-L272.
    
    So, I intended to put them in `PushedCatalystFilters`.
    



---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request #18160: [SPARK-20938][SQL] Keep/print the string represen...

Posted by HyukjinKwon <gi...@git.apache.org>.
Github user HyukjinKwon commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18160#discussion_r123173545
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceStrategy.scala ---
    @@ -370,18 +368,26 @@ case class DataSourceStrategy(conf: SQLConf) extends Strategy with Logging with
         // These metadata values make scan plans uniquely identifiable for equality checking.
         // TODO(SPARK-17701) using strings for equality checking is brittle
         val metadata: Map[String, String] = {
    -      val pairs = ArrayBuffer.empty[(String, String)]
    -
    +      val schemaString = StructType.fromAttributes(projects.map(_.toAttribute)).catalogString
           // Mark filters which are handled by the underlying DataSource with an Astrisk
    -      if (pushedFilters.nonEmpty) {
    -        val markedFilters = for (filter <- pushedFilters) yield {
    +      relation match {
    +        case LogicalRelation(_: CatalystScan, _, _) if candidatePredicates.nonEmpty =>
    +          val markedPredicates = for (predicate <- candidatePredicates) yield {
    +            if (handledPredicates.contains(predicate)) s"*$predicate" else s"$predicate"
    +          }
    +          Map(
    +            "PushedCatalystFilters" -> markedPredicates.mkString("[", ", ", "]"),
    +            "ReadSchema" -> schemaString)
    +        case _ if pushedFilters.nonEmpty =>
    +          val markedFilters = for (filter <- pushedFilters) yield {
                 if (handledFilters.contains(filter)) s"*$filter" else s"$filter"
    -        }
    -        pairs += ("PushedFilters" -> markedFilters.mkString("[", ", ", "]"))
    +          }
    +          Map(
    +            "PushedFilters" -> markedFilters.mkString("[", ", ", "]"),
    +            "ReadSchema" -> schemaString)
    +        case _ =>
    +          Map("ReadSchema" -> schemaString)
           }
    -      pairs += ("ReadSchema" ->
    --- End diff --
    
    @gatorsmile, should I try to remove it here or is it fine as is for now?


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #18160: [SPARK-20938][SQL] Keep/print the string representation ...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/18160
  
    **[Test build #77657 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/77657/testReport)** for PR 18160 at commit [`5e8860e`](https://github.com/apache/spark/commit/5e8860e88058f9eec8bc016716ef1a7ce3331729).
     * This patch passes all tests.
     * This patch merges cleanly.
     * This patch adds no public classes.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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