Skip to content

Commit

Permalink
refactor(cubestore): Split metastore module (#5601)
Browse files Browse the repository at this point in the history
  • Loading branch information
ovr authored Nov 11, 2022
1 parent 5c4880f commit d9e5889
Show file tree
Hide file tree
Showing 6 changed files with 1,218 additions and 1,198 deletions.
53 changes: 21 additions & 32 deletions rust/cubestore/cubestore-sql-tests/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -535,20 +535,16 @@ async fn logical_alias(service: Box<dyn SqlClient>) {
.unwrap();

service
.exec_query(
"INSERT INTO s.logical (id, n) VALUES (1, 1), (2, 2), (3, 3), (1, 1), (2, 2)",
)
.exec_query("INSERT INTO s.logical (id, n) VALUES (1, 1), (2, 2), (3, 3), (1, 1), (2, 2)")
.await
.unwrap();

let result = service
.exec_query("SELECT sum(n) from (select id, sum(n) n from s.logical group by 1) `test` ")
.await
.unwrap();
assert_eq!(
to_rows(&result),
rows(&[(9)])
); }
assert_eq!(to_rows(&result), rows(&[(9)]));
}

async fn float_decimal_scale(service: Box<dyn SqlClient>) {
service.exec_query("CREATE SCHEMA foo").await.unwrap();
Expand Down Expand Up @@ -5335,7 +5331,7 @@ async fn unique_key_and_multi_partitions(service: Box<dyn SqlClient>) {
VALUES
(1, 1, 1, 1, 10, 1),
(2, 2, 2, 2, 20, 2)
"
",
)
.await
.unwrap();
Expand All @@ -5348,7 +5344,7 @@ async fn unique_key_and_multi_partitions(service: Box<dyn SqlClient>) {
VALUES
(11, 11, 11, 11, 110, 11),
(22, 22, 22, 22, 220, 21)
"
",
)
.await
.unwrap();
Expand All @@ -5361,7 +5357,7 @@ async fn unique_key_and_multi_partitions(service: Box<dyn SqlClient>) {
VALUES
(3, 3, 3, 3, 30, 3),
(4, 4, 4, 4, 40, 4)
"
",
)
.await
.unwrap();
Expand Down Expand Up @@ -5395,7 +5391,7 @@ async fn unique_key_and_multi_partitions_hash_aggregate(service: Box<dyn SqlClie
VALUES
(1, 1, 1, 1, 10, 1),
(2, 2, 2, 2, 20, 2)
"
",
)
.await
.unwrap();
Expand All @@ -5408,7 +5404,7 @@ async fn unique_key_and_multi_partitions_hash_aggregate(service: Box<dyn SqlClie
VALUES
(11, 11, 1, 11, 110, 11),
(22, 22, 2, 22, 220, 21)
"
",
)
.await
.unwrap();
Expand All @@ -5421,7 +5417,7 @@ async fn unique_key_and_multi_partitions_hash_aggregate(service: Box<dyn SqlClie
VALUES
(3, 3, 1, 3, 30, 3),
(4, 4, 1, 4, 40, 4)
"
",
)
.await
.unwrap();
Expand All @@ -5436,10 +5432,7 @@ async fn unique_key_and_multi_partitions_hash_aggregate(service: Box<dyn SqlClie
)
.await
.unwrap();
assert_eq!(
to_rows(&r),
rows(&[(1, 190), (2, 240)])
);
assert_eq!(to_rows(&r), rows(&[(1, 190), (2, 240)]));
}

async fn divide_by_zero(service: Box<dyn SqlClient>) {
Expand Down Expand Up @@ -5703,27 +5696,28 @@ async fn aggregate_index_with_hll_bytes(service: Box<dyn SqlClient>) {
let dense = "X'030C004020000001000000000000000000000000000000000000050020000001030100000410000000004102100000000000000051000020000020003220000003102000000000001200042000000001000200000002000000100000030040000000010040003010000000000100002000000000000000000031000020000000000000000000100000200302000000000000000000001002000000000002204000000001000001000200400000000000001000020031100000000080000000002003000000100000000100110000000000000000000010000000000000000000000020000001320205000100000612000000000004100020100000000000000000001000000002200000100000001000001020000000000020000000000000001000010300060000010000000000070100003000000000000020000000000001000010000104000000000000000000101000100000001401000000000000000000000000000100010000000000000000000000000400020000000002002300010000000000040000041000200005100000000000001000000000100000203010000000000000000000000000001006000100000000000000300100001000100254200000000000101100040000000020000010000050000000501000000000101020000000010000000003000000000200000102100000000204007000000200010000033000000000061000000000000000000000000000000000100001000001000000013000000003000000000002000000000000010001000000000000000000020010000020000000100001000000000000001000103000000000000000000020020000001000000000100001000000000000000020220200200000001001000010100000000200000000000001000002000000011000000000101200000000000000000000000000000000000000100130000000000000000000100000120000300040000000002000000000000000000000100000000070000100000000301000000401200002020000000000601030001510000000000000110100000000000000000050000000010000100000000000000000100022000100000101054010001000000000000001000001000000002000000000100000000000021000001000002000000000100000000000000000000951000000100000000000000000000000000102000200000000000000010000010000000000100002000000000000000000010000000000000010000000010000000102010000000010520100000021010100000030000000000000000100000001000000022000330051000000100000000000040003020000010000020000100000013000000102020000000050000000020010000000000000000101200C000100000001200400000000010000001000000000100010000000001000001000000100000000010000000004000000002000013102000100000000000000000000000600000010000000000000020000000000001000000000030000000000000020000000001000001000000000010000003002000003000200070001001003030010000000003000000000000020000006000000000000000011000000010000200000000000500000000000000020500000000003000000000000000004000030000100000000103000001000000000000200002004200000020000000030000000000000000000000002000100000000000000002000000000000000010020101000000005250000010000000000023010000001000000000000500002001000123100030011000020001310600000000000021000023000003000000000000000001000000000000220200000000004040000020201000000010201000000000020000400010000050000000000000000000000010000020000000000000000000000000000000000102000010000000000000000000000002010000200200000000000000000000000000100000000000000000200400000000010000000000000000000000000000000010000200300000000000100110000000000000000000000000010000030000001000000000010000010200013000000000000200000001000001200010000000010000000000001000000000000100000000410000040000001000100010000100000002001010000000000000000001000000000000010000000000000000000000002000000000001100001000000001010000000000000002200000000004000000000000100010000000000600000000100300000000000000000000010000003000000000000000000310000010100006000010001000000000000001010101000100000000000000000000000000000201000000000000000700010000030000000000000021000000000000000001020000000030000100001000000000000000000000004010100000000000000000000004000000040100000040100100001000000000300000100000000010010000300000200000000000001302000000000000000000100100000400030000001001000100100002300000004030000002010000220100000000000002000000010010000000003010500000000300000000005020102000200000000000000020100000000000000000000000011000000023000000000010000101000000000000010020040200040000020000004000020000000001000000000100000200000010000000000030100010001000000100000000000600400000000002000000000000132000000900010000000030021400000000004100006000304000000000000010000106000001300020000'";

service
.exec_query(
&format!("INSERT INTO s.Orders (a, b, hll) VALUES (1, 10, {s}), \
.exec_query(&format!(
"INSERT INTO s.Orders (a, b, hll) VALUES (1, 10, {s}), \
(2, 20, {d}), \
(1, 10, {d}), \
(2, 30, {s}), \
(1, 10, {d}), \
(2, 20, {s}) \
",
s = sparse,
d = dense
),
)
s = sparse,
d = dense
))
.await
.unwrap();

let res = service
.exec_query("SELECT a, b, cardinality(merge(hll)) FROM s.Orders GROUP BY 1, 2 ORDER BY 1, 2")
.exec_query(
"SELECT a, b, cardinality(merge(hll)) FROM s.Orders GROUP BY 1, 2 ORDER BY 1, 2",
)
.await
.unwrap();

assert_eq!(
assert_eq!(
to_rows(&res),
[
[
Expand All @@ -5736,14 +5730,9 @@ async fn aggregate_index_with_hll_bytes(service: Box<dyn SqlClient>) {
TableValue::Int(20),
TableValue::Int(657),
],
[
TableValue::Int(2),
TableValue::Int(30),
TableValue::Int(2),
],
[TableValue::Int(2), TableValue::Int(30), TableValue::Int(2),],
]
);

);
}

async fn aggregate_index_hll(service: Box<dyn SqlClient>) {
Expand Down
Loading

0 comments on commit d9e5889

Please sign in to comment.