1fanwang opened a new pull request, #3557:
URL: https://github.com/apache/parquet-java/pull/3557

   ### Rationale for this change
   
   When a non-Parquet file is opened through `LocalInputFile`, 
`ParquetFileReader.readFooter` builds the error message via `file.toString()`. 
`LocalInputFile` inherits the default `Object.toString()`, so the error reads:
   
   ```
   org.apache.parquet.io.LocalInputFile@7852e922 is not a Parquet file (length 
is too low: 5)
   ```
   
   `HadoopInputFile` already overrides `toString()` to return its 
`path.toString()`. This PR does the same for `LocalInputFile`. The reporter on 
#3354 saw this through Delta Kernel's `InputFile` impl, but parquet-java's own 
`LocalInputFile` has the identical shape and reproduces locally.
   
   (The broader fix — adding `default String getPath()` to the `InputFile` 
interface so `ParquetFileReader` can call it with a sensible fallback for any 
third-party impl — is left for a follow-up if reviewers want it. This PR keeps 
scope to the built-in impl.)
   
   ### What changes are included in this PR?
   
   - `parquet-common/src/main/java/org/apache/parquet/io/LocalInputFile.java`: 
override `toString()` to return `path.toString()`.
   - 
`parquet-common/src/test/java/org/apache/parquet/io/TestLocalInputOutput.java`: 
new test `inputFileToStringReturnsPath` asserting `LocalInputFile.toString()` 
equals the underlying path string. Fails on master (`expected:</var/.../...tmp> 
but was:<org.apache.parquet.io.LocalInputFile@61443d8f>`), passes with the fix.
   
   ### Are these changes tested?
   
   Yes. New `inputFileToStringReturnsPath` test in `TestLocalInputOutput`. 
Failed before the fix, passes after; the 4 pre-existing tests in the file 
continue to pass.
   
   ### Are there any user-facing changes?
   
   The "is not a Parquet file" error now shows the path instead of the object 
hash. No API change.
   
   Closes #3354


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

To unsubscribe, e-mail: [email protected]

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