MaxGekk commented on a change in pull request #27366: [SPARK-30648][SQL]
Support filters pushdown in JSON datasource
URL: https://github.com/apache/spark/pull/27366#discussion_r373363914
##########
File path:
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/json/JsonScanBuilder.scala
##########
@@ -29,8 +32,26 @@ class JsonScanBuilder (
schema: StructType,
dataSchema: StructType,
options: CaseInsensitiveStringMap)
- extends FileScanBuilder(sparkSession, fileIndex, dataSchema) {
+ extends FileScanBuilder(sparkSession, fileIndex, dataSchema) with
SupportsPushDownFilters {
override def build(): Scan = {
- JsonScan(sparkSession, fileIndex, dataSchema, readDataSchema(),
readPartitionSchema(), options)
+ JsonScan(
+ sparkSession,
+ fileIndex,
+ dataSchema,
+ readDataSchema(),
+ readPartitionSchema(),
+ options,
+ pushedFilters())
}
+
+ private var _pushedFilters: Array[Filter] = Array.empty
+
+ override def pushFilters(filters: Array[Filter]): Array[Filter] = {
+ if (sparkSession.sessionState.conf.csvFilterPushDown) {
Review comment:
I am even not sure that this check is needed because:
1. Actual disabling/enabling happens here:
https://github.com/apache/spark/pull/27366/files#diff-467cfe570f88d176aed53f30c3766356R67
2. The upper layer applies filters again.
@dongjoon-hyun In any case, thank you for detecting this, and start
reviewing the PR.
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]