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

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

Reply via email to