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 [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]