Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 9 additions & 16 deletions datafusion/substrait/src/logical_plan/consumer/rel/read_rel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,22 +86,15 @@ pub async fn from_read_rel(

match &read.read_type {
Some(ReadType::NamedTable(nt)) => {
let table_reference = match nt.names.len() {
0 => {
return plan_err!("No table name found in NamedTable");
}
1 => TableReference::Bare {
table: nt.names[0].clone().into(),
},
2 => TableReference::Partial {
schema: nt.names[0].clone().into(),
table: nt.names[1].clone().into(),
},
_ => TableReference::Full {
catalog: nt.names[0].clone().into(),
schema: nt.names[1].clone().into(),
table: nt.names[2].clone().into(),
},
// Normalize table names using DataFusion's identifier normalization
// (via TableReference::parse_str). Since Substrait has no concept of
// quoted identifiers, all names are treated as unquoted — this ensures
// interoperability with producers like Calcite/Isthmus that emit
// uppercase names (e.g. "LINEITEM" -> "lineitem").
let table_reference = if nt.names.is_empty() {
return plan_err!("No table name found in NamedTable");
} else {
TableReference::parse_str(&nt.names.join("."))
};

read_with_schema(
Expand Down
Loading