Skip to content

MINOR: Include local file paths in reader diagnostics - #3804

Merged
wgtmac merged 1 commit into
apache:masterfrom
1fanwang:1fannnw/report-local-parquet-path
Sep 23, 2026
Merged

wgtmac merged 1 commit into
apache:masterfrom
1fanwang:1fannnw/report-local-parquet-path

Conversation

@1fanwang

@1fanwang 1fanwang commented Sep 20, 2026

Copy link
Copy Markdown
Contributor

Rationale for this change

When a local Parquet file is invalid, the error shows a Java object ID instead of the filename. Callers cannot identify the failing input.

Related to #3354. This fixes the built-in local input implementation, not the third-party input in that report.

What changes are included in this PR?

Return the stored path from the local input's string representation, as Hadoop-backed inputs already do.

Are these changes tested?

Testing Done

On Java 17, the same program opens a real ten-byte file through the Parquet reader.

Before, at 2df8d02:

org.apache.parquet.io.LocalInputFile@6bffbc6d is not a Parquet file (length is too low: 10)

After:

invalid.parquet is not a Parquet file (length is too low: 10)

Run from either checkout:

mvn -q -pl parquet-hadoop -am -DskipTests package dependency:build-classpath -Dmdep.outputFile=target/runtime-classpath
java -cp "parquet-common/target/classes:parquet-hadoop/target/classes:$(cat parquet-hadoop/target/runtime-classpath)" target/InvalidLocalFileProbe.java invalid.parquet
Reproducer source

Save this as target/InvalidLocalFileProbe.java after the build:

import java.nio.file.Files;
import java.nio.file.Path;
import org.apache.parquet.hadoop.ParquetFileReader;
import org.apache.parquet.io.LocalInputFile;

class InvalidLocalFileProbe {
  public static void main(String[] args) throws Exception {
    Path path = Files.write(Path.of(args[0]), new byte[10]);
    try (ParquetFileReader ignored = ParquetFileReader.open(new LocalInputFile(path))) {
      throw new AssertionError("Invalid file was accepted");
    } catch (RuntimeException exception) {
      System.out.println(exception.getMessage());
    }
  }
}

Are there any user-facing changes?

Local-file errors and reader file identifiers now show the supplied path. File contents and read behavior are unchanged.

@wgtmac

wgtmac commented Sep 23, 2026

Copy link
Copy Markdown
Member

Thanks @1fanwang for fixing this and @divjotarora for the review!

@wgtmac
wgtmac merged commit 6247eaa into apache:master Sep 23, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants