test: make test queries easier to understand

pull/24376/head
Marco Neumann 2021-08-03 14:45:23 +02:00
parent 567ef7e991
commit 39f30fd0b6
1 changed files with 31 additions and 48 deletions

View File

@ -1449,6 +1449,19 @@ mod tests {
])]),
Step::Persist(vec![("table_1", "tag_partition_by_a")]),
Step::Restart,
Step::Assert(vec![
// single chunk for table_1 was restored
Check::Query(
"select table_name, storage, count(*) as n from system.chunks group by table_name, storage order by table_name, storage",
vec![
"+------------+-----------------+---+",
"| table_name | storage | n |",
"+------------+-----------------+---+",
"| table_1 | ObjectStoreOnly | 1 |",
"+------------+-----------------+---+",
],
),
]),
Step::Replay,
Step::Assert(vec![
Check::Query(
@ -1471,21 +1484,16 @@ mod tests {
"+-----+------------------+----------------------+",
],
),
// no additional chunk for table_1 was created
Check::Query(
"explain select * from table_1 order by bar",
"select table_name, storage, count(*) as n from system.chunks group by table_name, storage order by table_name, storage",
vec![
"+---------------+-------------------------------------------------------------------------------------------------+",
"| plan_type | plan |",
"+---------------+-------------------------------------------------------------------------------------------------+",
"| logical_plan | Sort: #table_1.bar ASC NULLS FIRST |",
"| | Projection: #table_1.bar, #table_1.tag_partition_by, #table_1.time |",
"| | TableScan: table_1 projection=Some([0, 1, 2]) |",
"| physical_plan | SortExec: [bar@0 ASC] |",
"| | CoalescePartitionsExec |",
"| | ProjectionExec: expr=[bar@0 as bar, tag_partition_by@1 as tag_partition_by, time@2 as time] |",
"| | RepartitionExec: partitioning=RoundRobinBatch(4) |",
"| | IOxReadFilterNode: table_name=table_1, chunks=1 predicate=Predicate |",
"+---------------+-------------------------------------------------------------------------------------------------+",
"+------------+-------------------+---+",
"| table_name | storage | n |",
"+------------+-------------------+---+",
"| table_1 | ObjectStoreOnly | 1 |",
"| table_2 | OpenMutableBuffer | 1 |",
"+------------+-------------------+---+",
],
),
]),
@ -1563,43 +1571,18 @@ mod tests {
"+-----+------------------+--------------------------------+",
],
),
// chunks do not overlap
Check::Query(
"explain select * from table_1 order by bar",
"select table_name, storage, min_value, max_value, row_count from system.chunk_columns where column_name = 'time' order by table_name, storage",
vec![
"+---------------+-------------------------------------------------------------------------------------------------+",
"| plan_type | plan |",
"+---------------+-------------------------------------------------------------------------------------------------+",
"| logical_plan | Sort: #table_1.bar ASC NULLS FIRST |",
"| | Projection: #table_1.bar, #table_1.tag_partition_by, #table_1.time |",
"| | TableScan: table_1 projection=Some([0, 1, 2]) |",
"| physical_plan | SortExec: [bar@0 ASC] |",
"| | CoalescePartitionsExec |",
"| | ProjectionExec: expr=[bar@0 as bar, tag_partition_by@1 as tag_partition_by, time@2 as time] |",
"| | ExecutionPlan(PlaceHolder) |",
"| | RepartitionExec: partitioning=RoundRobinBatch(4) |",
"| | DeduplicateExec: [tag_partition_by@1 ASC,time@2 ASC] |",
"| | SortExec: [tag_partition_by@1 ASC,time@2 ASC] |",
"| | IOxReadFilterNode: table_name=table_1, chunks=1 predicate=Predicate |",
"| | RepartitionExec: partitioning=RoundRobinBatch(4) |",
"| | IOxReadFilterNode: table_name=table_1, chunks=1 predicate=Predicate |",
"+---------------+-------------------------------------------------------------------------------------------------+",
],
),
Check::Query(
"explain select * from table_1 where bar <= 10",
vec![
"+---------------+----------------------------------------------------------------------------------------------------------+",
"| plan_type | plan |",
"+---------------+----------------------------------------------------------------------------------------------------------+",
"| logical_plan | Projection: #table_1.bar, #table_1.tag_partition_by, #table_1.time |",
"| | Filter: #table_1.bar LtEq Int64(10) |",
"| | TableScan: table_1 projection=Some([0, 1, 2]), filters=[#table_1.bar LtEq Int64(10)] |",
"| physical_plan | ProjectionExec: expr=[bar@0 as bar, tag_partition_by@1 as tag_partition_by, time@2 as time] |",
"| | CoalesceBatchesExec: target_batch_size=500 |",
"| | FilterExec: bar@0 <= CAST(10 AS Float64) |",
"| | RepartitionExec: partitioning=RoundRobinBatch(4) |",
"| | IOxReadFilterNode: table_name=table_1, chunks=1 predicate=Predicate exprs: [#bar LtEq Int64(10)] |",
"+---------------+----------------------------------------------------------------------------------------------------------+",
"+------------+-------------------+-----------+-----------+-----------+",
"| table_name | storage | min_value | max_value | row_count |",
"+------------+-------------------+-----------+-----------+-----------+",
"| table_1 | ObjectStoreOnly | 0 | 0 | 1 |",
"| table_1 | OpenMutableBuffer | 10 | 10 | 1 |",
"| table_2 | OpenMutableBuffer | 0 | 0 | 1 |",
"| table_3 | ObjectStoreOnly | 10 | 10 | 1 |",
"+------------+-------------------+-----------+-----------+-----------+",
],
),
]),