diff --git a/rust/cubesql/Cargo.lock b/rust/cubesql/Cargo.lock index 1cab9c5771e58..9d85e91aff29e 100644 --- a/rust/cubesql/Cargo.lock +++ b/rust/cubesql/Cargo.lock @@ -970,7 +970,7 @@ dependencies = [ [[package]] name = "cube-ext" version = "1.0.0" -source = "git+https://github.com/cube-js/arrow-datafusion.git?rev=90f0168023bce6b7fa44d3473dd052afd444ca54#90f0168023bce6b7fa44d3473dd052afd444ca54" +source = "git+https://github.com/cube-js/arrow-datafusion.git?rev=915a600ea4d3b66161cd77ff94747960f840816e#915a600ea4d3b66161cd77ff94747960f840816e" dependencies = [ "arrow", "chrono", @@ -1103,7 +1103,7 @@ dependencies = [ [[package]] name = "datafusion" version = "7.0.0" -source = "git+https://github.com/cube-js/arrow-datafusion.git?rev=90f0168023bce6b7fa44d3473dd052afd444ca54#90f0168023bce6b7fa44d3473dd052afd444ca54" +source = "git+https://github.com/cube-js/arrow-datafusion.git?rev=915a600ea4d3b66161cd77ff94747960f840816e#915a600ea4d3b66161cd77ff94747960f840816e" dependencies = [ "ahash", "arrow", @@ -1136,7 +1136,7 @@ dependencies = [ [[package]] name = "datafusion-common" version = "7.0.0" -source = "git+https://github.com/cube-js/arrow-datafusion.git?rev=90f0168023bce6b7fa44d3473dd052afd444ca54#90f0168023bce6b7fa44d3473dd052afd444ca54" +source = "git+https://github.com/cube-js/arrow-datafusion.git?rev=915a600ea4d3b66161cd77ff94747960f840816e#915a600ea4d3b66161cd77ff94747960f840816e" dependencies = [ "arrow", "ordered-float 2.10.0", @@ -1147,7 +1147,7 @@ dependencies = [ [[package]] name = "datafusion-data-access" version = "1.0.0" -source = "git+https://github.com/cube-js/arrow-datafusion.git?rev=90f0168023bce6b7fa44d3473dd052afd444ca54#90f0168023bce6b7fa44d3473dd052afd444ca54" +source = "git+https://github.com/cube-js/arrow-datafusion.git?rev=915a600ea4d3b66161cd77ff94747960f840816e#915a600ea4d3b66161cd77ff94747960f840816e" dependencies = [ "async-trait", "chrono", @@ -1160,7 +1160,7 @@ dependencies = [ [[package]] name = "datafusion-expr" version = "7.0.0" -source = "git+https://github.com/cube-js/arrow-datafusion.git?rev=90f0168023bce6b7fa44d3473dd052afd444ca54#90f0168023bce6b7fa44d3473dd052afd444ca54" +source = "git+https://github.com/cube-js/arrow-datafusion.git?rev=915a600ea4d3b66161cd77ff94747960f840816e#915a600ea4d3b66161cd77ff94747960f840816e" dependencies = [ "ahash", "arrow", @@ -1171,7 +1171,7 @@ dependencies = [ [[package]] name = "datafusion-physical-expr" version = "7.0.0" -source = "git+https://github.com/cube-js/arrow-datafusion.git?rev=90f0168023bce6b7fa44d3473dd052afd444ca54#90f0168023bce6b7fa44d3473dd052afd444ca54" +source = "git+https://github.com/cube-js/arrow-datafusion.git?rev=915a600ea4d3b66161cd77ff94747960f840816e#915a600ea4d3b66161cd77ff94747960f840816e" dependencies = [ "ahash", "arrow", diff --git a/rust/cubesql/cubesql/Cargo.toml b/rust/cubesql/cubesql/Cargo.toml index d58b878c45c97..992306b636d56 100644 --- a/rust/cubesql/cubesql/Cargo.toml +++ b/rust/cubesql/cubesql/Cargo.toml @@ -9,7 +9,7 @@ documentation = "https://cube.dev/docs" homepage = "https://cube.dev" [dependencies] -datafusion = { git = 'https://github.com/cube-js/arrow-datafusion.git', rev = "90f0168023bce6b7fa44d3473dd052afd444ca54", default-features = false, features = ["regex_expressions", "unicode_expressions"] } +datafusion = { git = 'https://github.com/cube-js/arrow-datafusion.git', rev = "915a600ea4d3b66161cd77ff94747960f840816e", default-features = false, features = ["regex_expressions", "unicode_expressions"] } anyhow = "1.0" thiserror = "1.0" cubeclient = { path = "../cubeclient" } diff --git a/rust/cubesql/cubesql/src/compile/mod.rs b/rust/cubesql/cubesql/src/compile/mod.rs index ccb7e65736393..d5a5fcdf3831d 100644 --- a/rust/cubesql/cubesql/src/compile/mod.rs +++ b/rust/cubesql/cubesql/src/compile/mod.rs @@ -12912,6 +12912,33 @@ ORDER BY \"COUNT(count)\" DESC" Ok(()) } + #[tokio::test] + async fn test_holistics_date_trunc_date32() -> Result<(), CubeError> { + insta::assert_snapshot!( + "holistics_date_trunc_date32", + execute_query( + " + with \"h__dates\" AS ( + SELECT + CAST ('2023-02-01' AS date) as \"start_range\", + CAST ( '2023-02-28' AS date ) as \"end_range\", + 28 as \"length\" + ) + SELECT + DATE_TRUNC( 'month', \"start_range\") AS \"dm_ddt_d_6e2110\", + MAX(\"length\") AS \"h_dates_length\" + FROM \"h__dates\" + GROUP BY 1 + " + .to_string(), + DatabaseProtocol::PostgreSQL + ) + .await? + ); + + Ok(()) + } + #[tokio::test] async fn test_holistics_group_by_date() { init_logger(); diff --git a/rust/cubesql/cubesql/src/compile/snapshots/cubesql__compile__tests__holistics_date_trunc_date32.snap b/rust/cubesql/cubesql/src/compile/snapshots/cubesql__compile__tests__holistics_date_trunc_date32.snap new file mode 100644 index 0000000000000..d31c3c5c91451 --- /dev/null +++ b/rust/cubesql/cubesql/src/compile/snapshots/cubesql__compile__tests__holistics_date_trunc_date32.snap @@ -0,0 +1,9 @@ +--- +source: cubesql/src/compile/mod.rs +expression: "execute_query(\"\n with \\\"h__dates\\\" AS (\n SELECT\n CAST ('2023-02-01' AS date) as \\\"start_range\\\",\n CAST ( '2023-02-28' AS date ) as \\\"end_range\\\",\n 28 as \\\"length\\\"\n )\n SELECT\n DATE_TRUNC( 'month', \\\"start_range\\\") AS \\\"dm_ddt_d_6e2110\\\",\n MAX(\\\"length\\\") AS \\\"h_dates_length\\\"\n FROM \\\"h__dates\\\"\n GROUP BY 1\n \".to_string(),\n DatabaseProtocol::PostgreSQL).await?" +--- ++-------------------------+----------------+ +| dm_ddt_d_6e2110 | h_dates_length | ++-------------------------+----------------+ +| 2023-02-01T00:00:00.000 | 28 | ++-------------------------+----------------+