Skip to content

Commit

Permalink
chore: refine table sample tests (#16600)
Browse files Browse the repository at this point in the history
chore: refine table sample test
  • Loading branch information
xudong963 authored Oct 14, 2024
1 parent 1d93b49 commit 63f785c
Showing 1 changed file with 16 additions and 71 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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: <range pruning: 1 to 1>, blocks: <range pruning: 1 to 1>]
├── 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: <range pruning: 1 to 1>, blocks: <range pruning: 1 to 1>]
├── 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
Expand All @@ -47,54 +33,13 @@ 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

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;
set random_function_seed = 0;

0 comments on commit 63f785c

Please sign in to comment.