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 2023/01/06 11:08:47 UTC
[GitHub] [spark] LuciferYang commented on a diff in pull request #39408: [SPARK-41896][SQL] Filtering by row index returns empty results
LuciferYang commented on code in PR #39408:
URL: https://github.com/apache/spark/pull/39408#discussion_r1063345512
##########
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/FileSourceStrategy.scala:
##########
@@ -258,6 +258,24 @@ object FileSourceStrategy extends Strategy with PredicateHelper with Logging {
val outputAttributes = readDataColumns ++ generatedMetadataColumns ++
partitionColumns ++ constantMetadataColumns
+
+ // The metadata attribute references in the filters also have to be categorized as either
+ // constant or generated metadata attributes. Only data filters can contain metadata filters.
+ def categorizeFileSourceMetadataAttributesInFilters(
+ filters: Seq[Expression]): Seq[Expression] =
+ filters.map { filter =>
+ filter.transform {
+ case attr: AttributeReference if FileSourceMetadataAttribute.unapply(attr).isDefined =>
+ if (attr.dataType.asInstanceOf[StructType].fieldNames
+ .forall(fieldName => constantMetadataColumns.exists(fieldName == _.name))) {
Review Comment:
a complex conditional expression, extracting a function may look clearer
--
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.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
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