fix: Fix repeatedly url-decode path when reading parquet from s3 using native parquet reader#2138
Merged
mbutrovich merged 4 commits intoapache:mainfrom Aug 18, 2025
Merged
Conversation
…ive parquet reader
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2138 +/- ##
============================================
+ Coverage 56.12% 58.48% +2.36%
- Complexity 976 1257 +281
============================================
Files 119 143 +24
Lines 11743 13204 +1461
Branches 2251 2372 +121
============================================
+ Hits 6591 7723 +1132
- Misses 4012 4254 +242
- Partials 1140 1227 +87 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Contributor
kazuyukitanimura
left a comment
There was a problem hiding this comment.
Thank you @Kontinuation
| CometConf.SCAN_NATIVE_ICEBERG_COMPAT).foreach(scanMode => { | ||
| withSQLConf(CometConf.COMET_NATIVE_SCAN_IMPL.key -> scanMode) { | ||
| val df = | ||
| spark.read.format("parquet").load(testFilePath).agg(sum(col("id")), max(col("val"))) |
Contributor
There was a problem hiding this comment.
Should we include a test with encoded url?
E.g. Brand%2321
This is based on your description
if the S3 path has escape sequences, it will corrupt the path and we'll end up getting an error, or silently reading the wrong data.
Member
Author
There was a problem hiding this comment.
I have added another test for testing encoded url explicitly.
9405aee to
630ed52
Compare
kazuyukitanimura
approved these changes
Aug 14, 2025
Contributor
kazuyukitanimura
left a comment
There was a problem hiding this comment.
pending with CI
coderfender
pushed a commit
to coderfender/datafusion-comet
that referenced
this pull request
Dec 13, 2025
…g native parquet reader (apache#2138) * Fix repeatedly url-decode path when reading parquet from s3 using native parquet reader * Make ParquetReadFromS3Suite runs using all scan impls * test: support URL escape sequences in write path * Improve S3 parquet read tests
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Which issue does this PR close?
Closes #2139.
Rationale for this change
The S3 object store support for the native parquet reader incorrectly url-decode the path. The path should already been url-decoded so decoding it again will corrupt the original path. If the path does not contain escape sequences then it is fine. However, if the S3 path has escape sequences, it will corrupt the path and we'll end up getting an error, or silently reading the wrong data.
I found S3 paths containing escape sequences when reading a partitioned table. The partition key contains a '#' character and the S3 paths for files in the partitioned table are something like this:
Note that
Brand%2321is part of the original S3 path, not the url-encoded path. The partition key isBrand#21, the directory names of partitioned tables are url-encoded by design to support any character sequences.If we url-decode this path twice, the resulting path will be
s3://bucket_name/path/to/data/p_brand=Brand#21/part-xxxx.parquet, which is different from the original path.What changes are included in this PR?
This PR fixes the repeated S3 path url-decoding. Now native parquet reader could correctly handle S3 paths containing escape sequences.
How are these changes tested?
Add a new Scala test which writes a partitioned table with partition key containing '#' character and read it back using Comet.