You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Uroš Bojanić (Jira)" <ji...@apache.org> on 2026/08/11 11:57:00 UTC

[jira] [Commented] (SPARK-58711) Use StructType.getFieldIndex in Parquet and ORC aggregate push down

    [ https://issues.apache.org/jira/browse/SPARK-58711?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18103665#comment-18103665 ] 

Uroš Bojanić commented on SPARK-58711:
--------------------------------------

In progress: https://github.com/apache/spark/pull/57929.

> Use StructType.getFieldIndex in Parquet and ORC aggregate push down
> -------------------------------------------------------------------
>
>                 Key: SPARK-58711
>                 URL: https://issues.apache.org/jira/browse/SPARK-58711
>             Project: Spark
>          Issue Type: Improvement
>          Components: SQL
>    Affects Versions: 4.3.0
>            Reporter: Uroš Bojanić
>            Priority: Major
>              Labels: pull-request-available
>
> The aggregate push down paths look up a column position with dataSchema.fieldNames.indexOf(name). fieldNames is a def that allocates a fresh Array on every call, and the Parquet variant additionally converts it to a List, so each lookup allocates twice and then scans linearly. StructType.getFieldIndex reads a cached name to index map instead.
> This switches the three Parquet sites and the one ORC site to getFieldIndex, and replaces a partitionSchema.fields.map(_.name).toSet.contains check, which built a set per call, with getFieldIndex(...).isDefined.
> This is a readability and allocation cleanup rather than a measurable speedup: aggregate push down is off by default and the surrounding work reads Parquet or ORC footer statistics, which dominates.
> Behavior is unchanged. getOrElse(-1) matches the not-found contract of indexOf, and the exact-match variant is used rather than the case-insensitive one. The two forms would differ only for a schema with duplicate column names, where indexOf returns the first match and a name keyed map the last; FileTable rejects duplicate column names in both schemas before a scan is built, so that case is unreachable.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org