alamb commented on code in PR #4779:
URL: https://github.com/apache/arrow-datafusion/pull/4779#discussion_r1059653453
##########
datafusion/sql/src/planner.rs:
##########
@@ -1866,31 +1866,7 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> {
last_field,
fractional_seconds_precision,
),
- SQLExpr::Identifier(id) => {
- if id.value.starts_with('@') {
- // TODO: figure out if ScalarVariables should be
insensitive.
- let var_names = vec![id.value];
- let ty = self
- .schema_provider
- .get_variable_type(&var_names)
- .ok_or_else(|| {
- DataFusionError::Execution(format!(
- "variable {var_names:?} has no type
information"
- ))
- })?;
- Ok(Expr::ScalarVariable(ty, var_names))
- } else {
- // Don't use `col()` here because it will try to
- // interpret names with '.' as if they were
- // compound identifiers, but this is not a compound
- // identifier. (e.g. it is "foo.bar" not foo.bar)
-
- Ok(Expr::Column(Column {
- relation: None,
- name: normalize_ident(id),
- }))
- }
- }
+ SQLExpr::Identifier(id) => self.sql_identifier_to_expr(id),
Review Comment:
I just applied this pattern several times: extract code into a separate
function
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]