[GitHub] [spark] gengliangwang commented on a change in pull request #27157: [SPARK-30475][SQL] File source V2: Push data filters for file listing
gengliangwang commented on a change in pull request #27157: [SPARK-30475][SQL] File source V2: Push data filters for file listing URL: https://github.com/apache/spark/pull/27157#discussion_r368189535 ## File path: external/avro/src/test/scala/org/apache/spark/sql/avro/AvroSuite.scala ## @@ -1575,6 +1576,36 @@ class AvroV2Suite extends AvroSuite { } } + test("Avro source v2: support passing data filters to FileScan without partitionFilters") { +withTempPath { dir => + Seq(("a", 1, 2), ("b", 1, 2), ("c", 2, 1)) +.toDF("value", "p1", "p2") +.write +.format("avro") +.option("header", true) Review comment: For Avro data source, `.option("header", true)` is not needed. 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: us...@infra.apache.org With regards, Apache Git Services - To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org
[GitHub] [spark] gengliangwang commented on a change in pull request #27157: [SPARK-30475][SQL] File source V2: Push data filters for file listing
gengliangwang commented on a change in pull request #27157: [SPARK-30475][SQL] File source V2: Push data filters for file listing URL: https://github.com/apache/spark/pull/27157#discussion_r368189550 ## File path: external/avro/src/test/scala/org/apache/spark/sql/avro/AvroSuite.scala ## @@ -1575,6 +1576,36 @@ class AvroV2Suite extends AvroSuite { } } + test("Avro source v2: support passing data filters to FileScan without partitionFilters") { +withTempPath { dir => + Seq(("a", 1, 2), ("b", 1, 2), ("c", 2, 1)) +.toDF("value", "p1", "p2") +.write +.format("avro") +.option("header", true) +.save(dir.getCanonicalPath) + val df = spark +.read +.format("avro") +.option("header", true) Review comment: Ditto. 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: us...@infra.apache.org With regards, Apache Git Services - To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org
[GitHub] [spark] gengliangwang commented on a change in pull request #27157: [SPARK-30475][SQL] File source V2: Push data filters for file listing
gengliangwang commented on a change in pull request #27157: [SPARK-30475][SQL] File source V2: Push data filters for file listing URL: https://github.com/apache/spark/pull/27157#discussion_r365019992 ## File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/FileScan.scala ## @@ -65,6 +65,16 @@ trait FileScan extends Scan with Batch with SupportsReportStatistics with Loggin */ def withPartitionFilters(partitionFilters: Seq[Expression]): FileScan + /** + * Returns the filters that can be use for file listing + */ + def dataFilters: Seq[Expression] Review comment: > def withFilters(partitionFilters: Seq[Expression], dataFilters: Seq[Expression]): FileScan this one seems good 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: us...@infra.apache.org With regards, Apache Git Services - To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org
[GitHub] [spark] gengliangwang commented on a change in pull request #27157: [SPARK-30475][SQL] File source V2: Push data filters for file listing
gengliangwang commented on a change in pull request #27157: [SPARK-30475][SQL] File source V2: Push data filters for file listing URL: https://github.com/apache/spark/pull/27157#discussion_r365620745 ## File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/PruneFileSourcePartitions.scala ## @@ -28,20 +28,25 @@ import org.apache.spark.sql.types.StructType private[sql] object PruneFileSourcePartitions extends Rule[LogicalPlan] { - private def getPartitionKeyFilters( + private def getPartitionKeyFiltersAndDataFilters( sparkSession: SparkSession, relation: LeafNode, partitionSchema: StructType, filters: Seq[Expression], - output: Seq[AttributeReference]): ExpressionSet = { + output: Seq[AttributeReference]): (ExpressionSet, Seq[Expression]) = { val normalizedFilters = DataSourceStrategy.normalizeExprs( filters.filter(f => f.deterministic && !SubqueryExpression.hasSubquery(f)), output) val partitionColumns = relation.resolve(partitionSchema, sparkSession.sessionState.analyzer.resolver) val partitionSet = AttributeSet(partitionColumns) -ExpressionSet(normalizedFilters.filter { f => +val partitionKeyFilters = ExpressionSet(normalizedFilters.filter { f => Review comment: how about use normalizedFilters.partition to get `partitionKeyFilters` and `dataFilters` in one loop 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: us...@infra.apache.org With regards, Apache Git Services - To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org