Package dev.vortex.api
Class DataSource
java.lang.Object
dev.vortex.api.DataSource
- All Implemented Interfaces:
AutoCloseable
A set of Vortex files opened through a
Session. Data sources are cheap to open (only the first file is read
eagerly, to determine the schema) and can be scanned multiple times.
Call close() to release this handle and its cached file resources promptly. Scans and partitions already
created from it remain valid and retain the resources they still need. VortexCleaner releases an unclosed
handle when it becomes unreachable.
Native calls are synchronized with close() to prevent another thread from freeing the handle during an
operation.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfacePrecision-aware byte size.static interfacePrecision-aware row count. -
Method Summary
Modifier and TypeMethodDescriptionorg.apache.arrow.vector.types.pojo.SchemaarrowSchema(org.apache.arrow.memory.BufferAllocator allocator) Arrow schema of the data source (and of scans produced from it).byteSize()Sum of the on-storage byte sizes of all files included in this data source along with the precision of that estimate.voidclose()Releases this handle once; existing scans, partitions, and batches remain valid.static DataSourceopen(Session session, NativeReadable readable) Open a single file through a caller-provided byte source.static DataSourceOpen a single URI.static DataSourceOpen one or more URIs or globs.static DataSourceopen(Session session, List<NativeReadable> readables) Open files through caller-provided byte sources with the default read concurrency.static DataSourceopen(Session session, List<NativeReadable> readables, int readConcurrency) Open one or more files through caller-provided byte sources instead of native storage clients.static DataSourceOpen one or more URIs or globs.rowCount()Row count along with the precision of that estimate.scan(ScanOptions options) Submit a scan.
-
Method Details
-
open
Open a single URI. -
open
Open one or more URIs or globs. When a glob is used, the first match is opened eagerly; subsequent matches are opened lazily on scan.- Parameters:
session- open sessionuri- single URI or globproperties- object-store credentials / options
-
open
Open one or more URIs or globs. When a glob is used, the first match is opened eagerly; subsequent matches are opened lazily on scan.- Parameters:
session- open sessionuris- URIs or globs to scanproperties- object-store credentials / options
-
open
Open a single file through a caller-provided byte source. Seeopen(Session, List, int). -
open
Open files through caller-provided byte sources with the default read concurrency. -
open
Open one or more files through caller-provided byte sources instead of native storage clients. Every read the scan performs becomes an upcall into the correspondingNativeReadable, so this is the integration point for external I/O abstractions (for example Iceberg'sFileIO). Each file is identified byNativeReadable.name(), which must be unique withinreadables.The readables must remain open until this data source is closed and every derived scan, partition, and Arrow reader has finished reading. Native code never closes them.
- Parameters:
session- open sessionreadables- byte sourcesreadConcurrency- maximum in-flightreadFullycalls across all files of this data source;0selects the default. Each in-flight read occupies one native thread and typically one stream on its readable.
-
arrowSchema
public org.apache.arrow.vector.types.pojo.Schema arrowSchema(org.apache.arrow.memory.BufferAllocator allocator) Arrow schema of the data source (and of scans produced from it). -
rowCount
Row count along with the precision of that estimate. Mirrors the RustPrecision<u64>returned byDataSource::row_count:DataSource.RowCount.Unknownwhen no estimate is available,DataSource.RowCount.Estimatefor an inexact hint,DataSource.RowCount.Exactwhen the count is authoritative. -
byteSize
Sum of the on-storage byte sizes of all files included in this data source along with the precision of that estimate. Mirrors the RustOption<Precision<u64>>returned byDataSource::byte_size:DataSource.ByteSize.Unknownwhen no estimate is available (for example when the filesystem listing did not return sizes),DataSource.ByteSize.Estimatefor an inexact hint (some files contribute extrapolated sizes), andDataSource.ByteSize.Exactwhen every file has a known size. -
scan
Submit a scan. -
close
public void close()Releases this handle once; existing scans, partitions, and batches remain valid.- Specified by:
closein interfaceAutoCloseable
-