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 CompoundName written in the plan to a ResolvedFunction.
anchor = Some(a)— the anchor identifies the function; the name is validated for consistency usingCompoundName::matches.anchor = None— the name must be unambiguous on its own:- Simple (no
:): base-name search; fails if more than one function shares that base name. - Full (has
:): exact match only.
- Simple (no
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