mirror of
https://github.com/openobserve/openobserve.git
synced 2026-11-06 00:09:22 +00:00
fix: extrace field in case when (#4178)
This commit is contained in:
@@ -882,8 +882,8 @@ fn get_field_name_from_expr(expr: &SqlExpr) -> Result<Option<Vec<String>>, anyho
|
||||
SqlExpr::Case {
|
||||
operand: _,
|
||||
conditions,
|
||||
results: _,
|
||||
else_result: _,
|
||||
results,
|
||||
else_result,
|
||||
} => {
|
||||
let mut fields = Vec::new();
|
||||
for expr in conditions.iter() {
|
||||
@@ -891,6 +891,16 @@ fn get_field_name_from_expr(expr: &SqlExpr) -> Result<Option<Vec<String>>, anyho
|
||||
fields.extend(v);
|
||||
}
|
||||
}
|
||||
for expr in results.iter() {
|
||||
if let Some(v) = get_field_name_from_expr(expr)? {
|
||||
fields.extend(v);
|
||||
}
|
||||
}
|
||||
if let Some(expr) = else_result.as_ref() {
|
||||
if let Some(v) = get_field_name_from_expr(expr)? {
|
||||
fields.extend(v);
|
||||
}
|
||||
}
|
||||
Ok((!fields.is_empty()).then_some(fields))
|
||||
}
|
||||
SqlExpr::AtTimeZone { timestamp, .. } => get_field_name_from_expr(timestamp),
|
||||
|
||||
Reference in New Issue
Block a user