Class Hardwood

java.lang.Object
dev.hardwood.Hardwood
All Implemented Interfaces:
AutoCloseable

public class Hardwood extends Object implements AutoCloseable

Entry point for reading Parquet files with a shared thread pool.

Use this when reading multiple files to share the executor across readers:

try (Hardwood hardwood = Hardwood.create()) {
    ParquetFileReader file1 = hardwood.open(InputFile.of(path1));
    ParquetFileReader file2 = hardwood.open(InputFile.of(path2));
    // ...
}

For single-file usage, ParquetFileReader.open(InputFile) is simpler.

  • Method Details

    • create

      public static Hardwood create()
      Create a new Hardwood instance with a thread pool sized to available processors.
    • open

      public ParquetFileReader open(InputFile inputFile) throws IOException
      Open a single Parquet file. The file is opened immediately and closed when the returned reader is closed.
      Throws:
      IOException
    • openAll

      public ParquetFileReader openAll(List<InputFile> inputFiles) throws IOException
      Open multiple Parquet files for reading with cross-file prefetching. The schema is read from the first file. Files are opened on demand by the iterator and closed when the returned reader is closed.
      Parameters:
      inputFiles - the input files to read (must not be empty)
      Throws:
      IOException - if the first file cannot be opened or read
      IllegalArgumentException - if the list is empty
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable