fix(promql): align aggregate admission with boxed parser inputs

Signed-off-by: discord9 <55937128+discord9@users.noreply.github.com>
This commit is contained in:
discord9
2026-10-25 21:35:20 +08:00
parent c9426d3cd7
commit 463d4a5c8f
2 changed files with 4 additions and 5 deletions
+3 -3
View File
@@ -44,7 +44,7 @@ use datafusion_expr::Expr;
use datatypes::series::SeriesOrdering;
use datatypes::series::samples::{FieldSpec, SeriesSchema};
use promql::extension_plan::{AggregateFinalize, FusedSeries, FusedSeriesBinding};
use promql::native::plan::{NativeExpr, NativeNode, NativeTree, reads_across_series};
use promql::native::plan::{NativeExpr, NativeNode, reads_across_series};
use promql::vector_match::{Cardinality, MatchingLabels};
use promql_parser::label::Matchers;
use promql_parser::parser::value::ValueType;
@@ -716,11 +716,11 @@ pub(crate) fn pointwise_operand(node: &NativeNode) -> bool {
fn admitted_single_selector(expr: &PromExpr) -> bool {
fn aggregate(expr: &PromExpr) -> bool {
match expr {
PromExpr::Aggregate(_) => true,
PromExpr::Aggregate(_aggregate) => true,
PromExpr::Paren(paren) => aggregate(&paren.expr),
PromExpr::Unary(unary) => aggregate(&unary.expr),
PromExpr::Binary(binary) => aggregate(&binary.lhs) || aggregate(&binary.rhs),
PromExpr::Call(call) => call.args.args.iter().any(aggregate),
PromExpr::Call(call) => call.args.args.iter().any(|arg| aggregate(arg)),
_ => false,
}
}
+1 -2
View File
@@ -39,7 +39,6 @@ use datafusion::datasource::source::DataSourceExec;
use datafusion::datasource::{MemTable, provider_as_source};
use datafusion::execution::context::SessionContext;
use datafusion::logical_expr::{Extension, UserDefinedLogicalNodeCore, col};
use datafusion_expr::UserDefinedLogicalNode;
use datatypes::prelude::ConcreteDataType;
use datatypes::schema::{ColumnSchema, Schema};
use datatypes::series::SeriesOrdering;
@@ -2502,7 +2501,7 @@ fn find_aggregate_finalize(plan: &LogicalPlan) -> Option<&AggregateFinalize> {
/// The producer below a split aggregate, which exports the state one partition folded.
fn partial_producer(finalize: &AggregateFinalize) -> &FusedSeries {
// Bound to a local first: the slice handed out by `inputs` borrows this list.
let inputs = UserDefinedLogicalNode::inputs(finalize);
let inputs = UserDefinedLogicalNodeCore::inputs(finalize);
let [LogicalPlan::Extension(Extension { node })] = inputs.as_slice() else {
panic!("the merge should read one producer: {finalize:?}");
};