From 63f785c013058b8555d0ad0ce30e6af1ff645df5 Mon Sep 17 00:00:00 2001 From: "xudong.w" Date: Mon, 14 Oct 2024 13:48:27 +0800 Subject: [PATCH] chore: refine table sample tests (#16600) chore: refine table sample test --- .../mode/standalone/explain/table_sample.test | 87 ++++--------------- 1 file changed, 16 insertions(+), 71 deletions(-) diff --git a/tests/sqllogictests/suites/mode/standalone/explain/table_sample.test b/tests/sqllogictests/suites/mode/standalone/explain/table_sample.test index fba7ca8e2623..840552957b26 100644 --- a/tests/sqllogictests/suites/mode/standalone/explain/table_sample.test +++ b/tests/sqllogictests/suites/mode/standalone/explain/table_sample.test @@ -5,40 +5,26 @@ statement ok set random_function_seed = 1; query T -explain select * from t sample row (10 rows); +explain optimized select * from t sample row (10 rows); ---- Filter -├── output columns: [t.a (#0)] -├── filters: [rand() <= 0.01] -├── estimated rows: 200.00 -└── TableScan - ├── table: default.default.t - ├── output columns: [a (#0)] - ├── read rows: 1000 - ├── read size: 1.40 KiB - ├── partitions total: 1 - ├── partitions scanned: 1 - ├── pruning stats: [segments: , blocks: ] - ├── push downs: [filters: [rand() <= 0.01], limit: NONE] - └── estimated rows: 1000.00 +├── filters: [lte(rand(), 0.01)] +└── Scan + ├── table: default.t + ├── filters: [lte(rand(), 0.01)] + ├── order by: [] + └── limit: NONE query T -explain select * from t sample row (99.1); +explain optimized select * from t sample row (99.1); ---- Filter -├── output columns: [t.a (#0)] -├── filters: [rand() <= 0.991] -├── estimated rows: 200.00 -└── TableScan - ├── table: default.default.t - ├── output columns: [a (#0)] - ├── read rows: 1000 - ├── read size: 1.40 KiB - ├── partitions total: 1 - ├── partitions scanned: 1 - ├── pruning stats: [segments: , blocks: ] - ├── push downs: [filters: [rand() <= 0.991], limit: NONE] - └── estimated rows: 1000.00 +├── filters: [lte(rand(), 0.991)] +└── Scan + ├── table: default.t + ├── filters: [lte(rand(), 0.991)] + ├── order by: [] + └── limit: NONE statement ok @@ -47,7 +33,7 @@ drop table t; statement ok create or replace table t as select number as a from numbers(10000000); -query +query I select count(distinct a) < 10000000 from t sample block(50); ---- 1 @@ -55,46 +41,5 @@ select count(distinct a) < 10000000 from t sample block(50); statement ok drop table t; -query T -explain select * from numbers(10000000) as t sample row(90); ----- -Filter -├── output columns: [t.number (#0)] -├── filters: [rand() <= 0.9] -├── estimated rows: 2000000.00 -└── TableScan - ├── table: default.system.numbers - ├── output columns: [number (#0)] - ├── read rows: 10000000 - ├── read size: 76.29 MiB - ├── partitions total: 153 - ├── partitions scanned: 153 - ├── push downs: [filters: [rand() <= 0.9], limit: NONE] - └── estimated rows: 10000000.00 - -query T -explain select * from numbers(10000000) as t sample row(90 rows); ----- -Filter -├── output columns: [t.number (#0)] -├── filters: [rand() <= 0.000009] -├── estimated rows: 2000000.00 -└── TableScan - ├── table: default.system.numbers - ├── output columns: [number (#0)] - ├── read rows: 10000000 - ├── read size: 76.29 MiB - ├── partitions total: 153 - ├── partitions scanned: 153 - ├── push downs: [filters: [rand() <= 0.000009], limit: NONE] - └── estimated rows: 10000000.00 - - - -query -select count(number) < 10000000000 from numbers(10000000000) sample block(0.01); ----- -1 - statement ok -set random_function_seed = 0; \ No newline at end of file +set random_function_seed = 0;