Skip to content

Commit

Permalink
WIP -- add unknown symbol resolver to dynamic lookup
Browse files Browse the repository at this point in the history
  • Loading branch information
alancai98 committed Jul 27, 2023
1 parent b5d3fca commit 871f2f5
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions partiql-logical-planner/src/lower.rs
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,7 @@ impl<'a> AstToLogical<'a> {
}

fn resolve_varref(&self, varref: &ast::VarRef) -> logical::ValueExpr {
println!("varref: {:?}", varref);
// Convert a `SymbolPrimitive` into a `BindingsName`
fn symprim_to_binding(sym: &SymbolPrimitive) -> BindingsName {
match sym.case {
Expand Down Expand Up @@ -359,6 +360,19 @@ impl<'a> AstToLogical<'a> {
}
continue;
}
} else if let name_resolver::Symbol::Unknown(num) = produce
{
let formatted_num = format!("_{}", num);
if formatted_num == varref.name.value {
let expr = ValueExpr::VarRef(
BindingsName::CaseInsensitive(formatted_num),
VarRefType::Local,
);
if !lookups.contains(&expr) {
lookups.push(expr);
}
continue;
}
}
// else
let path = logical::ValueExpr::Path(
Expand All @@ -380,6 +394,7 @@ impl<'a> AstToLogical<'a> {
}
}
}
println!("lookups: {:?}", lookups);
return ValueExpr::DynamicLookup(Box::new(lookups));
}
}
Expand Down

0 comments on commit 871f2f5

Please sign in to comment.