Skip to main content

ShapeNode

Enum ShapeNode 

Source
pub enum ShapeNode {
    Scalar {
        name: String,
        position: usize,
    },
    RawScalar,
    JsonScalar,
    Object {
        name: String,
        type_name: Option<String>,
        position: usize,
        cardinality: Cardinality,
        pointers: Vec<ShapeNode>,
        has_implicit_id: bool,
    },
    Array {
        name: String,
        position: usize,
        element: Box<ShapeNode>,
    },
    Tuple {
        position: usize,
        elements: Vec<ShapeNode>,
        names: Option<Vec<String>>,
    },
    NamedTuple {
        name: String,
        position: usize,
        type_name: Option<String>,
        members: Option<Vec<JsonMember>>,
        is_free_object: bool,
    },
    Enum {
        name: String,
        position: usize,
        enum_type: String,
    },
    VectorSearch {
        object_position: usize,
        distance_position: usize,
        object_node: Box<ShapeNode>,
    },
    FtsSearch {
        object_position: usize,
        rank_position: usize,
        object_node: Box<ShapeNode>,
    },
    Group {
        key_nodes: Vec<ShapeNode>,
        grouping_position: usize,
        elements_position: usize,
        element: Box<ShapeNode>,
    },
}
Expand description

Internal tree describing one position in the query output shape. Opaque to Python — only the Rust deserializer inspects it.

Variants§

§

Scalar

Leaf value; native PG type.

Fields

§name: String
§position: usize
§

RawScalar

The result column IS the value — not wrapped in ROW(). Used for array literals where an array is returned as its own top-level column.

§

JsonScalar

Like RawScalar but the value is a decoded JSON object (from a cast). REPL displays it as Json("...").

§

Object

Object shape. type_name = Some(s) → named schema type decoded to a registered dataclass. type_name = None → free type decoded to Pylon’s generic Object dataclass. name is the pointer name within the parent (empty string for the root).

Fields

§name: String
§type_name: Option<String>
§position: usize
§cardinality: Cardinality
§pointers: Vec<ShapeNode>
§has_implicit_id: bool

True when pointers[0] is an id the compiler added to a shape that did not select one — see IrScalarPointer::implicit_id. Every decoder hands it to the caller like any other property; only JSON output drops it.

§

Array

record[] column decoded to a Python list.

Fields

§name: String
§position: usize
§element: Box<ShapeNode>
§

Tuple

Anonymous positional tuple decoded to a Python tuple. No type name — no registry lookup. A composite tuple row, read by indexing rather than out of jsonb. names is set for a named tuple that had to be emitted as a composite because an element holds an object – jsonb has no member kind for one (see JsonMemberKind) – and decides whether this hydrates to a plain tuple or a NamedTupleValue.

Fields

§position: usize
§elements: Vec<ShapeNode>
§

NamedTuple

Named tuple decoded from jsonb. When type_name is Some, hydrated to the registered class. members carries the full per-member decode plan when statically known (a registered NamedTupleDescriptor’s members, a structural pylon.Tuple[...] property’s tuple_members, or a <tuple<...>>/nominal cast’s own target type) — None falls back to decoding the raw jsonb value generically (dict/list, no per-member typing).

Fields

§name: String
§position: usize
§type_name: Option<String>
§is_free_object: bool

True when this value came from { x := 1.0 } (curly-brace free- object syntax) rather than (x := 1.0) (paren tuple syntax) — decoded identically either way (both are jsonb), but the frontend’s own value-shape-tag tree (pylon/query.py’s shape_value_tags) uses this to tell the Python API layer to describe it as an “object” rather than a “namedTuple”, so JsonTree renders an expandable Object {x: 1.0} instead of a non-expandable (x := 1.0) tuple literal.

§

Enum

Enum value arrived as text; hydrated to the Python enum class keyed by enum_type.

Fields

§name: String
§position: usize
§enum_type: String

Pylon-qualified name, e.g. default::Gender.

§

VectorSearch

Result of a vector::search statement. The outer result tuple has three slots: 0 → NULL (virtual type, no registry lookup) object_position → the object sub-tuple (decoded as a Pylon object) distance_position → the distance scalar (float64)

Fields

§object_position: usize
§distance_position: usize
§object_node: Box<ShapeNode>
§

FtsSearch

Result of a fts::search statement. Outer tuple layout mirrors VectorSearch: pos 0 = NULL, pos 1 = object, pos 2 = score.

Fields

§object_position: usize
§rank_position: usize
§object_node: Box<ShapeNode>
§

Group

Result of a group statement: each row is a free object with key/grouping/elements.

Fields

§key_nodes: Vec<ShapeNode>

One ShapeNode per grouping key (carries name, position, and type). Positions are 1-based in the outer tuple (pos 0 is the NULL type slot).

§grouping_position: usize

Position of the ARRAY[key_names...]::text[] in the outer tuple.

§elements_position: usize

Position of the array_agg(elements) in the outer tuple.

§element: Box<ShapeNode>

Shape node for each element in the elements array.

Trait Implementations§

Source§

impl Clone for ShapeNode

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ShapeNode

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> ArchivePointee for T

Source§

type ArchivedMetadata = ()

The archived version of the pointer metadata for this type.
Source§

fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata

Converts some archived metadata to the pointer metadata for itself.
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> LayoutRaw for T

Source§

fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>

Returns the layout of the type.
Source§

impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
where T: SharedNiching<N1, N2>, N1: Niching<T>, N2: Niching<T>,

Source§

unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool

Returns whether the given value has been niched. Read more
Source§

fn resolve_niched(out: Place<NichedOption<T, N1>>)

Writes data to out indicating that a T is niched.
Source§

impl<T> Pointee for T

Source§

type Metadata = ()

The metadata type for pointers and references to this type.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more