diff --git a/src/query/src/query_engine.rs b/src/query/src/query_engine.rs index c512b9c1e5e..51f7d7ce477 100644 --- a/src/query/src/query_engine.rs +++ b/src/query/src/query_engine.rs @@ -29,9 +29,11 @@ use common_function::handlers::{ FlowServiceHandlerRef, ProcedureServiceHandlerRef, TableMutationHandlerRef, }; use common_query::Output; +use common_query::request::{PreparedNamedRawSeries, RawSeriesRequest}; use datafusion::catalog::TableFunction; use datafusion::dataframe::DataFrame; use datafusion_expr::{AggregateUDF, LogicalPlan, WindowUDF}; +use datatypes::series::SeriesOrdering; pub use default_serializer::{DefaultPlanDecoder, DefaultSerializer}; use partition::manager::PartitionRuleManagerRef; use session::context::QueryContextRef; @@ -77,6 +79,44 @@ pub trait QueryEngine: Send + Sync { /// Execute the given [`LogicalPlan`]. async fn execute(&self, plan: LogicalPlan, query_ctx: QueryContextRef) -> Result; + /// Non-consumingly checks whether a native single-region raw-series scan is supported. + /// Returns its ordering on support, `None` when explicitly unsupported, and propagates errors. + /// This point-in-time check does not reserve a plan; execution revalidates support. + async fn prepare_raw_series( + &self, + _plan: LogicalPlan, + _query_ctx: QueryContextRef, + _binding: RawSeriesRequest, + ) -> Result> { + Ok(None) + } + + /// Non-consumingly checks whether a named raw-series preflight is supported. + /// + /// Returns the approved binding and ordering on support, or `None` when the plan is + /// explicitly unsupported. Errors propagate unchanged. This point-in-time check does not + /// reserve a plan; execution revalidates support. + async fn prepare_named_raw_series( + &self, + _plan: LogicalPlan, + _query_ctx: QueryContextRef, + ) -> Result> { + Ok(None) + } + + /// Execute a native single-region raw-series scan. + async fn execute_raw_series( + &self, + _plan: LogicalPlan, + _query_ctx: QueryContextRef, + _binding: RawSeriesRequest, + ) -> Result { + crate::error::UnimplementedSnafu { + operation: "native raw-series query", + } + .fail() + } + /// Register an aggregate function. /// /// # Panics diff --git a/src/query/src/region_query.rs b/src/query/src/region_query.rs index 4d2dfb68d60..96c843893bb 100644 --- a/src/query/src/region_query.rs +++ b/src/query/src/region_query.rs @@ -18,7 +18,7 @@ use api::v1::region::{RemoteDynFilterUnregister, RemoteDynFilterUpdate}; use async_trait::async_trait; use common_meta::node_manager::NodeManagerRef; use common_meta::peer::Peer; -use common_query::request::QueryRequest; +use common_query::request::{PreparedNamedRawSeries, QueryRequest}; use common_recordbatch::SendableRecordBatchStream; use partition::manager::PartitionRuleManagerRef; use session::ReadPreference; @@ -68,6 +68,20 @@ pub trait RegionQueryHandler: Send + Sync { request: QueryRequest, ) -> Result; + /// Non-consumingly checks whether a named raw-series preflight is supported. + /// + /// Returns the approved binding and ordering on support, or `None` when the request is + /// explicitly unsupported; failures that are not unsupported preparation are returned as + /// errors. This point-in-time check does not reserve a plan, and execution revalidates + /// support. + async fn prepare_named_raw_series_query( + &self, + _target: &RegionQueryTarget, + _request: QueryRequest, + ) -> Result> { + Ok(None) + } + async fn handle_remote_dyn_filter_update( &self, target: &RegionQueryTarget,