Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 17 additions & 3 deletions src/query/sql/src/executor/table_read_plan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,15 @@ use std::sync::Arc;

use common_catalog::plan::DataSourcePlan;
use common_catalog::plan::InternalColumn;
use common_catalog::plan::PartStatistics;
use common_catalog::plan::Partitions;
use common_catalog::plan::PushDownInfo;
use common_catalog::table::Table;
use common_catalog::table_context::TableContext;
use common_exception::Result;
use common_expression::FieldIndex;
use common_expression::RemoteExpr;
use common_expression::Scalar;

#[async_trait::async_trait]
pub trait ToReadDataSourcePlan {
Expand Down Expand Up @@ -53,9 +57,19 @@ impl ToReadDataSourcePlan for dyn Table {
push_downs: Option<PushDownInfo>,
internal_columns: Option<BTreeMap<FieldIndex, InternalColumn>>,
) -> Result<DataSourcePlan> {
let (statistics, parts) = self
.read_partitions(ctx.clone(), push_downs.clone())
.await?;
let (statistics, parts) = if let Some(PushDownInfo {
filter:
Some(RemoteExpr::Constant {
scalar: Scalar::Boolean(false),
..
}),
..
}) = &push_downs
{
Ok((PartStatistics::default(), Partitions::default()))
} else {
self.read_partitions(ctx.clone(), push_downs.clone()).await
}?;

// We need the partition sha256 to specify the result cache.
if ctx.get_settings().get_enable_query_result_cache()? {
Expand Down
1 change: 0 additions & 1 deletion src/query/storages/fuse/src/operations/read_partitions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ impl FuseTable {
push_downs: Option<PushDownInfo>,
) -> Result<(PartStatistics, Partitions)> {
debug!("fuse table do read partitions, push downs:{:?}", push_downs);

let snapshot = self.read_table_snapshot().await?;
match snapshot {
Some(snapshot) => {
Expand Down
24 changes: 12 additions & 12 deletions tests/sqllogictests/suites/mode/standalone/explain/select.test
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,10 @@ Filter
├── estimated rows: 0.00
└── TableScan
├── table: default.system.numbers
├── read rows: 1
├── read bytes: 8
├── partitions total: 1
├── partitions scanned: 1
├── read rows: 0
├── read bytes: 0
├── partitions total: 0
├── partitions scanned: 0
├── push downs: [filters: [false], limit: NONE]
└── estimated rows: 1.00

Expand All @@ -114,10 +114,10 @@ Filter
├── estimated rows: 0.00
└── TableScan
├── table: default.system.numbers
├── read rows: 1
├── read bytes: 8
├── partitions total: 1
├── partitions scanned: 1
├── read rows: 0
├── read bytes: 0
├── partitions total: 0
├── partitions scanned: 0
├── push downs: [filters: [false], limit: NONE]
└── estimated rows: 1.00

Expand All @@ -129,10 +129,10 @@ Filter
├── estimated rows: 0.00
└── TableScan
├── table: default.system.numbers
├── read rows: 1
├── read bytes: 8
├── partitions total: 1
├── partitions scanned: 1
├── read rows: 0
├── read bytes: 0
├── partitions total: 0
├── partitions scanned: 0
├── push downs: [filters: [false], limit: NONE]
└── estimated rows: 1.00

Expand Down