Skip to content

Commit

Permalink
feat(cubesql): EXTRACT(EPOCH, ...) support (#7734)
Browse files Browse the repository at this point in the history
Co-authored-by: Alex Qyoun-ae <[email protected]>
  • Loading branch information
waralexrom and MazterQyou authored Feb 12, 2024
1 parent 0bc09fd commit b4deacd
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 13 deletions.
12 changes: 6 additions & 6 deletions packages/cubejs-backend-native/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions rust/cubesql/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion rust/cubesql/cubesql/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ homepage = "https://cube.dev"

[dependencies]
arc-swap = "1"
datafusion = { git = 'https://github.com/cube-js/arrow-datafusion.git', rev = "3c85ef6583587f5b0b037be5810e979bede9c7dc", default-features = false, features = ["regex_expressions", "unicode_expressions"] }
datafusion = { git = 'https://github.com/cube-js/arrow-datafusion.git', rev = "1abe9d5c7451e3d36c208801b0756fa9463f552e", default-features = false, features = ["regex_expressions", "unicode_expressions"] }
anyhow = "1.0"
thiserror = "1.0.50"
cubeclient = { path = "../cubeclient" }
Expand Down
15 changes: 15 additions & 0 deletions rust/cubesql/cubesql/src/compile/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19847,6 +19847,21 @@ limit
);
}

#[tokio::test]
async fn test_tableau_extract_epoch() -> Result<(), CubeError> {
init_logger();

insta::assert_snapshot!(
"tableau_extract_epoch",
execute_query(
"SELECT EXTRACT(EPOCH FROM (TIMESTAMP '2050-01-01T23:01:01.22')) as t".to_string(),
DatabaseProtocol::PostgreSQL
)
.await?
);
Ok(())
}

#[tokio::test]
async fn test_thoughtspot_pg_date_trunc_year() {
init_logger();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
source: cubesql/src/compile/mod.rs
expression: "execute_query(\"SELECT EXTRACT(EPOCH FROM (TIMESTAMP '2050-01-01T23:01:01.22')) as t\".to_string(),\n DatabaseProtocol::MySQL).await?"
---
+---------------+
| t |
+---------------+
| 2524690861.22 |
+---------------+

0 comments on commit b4deacd

Please sign in to comment.