Skip to content

Commit db2ab96

Browse files
committed
fix(cubesql): Fix incorrect underscore truncation for aliases
1 parent 40b3708 commit db2ab96

File tree

1 file changed

+8
-2
lines changed
  • rust/cubesql/cubesql/src/compile/engine/df

1 file changed

+8
-2
lines changed

rust/cubesql/cubesql/src/compile/engine/df/wrapper.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -415,8 +415,14 @@ impl Remapper {
415415
static NON_ID_REGEX: LazyLock<Regex> =
416416
LazyLock::new(|| Regex::new(r"[^a-zA-Z0-9_]").unwrap());
417417

418-
let alias = start_from;
419-
let mut truncated_alias = NON_ID_REGEX.replace_all(&alias, "_").to_lowercase();
418+
let alias_lower = start_from.clone().to_lowercase();
419+
let mut truncated_alias =
420+
if !alias_lower.contains("__user") && !alias_lower.contains("__cubejoinfield") {
421+
NON_ID_REGEX.replace_all(&alias_lower, "_").to_string()
422+
} else {
423+
alias_lower
424+
};
425+
420426
truncated_alias.truncate(16);
421427
let mut alias = truncated_alias.clone();
422428
for i in 1..10000 {

0 commit comments

Comments
 (0)