Skip to content

Commit

Permalink
fix: escape column names correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
chebbyChefNEQ committed Feb 27, 2024
1 parent ea621cc commit 639bdba
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion rust/lance/src/dataset/scanner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,13 @@ pub struct Scanner {
fragments: Option<Vec<Fragment>>,
}

fn escape_column_name(name: &str) -> String {
name.split(".")
.map(|s| format!("`{}`", s))
.collect::<Vec<_>>()
.join(".")
}

impl Scanner {
pub fn new(dataset: Arc<Dataset>) -> Self {
let projection = dataset.schema().clone();
Expand Down Expand Up @@ -254,7 +261,7 @@ impl Scanner {
self.project_with_transform(
&columns
.iter()
.map(|c| (c.as_ref(), format!("`{}`", c.as_ref())))
.map(|c| (c.as_ref(), escape_column_name(c.as_ref())))
.collect::<Vec<_>>(),
)
}
Expand Down

0 comments on commit 639bdba

Please sign in to comment.