diff --git a/rust/cubesql/Cargo.lock b/rust/cubesql/Cargo.lock index 8a70bb8ad3b30..d242eca44bea1 100644 --- a/rust/cubesql/Cargo.lock +++ b/rust/cubesql/Cargo.lock @@ -802,7 +802,7 @@ dependencies = [ [[package]] name = "datafusion" version = "7.0.0" -source = "git+https://github.com/cube-js/arrow-datafusion.git?rev=5ee92140f026524639ed3675942af62b45dc2913#5ee92140f026524639ed3675942af62b45dc2913" +source = "git+https://github.com/cube-js/arrow-datafusion.git?rev=8b6b910152c8bc5dc88e3957c600cf98977d82d8#8b6b910152c8bc5dc88e3957c600cf98977d82d8" dependencies = [ "ahash", "arrow", @@ -834,7 +834,7 @@ dependencies = [ [[package]] name = "datafusion-common" version = "7.0.0" -source = "git+https://github.com/cube-js/arrow-datafusion.git?rev=5ee92140f026524639ed3675942af62b45dc2913#5ee92140f026524639ed3675942af62b45dc2913" +source = "git+https://github.com/cube-js/arrow-datafusion.git?rev=8b6b910152c8bc5dc88e3957c600cf98977d82d8#8b6b910152c8bc5dc88e3957c600cf98977d82d8" dependencies = [ "arrow", "ordered-float 2.10.0", @@ -845,7 +845,7 @@ dependencies = [ [[package]] name = "datafusion-data-access" version = "1.0.0" -source = "git+https://github.com/cube-js/arrow-datafusion.git?rev=5ee92140f026524639ed3675942af62b45dc2913#5ee92140f026524639ed3675942af62b45dc2913" +source = "git+https://github.com/cube-js/arrow-datafusion.git?rev=8b6b910152c8bc5dc88e3957c600cf98977d82d8#8b6b910152c8bc5dc88e3957c600cf98977d82d8" dependencies = [ "async-trait", "chrono", @@ -858,7 +858,7 @@ dependencies = [ [[package]] name = "datafusion-expr" version = "7.0.0" -source = "git+https://github.com/cube-js/arrow-datafusion.git?rev=5ee92140f026524639ed3675942af62b45dc2913#5ee92140f026524639ed3675942af62b45dc2913" +source = "git+https://github.com/cube-js/arrow-datafusion.git?rev=8b6b910152c8bc5dc88e3957c600cf98977d82d8#8b6b910152c8bc5dc88e3957c600cf98977d82d8" dependencies = [ "ahash", "arrow", @@ -869,7 +869,7 @@ dependencies = [ [[package]] name = "datafusion-physical-expr" version = "7.0.0" -source = "git+https://github.com/cube-js/arrow-datafusion.git?rev=5ee92140f026524639ed3675942af62b45dc2913#5ee92140f026524639ed3675942af62b45dc2913" +source = "git+https://github.com/cube-js/arrow-datafusion.git?rev=8b6b910152c8bc5dc88e3957c600cf98977d82d8#8b6b910152c8bc5dc88e3957c600cf98977d82d8" dependencies = [ "ahash", "arrow", diff --git a/rust/cubesql/cubesql/Cargo.toml b/rust/cubesql/cubesql/Cargo.toml index ac4c50139400a..925877415f66d 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 = "5ee92140f026524639ed3675942af62b45dc2913", default-features = false, features = ["unicode_expressions"] } +datafusion = { git = 'https://github.com/cube-js/arrow-datafusion.git', rev = "8b6b910152c8bc5dc88e3957c600cf98977d82d8", default-features = false, features = ["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 f316cd533d775..1018e9f4cc520 100644 --- a/rust/cubesql/cubesql/src/compile/mod.rs +++ b/rust/cubesql/cubesql/src/compile/mod.rs @@ -6792,7 +6792,36 @@ ORDER BY \"COUNT(count)\" DESC" insta::assert_snapshot!( "superset_subquery", execute_query( - "SELECT a.attname, pg_catalog.format_type(a.atttypid, a.atttypmod), (SELECT format_type(d.adbin, d.adrelid) FROM pg_catalog.pg_attrdef d WHERE d.adrelid = a.attrelid AND d.adnum = a.attnum AND a.atthasdef) AS DEFAULT, a.attnotnull, a.attnum, a.attrelid as table_oid, pgd.description as comment, a.attgenerated as generated FROM pg_catalog.pg_attribute a LEFT JOIN pg_catalog.pg_description pgd ON ( pgd.objoid = a.attrelid AND pgd.objsubid = a.attnum) WHERE a.attrelid = 13449 AND a.attnum > 0 AND NOT a.attisdropped ORDER BY a.attnum;".to_string(), + " + SELECT + a.attname, + pg_catalog.format_type(a.atttypid, a.atttypmod), + ( + SELECT pg_catalog.pg_get_expr(d.adbin, d.adrelid) + FROM pg_catalog.pg_attrdef d + WHERE + d.adrelid = a.attrelid AND + d.adnum = a.attnum AND + a.atthasdef + ) AS DEFAULT, + a.attnotnull, + a.attnum, + a.attrelid as table_oid, + pgd.description as comment, + a.attgenerated as generated + FROM pg_catalog.pg_attribute a + LEFT JOIN pg_catalog.pg_description pgd ON ( + pgd.objoid = a.attrelid AND + pgd.objsubid = a.attnum + ) + WHERE + a.attrelid = 18000 + AND a.attnum > 0 + AND NOT a.attisdropped + ORDER BY a.attnum + ; + " + .to_string(), DatabaseProtocol::PostgreSQL ) .await? diff --git a/rust/cubesql/cubesql/src/compile/snapshots/cubesql__compile__tests__explain-2.snap b/rust/cubesql/cubesql/src/compile/snapshots/cubesql__compile__tests__explain-2.snap index 90c899c34df94..5847f39b012d0 100644 --- a/rust/cubesql/cubesql/src/compile/snapshots/cubesql__compile__tests__explain-2.snap +++ b/rust/cubesql/cubesql/src/compile/snapshots/cubesql__compile__tests__explain-2.snap @@ -1,6 +1,5 @@ --- source: cubesql/src/compile/mod.rs -assertion_line: 5809 expression: "execute_query(\"EXPLAIN VERBOSE SELECT 1+1;\".to_string(),\n DatabaseProtocol::MySQL).await?" --- +-------------------------------------------------------+--------------------------------------+ @@ -25,7 +24,6 @@ expression: "execute_query(\"EXPLAIN VERBOSE SELECT 1+1;\".to_string(),\n | physical_plan after aggregate_statistics | SAME TEXT AS ABOVE | | physical_plan after hash_build_probe_order | SAME TEXT AS ABOVE | | physical_plan after coalesce_batches | SAME TEXT AS ABOVE | -| physical_plan after repartition | SAME TEXT AS ABOVE | | physical_plan after add_merge_exec | SAME TEXT AS ABOVE | | physical_plan | ProjectionExec: expr=[2 as Int64(2)] | | | EmptyExec: produce_one_row=true | diff --git a/rust/cubesql/cubesql/src/compile/snapshots/cubesql__compile__tests__superset_subquery.snap b/rust/cubesql/cubesql/src/compile/snapshots/cubesql__compile__tests__superset_subquery.snap index b4fda61fa300e..f6bfa490255dd 100644 --- a/rust/cubesql/cubesql/src/compile/snapshots/cubesql__compile__tests__superset_subquery.snap +++ b/rust/cubesql/cubesql/src/compile/snapshots/cubesql__compile__tests__superset_subquery.snap @@ -1,8 +1,18 @@ --- source: cubesql/src/compile/mod.rs -assertion_line: 5341 -expression: "execute_query(\"SELECT a.attname, pg_catalog.format_type(a.atttypid, a.atttypmod), (SELECT format_type(d.adbin, d.adrelid) FROM pg_catalog.pg_attrdef d WHERE d.adrelid = a.attrelid AND d.adnum = a.attnum AND a.atthasdef) AS DEFAULT, a.attnotnull, a.attnum, a.attrelid as table_oid, pgd.description as comment, a.attgenerated as generated FROM pg_catalog.pg_attribute a LEFT JOIN pg_catalog.pg_description pgd ON ( pgd.objoid = a.attrelid AND pgd.objsubid = a.attnum) WHERE a.attrelid = 13449 AND a.attnum > 0 AND NOT a.attisdropped ORDER BY a.attnum;\".to_string(),\n DatabaseProtocol::PostgreSQL).await?" +expression: "execute_query(\"\n SELECT\n a.attname,\n pg_catalog.format_type(a.atttypid, a.atttypmod),\n (\n SELECT pg_catalog.pg_get_expr(d.adbin, d.adrelid)\n FROM pg_catalog.pg_attrdef d\n WHERE\n d.adrelid = a.attrelid AND\n d.adnum = a.attnum AND\n a.atthasdef\n ) AS DEFAULT,\n a.attnotnull,\n a.attnum,\n a.attrelid as table_oid,\n pgd.description as comment,\n a.attgenerated as generated\n FROM pg_catalog.pg_attribute a\n LEFT JOIN pg_catalog.pg_description pgd ON (\n pgd.objoid = a.attrelid AND\n pgd.objsubid = a.attnum\n )\n WHERE\n a.attrelid = 18000\n AND a.attnum > 0\n AND NOT a.attisdropped\n ORDER BY a.attnum\n ;\n \".to_string(),\n DatabaseProtocol::PostgreSQL).await?" --- -++ -++ -++ ++--------------------+------------------------------------------------+---------+------------+--------+-----------+---------+-----------+ +| attname | pg_catalog.format_type(a.atttypid,a.atttypmod) | DEFAULT | attnotnull | attnum | table_oid | comment | generated | ++--------------------+------------------------------------------------+---------+------------+--------+-----------+---------+-----------+ +| count | bigint | NULL | true | 1 | 18000 | NULL | | +| maxPrice | numeric | NULL | true | 2 | 18000 | NULL | | +| minPrice | numeric | NULL | true | 3 | 18000 | NULL | | +| avgPrice | numeric | NULL | true | 4 | 18000 | NULL | | +| order_date | timestamp without time zone | NULL | false | 5 | 18000 | NULL | | +| customer_gender | text | NULL | false | 6 | 18000 | NULL | | +| taxful_total_price | numeric | NULL | false | 7 | 18000 | NULL | | +| has_subscription | boolean | NULL | false | 8 | 18000 | NULL | | +| is_male | boolean | NULL | true | 9 | 18000 | NULL | | +| is_female | boolean | NULL | true | 10 | 18000 | NULL | | ++--------------------+------------------------------------------------+---------+------------+--------+-----------+---------+-----------+