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::Persist(vec![("table_1", "tag_partition_by_a")]),
Step::Restart, 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::Replay,
Step::Assert(vec![ Step::Assert(vec![
Check::Query( Check::Query(
@ -1471,21 +1484,16 @@ mod tests {
"+-----+------------------+----------------------+", "+-----+------------------+----------------------+",
], ],
), ),
// no additional chunk for table_1 was created
Check::Query( 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![ vec![
"+---------------+-------------------------------------------------------------------------------------------------+", "+------------+-------------------+---+",
"| plan_type | plan |", "| table_name | storage | n |",
"+---------------+-------------------------------------------------------------------------------------------------+", "+------------+-------------------+---+",
"| logical_plan | Sort: #table_1.bar ASC NULLS FIRST |", "| table_1 | ObjectStoreOnly | 1 |",
"| | Projection: #table_1.bar, #table_1.tag_partition_by, #table_1.time |", "| table_2 | OpenMutableBuffer | 1 |",
"| | 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 |",
"+---------------+-------------------------------------------------------------------------------------------------+",
], ],
), ),
]), ]),
@ -1563,43 +1571,18 @@ mod tests {
"+-----+------------------+--------------------------------+", "+-----+------------------+--------------------------------+",
], ],
), ),
// chunks do not overlap
Check::Query( 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![ vec![
"+---------------+-------------------------------------------------------------------------------------------------+", "+------------+-------------------+-----------+-----------+-----------+",
"| plan_type | plan |", "| table_name | storage | min_value | max_value | row_count |",
"+---------------+-------------------------------------------------------------------------------------------------+", "+------------+-------------------+-----------+-----------+-----------+",
"| logical_plan | Sort: #table_1.bar ASC NULLS FIRST |", "| table_1 | ObjectStoreOnly | 0 | 0 | 1 |",
"| | Projection: #table_1.bar, #table_1.tag_partition_by, #table_1.time |", "| table_1 | OpenMutableBuffer | 10 | 10 | 1 |",
"| | TableScan: table_1 projection=Some([0, 1, 2]) |", "| table_2 | OpenMutableBuffer | 0 | 0 | 1 |",
"| physical_plan | SortExec: [bar@0 ASC] |", "| table_3 | ObjectStoreOnly | 10 | 10 | 1 |",
"| | 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)] |",
"+---------------+----------------------------------------------------------------------------------------------------------+",
], ],
), ),
]), ]),