hyped.core.nodes.trace module

This module defines the TraceNode.

The TraceNode class is a specialized node designed to apply trace indices through a specified path in a partition graph. It transforms input values by tracing the sequence of partition transitions and applying the corresponding trace indices at each step.

class hyped.core.nodes.trace.TraceNode(config: None | U = None, **kwargs)[source]

Bases: BaseNode[TraceNodeConfig]

A node that applies trace indices through a specified partition path.

This node traces a path in the partition graph as specified in the configuration and applies the trace indices for each transition between partitions to transform the input values.

call(*args: Any, **kwargs: Any) Any[source]

Raises an error, as direct calls are not supported for this node.

property signature: Any

Raises an error, as signature is not supported for this node.

trace_values_through_partition_path(ctx: RunContext, values: Array, traces: dict[tuple[str, str], ndarray]) Array[source]

Apply trace indices through the partition path to transform the provided values.

This method traces the specified path in the partition graph and applies the trace indices of each partition transition to generate a final trace index. The resulting index is used to transform the provided values.

Parameters:
  • ctx (RunContext) – The runtime context.

  • values (pa.Array) – The values to be transformed.

  • target_batch_size (int) – The target batch size.

  • traces (dict[tuple[PartitionId, PartitionId], np.ndarray]) – A dictionary mapping partition transitions to their corresponding trace indices.

Returns:

A transformed PyArrow array where values have been modified

according to the trace indices along the specified path.

Return type:

pa.Array

class hyped.core.nodes.trace.TraceNodeConfig(*, path: tuple[str, ...])[source]

Bases: BaseNodeConfig

Configuration for a TraceNode.

model_config = {'extra': 'forbid', 'validate_default': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

path: tuple[str, ...]

The path through the partition graph

A tuple representing the ordered sequence of partition identifiers that define the path in the partition graph.