Skip to content

Commit ff1a6c1

Browse files
committed
feat(cubesql): Coerce strings to any type in functions
Signed-off-by: Alex Qyoun-ae <[email protected]>
1 parent 6ce80bf commit ff1a6c1

File tree

5 files changed

+36
-13
lines changed

5 files changed

+36
-13
lines changed

packages/cubejs-backend-native/Cargo.lock

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rust/cubesql/Cargo.lock

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rust/cubesql/cubesql/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ homepage = "https://cube.dev"
1010

1111
[dependencies]
1212
arc-swap = "1"
13-
datafusion = { git = 'https://github.com/cube-js/arrow-datafusion.git', rev = "48ff05841a0758bba9d69c4918f724d9515d84a6", default-features = false, features = [
13+
datafusion = { git = 'https://github.com/cube-js/arrow-datafusion.git', rev = "cf034bac8babafdeb56d29a6bf75cbaa7912a8b4", default-features = false, features = [
1414
"regex_expressions",
1515
"unicode_expressions",
1616
] }

rust/cubesql/cubesql/src/compile/mod.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18170,4 +18170,18 @@ LIMIT {{ limit }}{% endif %}"#.to_string(),
1817018170
}
1817118171
)
1817218172
}
18173+
18174+
#[tokio::test]
18175+
async fn test_coerce_string_to_number() -> Result<(), CubeError> {
18176+
insta::assert_snapshot!(
18177+
"coerce_string_to_number",
18178+
execute_query(
18179+
"SELECT COS('0')".to_string(),
18180+
DatabaseProtocol::PostgreSQL
18181+
)
18182+
.await?
18183+
);
18184+
18185+
Ok(())
18186+
}
1817318187
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
source: cubesql/src/compile/mod.rs
3+
expression: "execute_query(\"SELECT COS('0')\".to_string(),\nDatabaseProtocol::PostgreSQL).await?"
4+
---
5+
+----------------+
6+
| cos(Utf8("0")) |
7+
+----------------+
8+
| 1 |
9+
+----------------+

0 commit comments

Comments
 (0)