Class SimpleTableProvider
- All Implemented Interfaces:
TableProvider
TableProvider that pairs a fixed Schema with a function that opens a fresh
ArrowReader for each scan. Provided as a convenience for the common case where there is
no projection / filter pushdown to implement.
Each call to scan(BufferAllocator) invokes the supplied function and returns whatever
ArrowReader it produces, so the function MUST return a fresh, independent reader on every
invocation (see the contract on TableProvider.scan(BufferAllocator)).
As TableProvider grows additional methods in the future, this class will provide
defaults so existing callers keep working without changes.
-
Constructor Summary
ConstructorsConstructorDescriptionSimpleTableProvider(org.apache.arrow.vector.types.pojo.Schema schema, Function<org.apache.arrow.memory.BufferAllocator, org.apache.arrow.vector.ipc.ArrowReader> scanFn) -
Method Summary
-
Constructor Details
-
SimpleTableProvider
public SimpleTableProvider(org.apache.arrow.vector.types.pojo.Schema schema, Function<org.apache.arrow.memory.BufferAllocator, org.apache.arrow.vector.ipc.ArrowReader> scanFn) - Parameters:
schema- the table schema; returned as-is fromschema()scanFn- called on everyscan(BufferAllocator)with the framework-supplied allocator; must return a fresh, independentArrowReadereach time
-
-
Method Details
-
schema
public org.apache.arrow.vector.types.pojo.Schema schema()Description copied from interface:TableProviderThe fixed schema of this table. Called once, at registration time.- Specified by:
schemain interfaceTableProvider
-
scan
public org.apache.arrow.vector.ipc.ArrowReader scan(org.apache.arrow.memory.BufferAllocator allocator) Description copied from interface:TableProviderOpen a fresh batch stream for this table. Called once per physical scan of the table — a single query may invoke this more than once (self-joins,UNION ALLover the same table, etc.).Each invocation MUST return an independent
ArrowReader. The reader's schema MUST equalTableProvider.schema(). The reader's buffers MUST be allocated fromallocator(or from a child of it) — the framework needs the reader's allocator hierarchy to share a root with the one it passes here. The allocator contract mirrors the one onScalarFunction.evaluate(org.apache.arrow.memory.BufferAllocator, org.apache.datafusion.ScalarFunctionArgs).- Specified by:
scanin interfaceTableProvider
-