cloud-fan commented on a change in pull request #27366:
URL: https://github.com/apache/spark/pull/27366#discussion_r450189798



##########
File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/json/JsonFilters.scala
##########
@@ -0,0 +1,133 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.spark.sql.catalyst.json
+
+import org.apache.spark.sql.catalyst.{InternalRow, StructFilters}
+import org.apache.spark.sql.catalyst.expressions._
+import org.apache.spark.sql.internal.SQLConf
+import org.apache.spark.sql.sources
+import org.apache.spark.sql.types.StructType
+
+/**
+ * The class provides API for applying pushed down source filters to rows with
+ * struct schema parsed from JSON records. It assumes that:
+ *   1. reset() is called before any skipRow() calls for new row.
+ *   2. skipRow() can be called for any valid index of the struct fields,
+ *      and in any order.
+ *
+ * @param pushedFilters The pushed down source filters. The filters should 
refer to
+ *                      the fields of the provided schema.
+ * @param schema The required schema of records from datasource files.
+ */
+class JsonFilters(pushedFilters: Seq[sources.Filter], schema: StructType)

Review comment:
       can we have a big picture to explain how it works? e.g.
   1. the json parser reads out one entire json record
   2. iterate the json fields, and run the corresponding predicate for each 
field
   3. if the json record can't be skipped, convert to internal row.
   
   And also explain how to define the predicate for each field. IIUC:
   1. for the first field, run the predicate that only refer to the first field
   2. for the second field, run the predicate that refers to both the first and 
second field
   3. ....




----------------------------------------------------------------
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]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to