pub struct SimpleExtensions {
urns: BTreeMap<u32, String>,
extensions: BTreeMap<(u32, ExtensionKind), (u32, CompoundName)>,
}Expand description
ExtensionLookup contains mappings from anchors to extension URNs, functions, types, and type variations.
Fields§
§urns: BTreeMap<u32, String>§extensions: BTreeMap<(u32, ExtensionKind), (u32, CompoundName)>Implementations§
Source§impl SimpleExtensions
impl SimpleExtensions
pub fn new() -> Self
pub fn from_extensions<'a>( urns: impl IntoIterator<Item = &'a SimpleExtensionUrn>, extensions: impl IntoIterator<Item = &'a SimpleExtensionDeclaration>, ) -> (Self, Vec<InsertError>)
pub fn add_extension_urn( &mut self, urn: String, anchor: u32, ) -> Result<(), InsertError>
pub fn add_extension( &mut self, kind: ExtensionKind, urn: u32, anchor: u32, name: String, ) -> Result<(), InsertError>
pub fn is_empty(&self) -> bool
Sourcepub fn to_extension_urns(&self) -> Vec<SimpleExtensionUrn>
pub fn to_extension_urns(&self) -> Vec<SimpleExtensionUrn>
Convert the extension URNs to protobuf format for Plan construction.
Sourcepub fn to_extension_declarations(&self) -> Vec<SimpleExtensionDeclaration>
pub fn to_extension_declarations(&self) -> Vec<SimpleExtensionDeclaration>
Convert the extensions to protobuf format for Plan construction.
Sourcepub fn write<W: Write>(&self, w: &mut W, indent: &str) -> Result
pub fn write<W: Write>(&self, w: &mut W, indent: &str) -> Result
Write the extensions to the given writer, with the given indent.
The header will be included if there are any extensions.
pub fn to_string(&self, indent: &str) -> String
Source§impl SimpleExtensions
impl SimpleExtensions
pub fn find_urn(&self, anchor: u32) -> Result<&str, MissingReference>
pub fn find_by_anchor( &self, kind: ExtensionKind, anchor: u32, ) -> Result<(u32, &CompoundName), MissingReference>
pub fn find_by_name( &self, kind: ExtensionKind, name: &str, ) -> Result<u32, MissingReference>
Sourcepub fn is_name_unique(
&self,
kind: ExtensionKind,
anchor: u32,
name: &str,
) -> Result<bool, MissingReference>
pub fn is_name_unique( &self, kind: ExtensionKind, anchor: u32, name: &str, ) -> Result<bool, MissingReference>
Returns true when no other extension of the same kind has the same
full compound name (i.e. the anchor display can be suppressed).
Returns Err when anchor is not registered for kind.
Sourcepub fn lookup_function(
&self,
anchor: u32,
) -> Result<ResolvedFunction<'_>, MissingReference>
pub fn lookup_function( &self, anchor: u32, ) -> Result<ResolvedFunction<'_>, MissingReference>
Look up a function anchor and return its full resolution metadata.
The caller already has anchor from the
Substrait plan and needs the name, URN, and uniqueness flags.
Sourcepub fn resolve_function(
&self,
name: &str,
anchor: Option<u32>,
) -> Result<ResolvedFunction<'_>, MissingReference>
pub fn resolve_function( &self, name: &str, anchor: Option<u32>, ) -> Result<ResolvedFunction<'_>, MissingReference>
Resolve a function name (plain or compound) with an optional explicit
anchor to a ResolvedFunction.
the caller has a text name and an optional anchor
from the plan source and needs the canonical anchor plus uniqueness info.
anchor = Some(a)— validates thatnamematches the stored name (exact compound-name match or base-name match, e.g."equal"matches stored"equal:any_any").anchor = None— tries an exact match first; if not found andnamecontains no:, falls back to base-name search so thatequal(…)resolves whenequal:any_anyis the only overload.
fn is_base_name_unique( &self, kind: ExtensionKind, anchor: u32, ) -> Result<bool, MissingReference>
fn find_by_base_name( &self, kind: ExtensionKind, base: &str, ) -> Result<u32, MissingReference>
Trait Implementations§
Source§impl Clone for SimpleExtensions
impl Clone for SimpleExtensions
Source§fn clone(&self) -> SimpleExtensions
fn clone(&self) -> SimpleExtensions
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more