Skip to main content

native_tree_supported

Function native_tree_supported 

Source
pub fn native_tree_supported(tree: &NativeTree) -> bool
Expand description

Whether the native runtime executes tree, answered from the tree itself.

This is the question the native route asks before it commits a statement: a tree the runtime refuses has to keep the plan it had, because a refusal raised during physical planning cannot fall back. It used to be answered by building a NativeExecutionState over the tree and dropping it, which allocates a runtime node per node per partition only to throw it away. Every term of the answer is bound on the tree, so the answer is read from the tree instead.

§What is refused

This lists what RuntimeNode::build (and the root check in NativeExecutionState::try_new) refuses, less what NativeNode::validate has already refused: a NativeTree exists only through NativeTree::try_new or Deserialize, and both validate, so a compiled tree’s per-node type contracts hold by the time this runs. What is left is the shape of the nodes, and the arithmetic each of them leaves to the runtime:

  • a root that answers raw samples, which has no positions to answer on;
  • an input leaf whose series chunks may interleave, which no consumer of a leaf can order;
  • scalar() over a vector carrying more than one field;
  • a binary node that is neither a vector–vector operation nor a broadcast the runtime performs: two constant operands (no series to carry the result), a scalar broadcast carrying vector-matching modifiers, or bool on an arithmetic operator, which has no bool form;
  • a quantile aggregate at any stage but Complete, which would need a partial state it does not keep (validate refuses one for the same reason; this arm keeps the predicate and the runtime agreeing on it);
  • an aggregate below Final whose by names a value field, which would fold series the existing plan keeps apart;
  • topk, bottomk, limitk, sort and sort_desc over a vector carrying more than one field, whose series have no one value to rank;
  • a topk, bottomk, limitk or count_values grouping that names a value field, and a count_values label that is empty;
  • a window whose anchored or smoothed modifier reads evaluated input, names a function its kernel does not correct, or carries a negative lookback;
  • a window whose timestamps do not fit: the fold offset an @ anchor turns into, or the one predict_linear adds to a point of the grid, where the sum leaves i64. Not a shape, but it is decided by the grid and the window alone, so this is where it is decided (see window_instants_fit).

§What NativeExecutionState::try_new still decides

Not every refusal is decided by the tree, and the ones below stay where the runtime builds:

  • a reservation the memory pool refuses, which no tree carries. Every site that admits a tree ran the trial build over an UnboundedMemoryPool, which refuses nothing, and none of them builds a runtime any more, so this is not a refusal admission can meet at any site;
  • a tree a test assembled directly, whose nodes disagree about their types, which NativeNode::validate rejects for every compiled one.