BaseExpr#
Public API#
- class modin.experimental.core.execution.native.implementations.hdk_on_native.expr.BaseExpr#
An abstract base class for expression tree node.
An expression tree is used to describe how a single column of a dataframe is computed.
Each node can belong to multiple trees and therefore should be immutable until proven to have no parent nodes (e.g. by making a copy).
- operands#
Holds child nodes. Leaf nodes shouldn’t have operands attribute.
- Type:
list of BaseExpr, optional
- add(other)#
Build an add expression.
- bin_op(other, op_name)#
Build a binary operation expression.
- can_execute_arrow() bool #
Check for possibility of Arrow execution.
Check if the computation can be executed using the Arrow API instead of HDK query.
- Return type:
bool
- can_execute_hdk() bool #
Check for possibility of HDK execution.
Check if the computation can be executed using an HDK query.
- Return type:
bool
- cast(res_type)#
Build a cast expression.
- Parameters:
res_type (dtype) – A data type to cast to.
- Returns:
The cast expression.
- Return type:
- cmp(op, other)#
Build a comparison expression with other.
- collect_frames(frames)#
Recursively collect all frames participating in the expression.
Collected frames are put into the frames set. Default implementation collects frames from the operands of the expression. Derived classes directly holding frames should provide their own implementations.
- Parameters:
frames (set) – Output set of collected frames.
- eq(other)#
Build an equality comparison of self with other.
- execute_arrow(table: Table) ChunkedArray #
Compute the column data using the Arrow API.
- Parameters:
table (pa.Table) –
- Return type:
pa.ChunkedArray
- floordiv(other)#
Build a floordiv expression.
The result always has an integer data type.
- fold()#
Fold the operands.
This operation is used by TransformNode when translating to base.
- Return type:
- ge(other)#
Build a greater or equal comparison with other.
- invert() OpExpr #
Build a bitwise inverse expression.
- Returns:
The resulting bitwise inverse expression.
- Return type:
- is_not_null()#
Build a NOT NULL check expression.
- Returns:
The NOT NULL check expression.
- Return type:
- le(other)#
Build a less or equal comparison with other.
- mod(other)#
Build a mod expression.
- mul(other)#
Build a mul expression.
- nested_expressions() Generator[Type[BaseExpr], Type[BaseExpr], Type[BaseExpr]] #
Return a generator that allows to iterate over and replace the nested expressions.
If the generator receives a new expression, it creates a copy of self and replaces the expression in the copy. The copy is returned to the sender.
- Return type:
Generator
- pow(other)#
Build a power expression.
- sub(other)#
Build a sub expression.
- translate_input(mapper)#
Make a deep copy of the expression translating input nodes using mapper.
The default implementation builds a copy and recursively run translation for all its operands. For leaf expressions _translate_input is called.
- Parameters:
mapper (InputMapper) – A mapper to use for input columns translation.
- Returns:
The expression copy with translated input columns.
- Return type:
InputRefExpr#
Public API#
- class modin.experimental.core.execution.native.implementations.hdk_on_native.expr.InputRefExpr(frame, col, dtype)#
An expression tree node to represent an input frame column.
- Parameters:
frame (HdkOnNativeDataframe) – An input frame.
col (str) – An input column name.
dtype (dtype) – Input column data type.
- modin_frame#
An input frame.
- Type:
- column#
An input column name.
- Type:
str
- _dtype#
Input column data type.
- Type:
dtype
- can_execute_arrow() bool #
Check for possibility of Arrow execution.
Check if the computation can be executed using the Arrow API instead of HDK query.
- Return type:
bool
- collect_frames(frames)#
Add referenced frame to the frames set.
- Parameters:
frames (set) – Output set of collected frames.
- copy()#
Make a shallow copy of the expression.
- Return type:
- execute_arrow(table: Table) ChunkedArray #
Compute the column data using the Arrow API.
- Parameters:
table (pa.Table) –
- Return type:
pa.ChunkedArray
LiteralExpr#
Public API#
- class modin.experimental.core.execution.native.implementations.hdk_on_native.expr.LiteralExpr(val, dtype=None)#
An expression tree node to represent a literal value.
- Parameters:
val (int, np.int, float, bool, str, np.datetime64 or None) – Literal value.
dtype (None or dtype, default: None) – Value dtype.
- val#
Literal value.
- Type:
int, np.int, float, bool, str, np.datetime64 or None
- _dtype#
Literal data type.
- Type:
dtype
- can_execute_arrow() bool #
Check for possibility of Arrow execution.
Check if the computation can be executed using the Arrow API instead of HDK query.
- Return type:
bool
- cast(res_type)#
Build a cast expression.
- Parameters:
res_type (dtype) – A data type to cast to.
- Returns:
The cast expression.
- Return type:
- copy()#
Make a shallow copy of the expression.
- Return type:
- execute_arrow(table: Table) ChunkedArray #
Compute the column data using the Arrow API.
- Parameters:
table (pa.Table) –
- Return type:
pa.ChunkedArray
- fold()#
Fold the operands.
This operation is used by TransformNode when translating to base.
- Return type:
- is_not_null()#
Build a NULL check expression.
- Returns:
The NULL check expression.
- Return type:
OpExpr#
Public API#
- class modin.experimental.core.execution.native.implementations.hdk_on_native.expr.OpExpr(op, operands, dtype)#
A generic operation expression.
Used for arithmetic, comparisons, conditional operations, etc.
- Parameters:
op (str) – Operation name.
operands (list of BaseExpr) – Operation operands.
dtype (dtype) – Result data type.
- op#
Operation name.
- Type:
str
- _dtype#
Result data type.
- Type:
dtype
- partition_keys#
This attribute is used with window functions only and contains a list of column expressions to partition the result set.
- Type:
list of BaseExpr, optional
- order_keys#
This attribute is used with window functions only and contains order clauses.
- Type:
list of dict, optional
- lower_bound#
Lover bound for windowed aggregates.
- Type:
dict, optional
- upper_bound#
Upper bound for windowed aggregates.
- Type:
dict, optional
- can_execute_arrow() bool #
Check for possibility of Arrow execution.
Check if the computation can be executed using the Arrow API instead of HDK query.
- Return type:
bool
- can_execute_hdk() bool #
Check for possibility of HDK execution.
Check if the computation can be executed using an HDK query.
- Return type:
bool
- execute_arrow(table: Table) ChunkedArray #
Compute the column data using the Arrow API.
- Parameters:
table (pa.Table) –
- Return type:
pa.ChunkedArray
- fold()#
Fold the operands.
This operation is used by TransformNode when translating to base.
- Return type:
- nested_expressions() Generator[Type[BaseExpr], Type[BaseExpr], Type[BaseExpr]] #
Return a generator that allows to iterate over and replace the nested expressions.
If the generator receives a new expression, it creates a copy of self and replaces the expression in the copy. The copy is returned to the sender.
- Return type:
Generator
AggregateExpr#
Public API#
- class modin.experimental.core.execution.native.implementations.hdk_on_native.expr.AggregateExpr(agg, op, distinct=False, dtype=None)#
An aggregate operation expression.
- Parameters:
- agg#
Aggregate name.
- Type:
str
- distinct#
Distinct modifier for ‘count’ aggregate.
- Type:
bool
- _dtype#
Aggregate data type.
- Type:
dtype
- copy()#
Make a shallow copy of the expression.
- Return type:
Utilities#
Public API#
- modin.experimental.core.execution.native.implementations.hdk_on_native.expr.is_cmp_op(op)#
Check if operation is a comparison.
- Parameters:
op (str) – Operation to check.
- Returns:
True for comparison operations and False otherwise.
- Return type:
bool
- modin.experimental.core.execution.native.implementations.hdk_on_native.expr.build_row_idx_filter_expr(row_idx, row_col)#
Build an expression to filter rows by rowid.
- Parameters:
row_idx (int or list of int) – The row numeric indices to select.
row_col (InputRefExpr) – The rowid column reference expression.
- Returns:
The resulting filtering expression.
- Return type:
- modin.experimental.core.execution.native.implementations.hdk_on_native.expr.build_if_then_else(cond, then_val, else_val, res_type)#
Build a conditional operator expression.
- modin.experimental.core.execution.native.implementations.hdk_on_native.expr.build_dt_expr(dt_operation, col_expr)#
Build a datetime extraction expression.