pub struct Relation<'a> {
pub name: Cow<'a, str>,
pub arguments: Option<Arguments<'a>>,
pub columns: Vec<Value<'a>>,
pub emit: Option<&'a EmitKind>,
addenda: AddendumLines,
pub children: Vec<Option<Relation<'a>>>,
}Fields§
§name: Cow<'a, str>§arguments: Option<Arguments<'a>>Arguments to the relation, if any.
Nonemeans this relation does not take arguments, and the argument section is omitted entirely.Some(args)with both vectors empty means the relation takes arguments, but none are provided; this will print as_ => ....Some(args)with non-empty vectors will print as usual, with positional arguments first, then named arguments, separated by commas.
columns: Vec<Value<'a>>The columns emitted by this relation, pre-emit - the ‘direct’ column output.
emit: Option<&'a EmitKind>The emit kind, if any. If none, use the columns directly.
addenda: AddendumLines+-prefixed addendum lines to emit between this relation’s header and
children. This owns the canonical ordering for + Ext, + Enh, and
+ Opt lines rather than making the generic relation shape grow one
field per addendum kind.
children: Vec<Option<Relation<'a>>>The input relations.
Implementations§
Source§impl Relation<'_>
impl Relation<'_>
Sourcepub fn write_header<S: Scope, W: Write>(&self, ctx: &S, w: &mut W) -> Result
pub fn write_header<S: Scope, W: Write>(&self, ctx: &S, w: &mut W) -> Result
Write the header for this relation, e.g. Filter[$0 => $0].
Usually a single line, but an argument list with ArgsLayout::Rows
(used by Read:Virtual with many rows) spans several lines:
Read:Virtual[
- (1, 'alice'),
- (2, 'bob')
- => id:i64, name:string]Does not write a trailing newline; callers are responsible for any newline that follows (either from an addendum or from the next child).
Source§impl<'a> Relation<'a>
impl<'a> Relation<'a>
fn from_filter<S: Scope>(rel: &'a FilterRel, ctx: &S) -> Self
fn from_project<S: Scope>(rel: &'a ProjectRel, ctx: &S) -> Self
pub fn from_rel<S: Scope>(rel: &'a Rel, ctx: &S) -> Self
fn from_extension_leaf<S: Scope>(rel: &'a ExtensionLeafRel, ctx: &S) -> Self
fn from_extension_single<S: Scope>(rel: &'a ExtensionSingleRel, ctx: &S) -> Self
fn from_extension_multi<S: Scope>(rel: &'a ExtensionMultiRel, ctx: &S) -> Self
fn from_extension<S: Scope>( ext_type: &'static str, decoded: Result<(String, ExtensionArgs), ExtensionError>, child_refs: Vec<Option<&'a Rel>>, ctx: &S, ) -> Self
Sourcefn from_aggregate<S: Scope>(rel: &'a AggregateRel, ctx: &S) -> Self
fn from_aggregate<S: Scope>(rel: &'a AggregateRel, ctx: &S) -> Self
Convert an AggregateRel to a Relation for textification.
The conversion follows this logic:
- Arguments: Group-by expressions (as Value::Expression)
- Columns: All possible outputs in order:
- First: Group-by field references (Value::Reference)
- Then: Aggregate function measures (Value::AggregateFunction)
- Emit: Uses the relation’s emit mapping to select which outputs to display
- Children: The input relation