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.
- 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.
- floordiv(other)#
Build a floordiv expression.
The result always has an integer data type.
- ge(other)#
Build a greater or equal comparison with other.
- 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.
- 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
- 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
LiteralExpr#
Public API#
- class modin.experimental.core.execution.native.implementations.hdk_on_native.expr.LiteralExpr(val)#
An expression tree node to represent a literal value.
- Parameters
val (int, np.int, float, bool, str or None) – Literal value.
- val#
Literal value.
- Type
int, np.int, float, bool, str or None
- _dtype#
Literal data type.
- Type
dtype
- copy()#
Make a shallow copy of the 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
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 (str) – Aggregate name.
op (BaseExpr) – Aggregate operand.
distinct (bool, default: False) – Distinct modifier for ‘count’ aggregate.
dtype (dtype, optional) – Aggregate data type. Computed if not specified.
- 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.