databend icon indicating copy to clipboard operation
databend copied to clipboard

bug: explain `estimated rows` is zero when select * from stage

Open BohuTANG opened this issue 2 years ago โ€ข 4 comments

Summary

Count:

mysql> select count() from @lake (pattern => '.*parquet');
+----------+
| count()  |
+----------+
| 10000000 |
+----------+

explain:

mysql> explain select * from @lake (pattern => '.*parquet');
+--------------------------------------------------+
| explain                                          |
+--------------------------------------------------+
| TableScan                                        |
| โ”œโ”€โ”€ table: default.system.read_parquet           |
| โ”œโ”€โ”€ read rows: 10000000                          |
| โ”œโ”€โ”€ read bytes: 1552567904                       |
| โ”œโ”€โ”€ partitions total: 9766                       |
| โ”œโ”€โ”€ partitions scanned: 9766                     |
| โ”œโ”€โ”€ push downs: [filters: [], limit: NONE]       |
| โ””โ”€โ”€ estimated rows: 0.00                         |
+--------------------------------------------------+

BohuTANG avatar Feb 03 '23 08:02 BohuTANG

cc @leiysky @xudong963

BohuTANG avatar Feb 03 '23 08:02 BohuTANG

The cause is that the StageTable doesn't implement Table::table_statistics.

@dantengsky Is it possible to generate table statistics for stage tables?

leiysky avatar Feb 03 '23 08:02 leiysky

@youngsofun is working on it(stage) :)

BohuTANG avatar Feb 03 '23 10:02 BohuTANG

for parquet๏ผŒwe can get num rows after read partition

youngsofun avatar Feb 03 '23 11:02 youngsofun