Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
KKould authored Dec 7, 2024
1 parent 5ac7795 commit d857919
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/binder/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ impl<'a, T: Transaction> Binder<'a, '_, T> {
try_default!(&full_name.0, full_name.1);
}
if let Some(table) = full_name.0.or(bind_table_name) {
let source = self.context.bind_source(&table, self.parent)?;
let source = self.context.bind_source(&table)?;
let schema_buf = self.table_schema_buf.entry(Arc::new(table)).or_default();

Ok(ScalarExpression::ColumnRef(
Expand Down
8 changes: 1 addition & 7 deletions src/binder/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -272,18 +272,12 @@ impl<'a, T: Transaction> BinderContext<'a, T> {
Ok(source)
}

pub fn bind_source<'b: 'a>(
&self,
table_name: &str,
parent: Option<&'b Binder<'a, 'b, T>>,
) -> Result<&Source, DatabaseError> {
pub fn bind_source<'b: 'a>(&self, table_name: &str) -> Result<&Source, DatabaseError> {
if let Some(source) = self.bind_table.iter().find(|((t, alias, _), _)| {
t.as_str() == table_name
|| matches!(alias.as_ref().map(|a| a.as_str() == table_name), Some(true))
}) {
Ok(source.1)
} else if let Some(binder) = parent {
binder.context.bind_source(table_name, binder.parent)
} else {
Err(DatabaseError::InvalidTable(table_name.into()))
}
Expand Down

0 comments on commit d857919

Please sign in to comment.