Skip to content

Commit eabbdc2

Browse files
committed
fix(cubesql): Allow interval sum chaining
1 parent 1ef01dd commit eabbdc2

File tree

4 files changed

+43
-11
lines changed

4 files changed

+43
-11
lines changed

rust/cubesql/Cargo.lock

Lines changed: 10 additions & 9 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: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ documentation = "https://cube.dev/docs"
99
homepage = "https://cube.dev"
1010

1111
[dependencies]
12-
datafusion = { git = 'https://github.com/cube-js/arrow-datafusion.git', rev = "c9761d716dee9546142d4ef3716466b4cb012f3e", default-features = false, features = ["unicode_expressions"] }
12+
datafusion = { git = 'https://github.com/cube-js/arrow-datafusion.git', rev = "ba127294a6694ec4a90f62b3987df0d84637d432", default-features = false, features = ["unicode_expressions"] }
1313
anyhow = "1.0"
1414
thiserror = "1.0"
1515
cubeclient = { path = "../cubeclient" }
1616
pg-srv = { path = "../pg-srv" }
17-
sqlparser = { git = 'https://github.com/cube-js/sqlparser-rs.git', rev = "19f730c8274b39f55224824c98687dc55aa95c92" }
17+
sqlparser = { git = 'https://github.com/cube-js/sqlparser-rs.git', rev = "13aff89fcbc3545c92a94ce771bafa739363fad5" }
1818
lazy_static = "1.4.0"
1919
base64 = "0.13.0"
2020
tokio = { version = "1.0", features = ["full", "rt", "tracing"] }

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

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7634,6 +7634,28 @@ ORDER BY \"COUNT(count)\" DESC"
76347634
Ok(())
76357635
}
76367636

7637+
#[tokio::test]
7638+
async fn test_interval_sum() -> Result<(), CubeError> {
7639+
insta::assert_snapshot!(
7640+
"interval_sum",
7641+
execute_query(
7642+
r#"
7643+
SELECT
7644+
TO_TIMESTAMP('2019-01-01 00:00:00', 'yyyy-MM-dd HH24:mi:ss')
7645+
+ INTERVAL '1 MONTH'
7646+
+ INTERVAL '1 WEEK'
7647+
+ INTERVAL '1 DAY'
7648+
AS t
7649+
"#
7650+
.to_string(),
7651+
DatabaseProtocol::PostgreSQL
7652+
)
7653+
.await?
7654+
);
7655+
7656+
Ok(())
7657+
}
7658+
76377659
#[tokio::test]
76387660
async fn superset_meta_queries() -> Result<(), CubeError> {
76397661
init_logger();
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(r#\"\n SELECT\n TO_TIMESTAMP('2019-01-01 00:00:00', 'yyyy-MM-dd HH24:mi:ss')\n + INTERVAL '1 MONTH'\n + INTERVAL '1 WEEK'\n + INTERVAL '1 DAY'\n AS t\n \"#.to_string(),\n DatabaseProtocol::PostgreSQL).await?"
4+
---
5+
+-------------------------+
6+
| t |
7+
+-------------------------+
8+
| 2019-02-09T00:00:00.000 |
9+
+-------------------------+

0 commit comments

Comments
 (0)