datafusion_common/
schema_reference.rs1use std::sync::Arc;
6
7#[derive(Debug, Clone, PartialEq, Eq, Hash, PartialOrd, Ord)]
8pub enum SchemaReference {
9 Bare { schema: Arc<str> },
10 Full { schema: Arc<str>, catalog: Arc<str> },
11}
12
13impl SchemaReference {
14 pub fn schema_name(&self) -> &str {
16 match self {
17 SchemaReference::Bare { schema } => schema,
18 SchemaReference::Full { schema, catalog: _ } => schema,
19 }
20 }
21}
22
23impl std::fmt::Display for SchemaReference {
24 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
25 match self {
26 Self::Bare { schema } => write!(f, "{schema}"),
27 Self::Full { schema, catalog } => write!(f, "{catalog}.{schema}"),
28 }
29 }
30}