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_r373472555
##########
File path:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/json/JacksonParser.scala
##########
@@ -334,15 +336,19 @@ class JacksonParser(
private def convertObject(
parser: JsonParser,
schema: StructType,
- fieldConverters: Array[ValueConverter]): InternalRow = {
+ fieldConverters: Array[ValueConverter],
+ structFilters: StructFilters = new NoopFilters()): Option[InternalRow] =
{
val row = new GenericInternalRow(schema.length)
var badRecordException: Option[Throwable] = None
+ var skipRow = false
- while (nextUntil(parser, JsonToken.END_OBJECT)) {
+ structFilters.reset()
+ while (!skipRow && nextUntil(parser, JsonToken.END_OBJECT)) {
schema.getFieldIndex(parser.getCurrentName) match {
case Some(index) =>
try {
row.update(index, fieldConverters(index).apply(parser))
+ skipRow = structFilters.skipRow(row, index)
Review comment:
> if we happen to push down predicates that refer nested columns.
I did some experiments, and found out that filters with nested attributes
are not pushed down.
----------------------------------------------------------------
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]