From c7736ccb2c3e1fd809d98adf58bad012fc38c8b7 Mon Sep 17 00:00:00 2001 From: Alex Qyoun-ae <4062971+MazterQyou@users.noreply.github.com> Date: Fri, 8 Mar 2024 09:41:59 +0400 Subject: [PATCH] fix(cubesql): Fix push down column remapping --- rust/cubesql/cubesql/src/compile/engine/df/wrapper.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/rust/cubesql/cubesql/src/compile/engine/df/wrapper.rs b/rust/cubesql/cubesql/src/compile/engine/df/wrapper.rs index 077b9ecb5ecf3..762e4b9f7a470 100644 --- a/rust/cubesql/cubesql/src/compile/engine/df/wrapper.rs +++ b/rust/cubesql/cubesql/src/compile/engine/df/wrapper.rs @@ -901,10 +901,19 @@ impl CubeScanWrapperNode { }; if !next_remapping.contains_key(&Column::from_name(&alias)) { next_remapping.insert(original_alias_key, Column::from_name(&alias)); + let original_relation = if let Expr::Column(column) = &original_expr { + if column.relation.is_some() { + &column.relation + } else { + &from_alias + } + } else { + &from_alias + }; next_remapping.insert( Column { name: original_alias.clone(), - relation: from_alias.clone(), + relation: original_relation.clone(), }, Column { name: alias.clone(),