feat(query): add raw-series preflight and execution surface to query traits

Signed-off-by: discord9 <55937128+discord9@users.noreply.github.com>
This commit is contained in:
discord9
2026-10-18 13:12:52 +08:00
parent 1bb4cb26b5
commit d9a500dea7
2 changed files with 55 additions and 1 deletions
+40
View File
@@ -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<Output>;
/// 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<Option<SeriesOrdering>> {
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<Option<PreparedNamedRawSeries>> {
Ok(None)
}
/// Execute a native single-region raw-series scan.
async fn execute_raw_series(
&self,
_plan: LogicalPlan,
_query_ctx: QueryContextRef,
_binding: RawSeriesRequest,
) -> Result<Output> {
crate::error::UnimplementedSnafu {
operation: "native raw-series query",
}
.fail()
}
/// Register an aggregate function.
///
/// # Panics
+15 -1
View File
@@ -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<SendableRecordBatchStream>;
/// 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<Option<PreparedNamedRawSeries>> {
Ok(None)
}
async fn handle_remote_dyn_filter_update(
&self,
target: &RegionQueryTarget,