CalciteSerializer#

Public API#

class modin.experimental.core.execution.native.implementations.hdk_on_native.calcite_serializer.CalciteSerializer#

Serializer for calcite node sequence.

CalciteSerializer is used to serialize a sequence of CalciteBaseNode based nodes including nested BaseExpr based expression trees into a request in JSON format which can be fed to HDK.

expect_one_of(val, *types)#

Raise an error if values doesn’t belong to any of specified types.

Parameters:
  • val (Any) – Value to check.

  • *types (list of type) – Allowed value types.

opts_for_int_type(int_type)#

Get serialization params for an integer type.

Return a SQL type name and a number of meaningful decimal digits for an integer type.

Parameters:

int_type (type) – An integer type to describe.

Return type:

tuple

serialize(plan)#

Serialize a sequence of Calcite nodes into JSON format.

Parameters:

plan (list of CalciteBaseNode) – A sequence to serialize.

Returns:

A query in JSON format.

Return type:

str

serialize_dtype(dtype)#

Serialize data type to a dictionary.

Parameters:

dtype (dtype) – Data type to serialize.

Returns:

Serialized data type.

Return type:

dict

serialize_expr(expr)#

Serialize BaseExpr based expression into a dictionary.

Parameters:

expr (BaseExpr) – An expression to serialize.

Returns:

Serialized expression.

Return type:

dict

serialize_input_idx(expr)#

Serialize CalciteInputIdxExpr expression.

Parameters:

expr (CalciteInputIdxExpr) – An expression to serialize.

Returns:

Serialized expression.

Return type:

int

serialize_item(item)#

Serialize a single expression item.

Parameters:

item (Any) – Item to serialize.

Returns:

Serialized item.

Return type:

str, int, None, dict or list of dict

serialize_literal(literal)#

Serialize LiteralExpr into a dictionary.

Parameters:

literal (LiteralExpr) – A literal to serialize.

Returns:

Serialized literal.

Return type:

dict

serialize_node(node)#

Serialize a frame operation.

Parameters:

node (CalciteBaseNode) – A node to serialize.

Returns:

Serialized object.

Return type:

dict

serialize_obj(obj)#

Serialize an object into a dictionary.

Add all non-hidden attributes (not starting with ‘_’) of the object to the output dictionary.

Parameters:

obj (object) – An object to serialize.

Returns:

Serialized object.

Return type:

dict

serialize_typed_obj(obj)#

Serialize an object and its dtype into a dictionary.

Similar to serialize_obj but also include ‘_dtype’ field of the object under ‘type’ key.

Parameters:

obj (object) – An object to serialize.

Returns:

Serialized object.

Return type:

dict