diff --git a/rust/Cargo.lock b/rust/Cargo.lock index 64cd80cbac67..1e0bda1c9e7f 100644 --- a/rust/Cargo.lock +++ b/rust/Cargo.lock @@ -153,7 +153,7 @@ checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b" [[package]] name = "arrow" version = "5.0.0-SNAPSHOT" -source = "git+https://github.com/cube-js/arrow?branch=cubestore-2021-05-17#3a32e08e7665bf0f191089912adae59420748cf3" +source = "git+https://github.com/cube-js/arrow?branch=cubestore-2021-05-17#c23d6d9b9bfb3cc759ff36e59b96d035da2707b0" dependencies = [ "cfg_aliases", "chrono", @@ -175,7 +175,7 @@ dependencies = [ [[package]] name = "arrow-flight" version = "5.0.0-SNAPSHOT" -source = "git+https://github.com/cube-js/arrow?branch=cubestore-2021-05-17#3a32e08e7665bf0f191089912adae59420748cf3" +source = "git+https://github.com/cube-js/arrow?branch=cubestore-2021-05-17#c23d6d9b9bfb3cc759ff36e59b96d035da2707b0" dependencies = [ "arrow", "bytes 1.0.1", @@ -1121,7 +1121,7 @@ dependencies = [ [[package]] name = "datafusion" version = "5.0.0-SNAPSHOT" -source = "git+https://github.com/cube-js/arrow?branch=cubestore-2021-05-17#3a32e08e7665bf0f191089912adae59420748cf3" +source = "git+https://github.com/cube-js/arrow?branch=cubestore-2021-05-17#c23d6d9b9bfb3cc759ff36e59b96d035da2707b0" dependencies = [ "ahash 0.7.2", "arrow", @@ -2909,7 +2909,7 @@ dependencies = [ [[package]] name = "parquet" version = "5.0.0-SNAPSHOT" -source = "git+https://github.com/cube-js/arrow?branch=cubestore-2021-05-17#3a32e08e7665bf0f191089912adae59420748cf3" +source = "git+https://github.com/cube-js/arrow?branch=cubestore-2021-05-17#c23d6d9b9bfb3cc759ff36e59b96d035da2707b0" dependencies = [ "arrow", "base64 0.12.3", diff --git a/rust/cubestore-sql-tests/src/tests.rs b/rust/cubestore-sql-tests/src/tests.rs index 126605dfe4d3..8375a73d8e80 100644 --- a/rust/cubestore-sql-tests/src/tests.rs +++ b/rust/cubestore-sql-tests/src/tests.rs @@ -2214,18 +2214,31 @@ async fn having(service: Box) { .unwrap(); assert_eq!(to_rows(&r), rows(&[("a", 2), ("b", 1)])); + // We diverge from datafusion here, which resolve `n` in the HAVING to `sum(n)` and fail. + // At the moment CubeJS sends requests like this, though, so we choose to remove support for + // filtering on aliases in the same query. let r = service .exec_query( - "SELECT `data`.id, count(`data`.n) `cnt` \ + "SELECT `data`.id, sum(n) AS n \ FROM (SELECT * FROM s.Data1 UNION ALL SELECT * FROM s.Data2) `data` \ - WHERE n != 2 \ GROUP BY 1 \ - HAVING cnt = 2 \ + HAVING sum(n) > 5 \ ORDER BY 1", ) .await .unwrap(); - assert_eq!(to_rows(&r), rows(&[("a", 2), ("c", 2)])); + assert_eq!(to_rows(&r), rows(&[("b", 7), ("c", 9)])); + // Since we do not resolve aliases, this will fail. + let err = service + .exec_query( + "SELECT `data`.id, sum(n) AS n \ + FROM (SELECT * FROM s.Data1 UNION ALL SELECT * FROM s.Data2) `data` \ + GROUP BY 1 \ + HAVING n = 2 \ + ORDER BY 1", + ) + .await; + assert!(err.is_err()); fn rows(a: &[(&str, i64)]) -> Vec> { a.iter()