Class Hardwood
java.lang.Object
dev.hardwood.Hardwood
- All Implemented Interfaces:
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(path1);
ParquetFileReader file2 = hardwood.open(path2);
// ...
}
For single-file usage, ParquetFileReader.open(Path) is simpler.
-
Method Summary
Modifier and TypeMethodDescriptionvoidclose()static Hardwoodcreate()Create a new Hardwood instance with a thread pool sized to available processors.static Hardwoodcreate(int threads) Create a new Hardwood instance with a thread pool of the specified size.Open a Parquet file for reading.Open multiple Parquet files for reading with cross-file prefetching.Open multiple Parquet files for reading with cross-file prefetching.
-
Method Details
-
create
Create a new Hardwood instance with a thread pool sized to available processors. -
create
Create a new Hardwood instance with a thread pool of the specified size. -
open
Open a Parquet file for reading.- Throws:
IOException
-
openAll
Open multiple Parquet files for reading with cross-file prefetching.Returns a
MultiFileParquetReaderthat reads the schema from the first file and provides factory methods for row-oriented (MultiFileParquetReader.createRowReader(ColumnProjection)) or column-oriented (MultiFileParquetReader.createColumnReaders(ColumnProjection)) access.- Parameters:
paths- the Parquet files to read (must not be empty)- Returns:
- a MultiFileParquetReader for the given files
- Throws:
IOException- if the first file cannot be opened or readIllegalArgumentException- if the paths list is empty
-
openAll
Open multiple Parquet files for reading with cross-file prefetching.- Parameters:
first- the first Parquet file to readfurtherPaths- additional Parquet files to read- Returns:
- a MultiFileParquetReader for the given files
- Throws:
IOException- if the first file cannot be opened or read
-
close
public void close()- Specified by:
closein interfaceAutoCloseable
-