MCPcopy Create free account
hub / github.com/apache/datafusion / idents_to_table_reference

Function idents_to_table_reference

datafusion/sql/src/planner.rs:982–1010  ·  view source on GitHub ↗

Create a [`TableReference`] after normalizing the specified identifier

(
    idents: Vec<Ident>,
    enable_normalization: bool,
)

Source from the content-addressed store, hash-verified

980
981/// Create a [`TableReference`] after normalizing the specified identifier
982pub(crate) fn idents_to_table_reference(
983 idents: Vec<Ident>,
984 enable_normalization: bool,
985) -> Result<TableReference> {
986 let mut taker = IdentTaker::new(idents, enable_normalization);
987
988 match taker.len() {
989 1 => {
990 let table = taker.take();
991 Ok(TableReference::bare(table))
992 }
993 2 => {
994 let table = taker.take();
995 let schema = taker.take();
996 Ok(TableReference::partial(schema, table))
997 }
998 3 => {
999 let table = taker.take();
1000 let schema = taker.take();
1001 let catalog = taker.take();
1002 Ok(TableReference::full(catalog, schema, table))
1003 }
1004 _ => plan_err!(
1005 "Unsupported compound identifier '{}'. Expected 1, 2 or 3 parts, got {}",
1006 taker,
1007 taker.len()
1008 ),
1009 }
1010}
1011
1012/// Construct a WHERE qualifier suitable for e.g. information_schema filtering
1013/// from the provided object identifiers (catalog, schema and table names).

Callers 1

Calls 3

newFunction · 0.85
lenMethod · 0.45
takeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…