You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2021/03/18 18:05:28 UTC
[GitHub] [spark] peter-toth commented on a change in pull request #31848: [SPARK-33482][SPARK-34756][SQL] Fix FileScan equality check
peter-toth commented on a change in pull request #31848:
URL: https://github.com/apache/spark/pull/31848#discussion_r597121998
##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/FileScan.scala
##########
@@ -84,11 +85,25 @@ trait FileScan extends Scan
protected def seqToString(seq: Seq[Any]): String = seq.mkString("[", ", ", "]")
+ private lazy val (normalizedPartitionFilters, normalizedDataFilters) = {
+ val output = readSchema().toAttributes.map(a => a.withName(normalizeName(a.name)))
+ val partitionFilterAttributes =
+ AttributeSet(partitionFilters).map(a => normalizeName(a.name) -> a).toMap
+ val dataFiltersAttributes = AttributeSet(dataFilters).map(a => normalizeName(a.name) -> a).toMap
+ val normalizedPartitionFilters = ExpressionSet(partitionFilters.map(
+ QueryPlan.normalizeExpressions(_,
+ output.map(a => partitionFilterAttributes.getOrElse(a.name, a)))))
+ val normalizedDataFilters = ExpressionSet(dataFilters.map(
+ QueryPlan.normalizeExpressions(_,
+ output.map(a => dataFiltersAttributes.getOrElse(a.name, a)))))
+ (normalizedPartitionFilters, normalizedDataFilters)
+ }
+
override def equals(obj: Any): Boolean = obj match {
Review comment:
Shall I update `hashCode()` as well? Looks like we can easily come up with a better one...
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org