Skip to content

[SPARK-52516][SQL] Don't hold previous iterator reference after advancing to next file in ParquetPartitionReaderFactory #51528

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

viirya
Copy link
Member

@viirya viirya commented Jul 17, 2025

What changes were proposed in this pull request?

This patch adds only one task completion listener for closing iterators in ParquetPartitionReaderFactory, instead of adding separate one for each file iterator.

Why are the changes needed?

For each file iterator, currently we add one task completion listener used to update closing the iterator when the task is finished. In the listener, the iterator reference is held. So if the file is normally exhausted, the reference cannot be released early. It is a problem especially if the reference are heavy as reported by apache/iceberg#13297.

Similar to #51503, we don't need set up a listener for each file iterator. Thus, we can set up just one listener for all iterator. Once we advance to next file, we can update the update target to new iterator.

Does this PR introduce any user-facing change?

No

How was this patch tested?

Existing tests.

Was this patch authored or co-authored using generative AI tooling?

No

@github-actions github-actions bot added the SQL label Jul 17, 2025
@viirya viirya changed the title [SPARK-XXXXX][SQL] Don't hold previous iterator reference after advancing to next file in ParquetPartitionReaderFactory [SPARK-52516][SQL] Don't hold previous iterator reference after advancing to next file in ParquetPartitionReaderFactory Jul 17, 2025
Copy link
Member

@dongjoon-hyun dongjoon-hyun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems that this causes many Parquet-related test case failures somehow. Could you double-check the test cases, @viirya ?

@dongjoon-hyun
Copy link
Member

cc @peter-toth

@viirya
Copy link
Member Author

viirya commented Jul 17, 2025

Sure, let me check it.

@viirya viirya force-pushed the fix_iter_callback branch from 7f2023d to d39dd1b Compare July 17, 2025 15:53
@viirya
Copy link
Member Author

viirya commented Jul 17, 2025

@dongjoon-hyun It should be fixed now. Thanks.

Copy link
Member

@dongjoon-hyun dongjoon-hyun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1, LGTM.

this.iter = iter
}

def execute(): Unit = {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

optional: closeCurrent()?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants