pyarrow.acero.Declaration#
- class pyarrow.acero.Declaration(factory_name, ExecNodeOptions options, inputs=None)#
Bases:
_Weakrefable
Helper class for declaring the nodes of an ExecPlan.
A Declaration represents an unconstructed ExecNode, and potentially more since its inputs may also be Declarations or when constructed with
from_sequence
.The possible ExecNodes to use are registered with a name, the “factory name”, and need to be specified using this name, together with its corresponding ExecNodeOptions subclass.
- Parameters:
- factory_name
str
The ExecNode factory name, such as “table_source”, “filter”, “project” etc. See the ExecNodeOptions subclasses for the exact factory names to use.
- options
ExecNodeOptions
Corresponding ExecNodeOptions subclass (matching the factory name).
- inputs
list
ofDeclaration
, optional Input nodes for this declaration. Optional if the node is a source node, or when the declaration gets combined later with
from_sequence
.
- factory_name
- Returns:
- __init__(*args, **kwargs)#
Methods
__init__
(*args, **kwargs)from_sequence
(decls)Convenience factory for the common case of a simple sequence of nodes.
to_reader
(self, bool use_threads=True)Run the declaration and return results as a RecordBatchReader.
to_table
(self, bool use_threads=True)Run the declaration and collect the results into a table.
- static from_sequence(decls)#
Convenience factory for the common case of a simple sequence of nodes.
Each of the declarations will be appended to the inputs of the subsequent declaration, and the final modified declaration will be returned.
- Parameters:
- decls
list
ofDeclaration
- decls
- Returns:
- to_reader(self, bool use_threads=True)#
Run the declaration and return results as a RecordBatchReader.
For details about the parameters, see to_table.
- Returns:
- to_table(self, bool use_threads=True)#
Run the declaration and collect the results into a table.
This method will implicitly add a sink node to the declaration to collect results into a table. It will then create an ExecPlan from the declaration, start the exec plan, block until the plan has finished, and return the created table.
- Parameters:
- Returns: