Dsl pipeline aggs - #22650
Conversation
Convert flat per-granularity execution results into the client's nested aggregation response using the original request as template. Co-authored-by: Varun <varunsm@amazon.com> Signed-off-by: Sachin Sriramagiri <srirasac@amazon.com>
Exclude SQL NULL groups from terms buckets (legacy parity), resolve granularity keys from the aggregate's input row type, use NUL key separator, null-safe toDouble error message. Signed-off-by: Sachin Sriramagiri <srirasac@amazon.com>
Key aggregation results by nesting-order group fields so sibling trees over the same field set no longer collide. Signed-off-by: Sachin Sriramagiri <srirasac@amazon.com>
- Use nanoTime for latency - Echo user-supplied meta in aggregation responses - Throw when a metric column is missing from results - Added TODO to index rows instead of re-filtering per recursion Signed-off-by: Sachin Sriramagiri <srirasac@amazon.com>
Sort buckets by each aggregation's requested order, drop buckets below min_doc_count, truncate to size, and report truncated counts as sum_other_doc_count. Signed-off-by: Sachin Sriramagiri <srirasac@amazon.com>
The lookup is invariant per granularity result. Signed-off-by: Sachin Sriramagiri <srirasac@amazon.com>
Signed-off-by: Sachin Sriramagiri <srirasac@amazon.com>
Sibling pipelines compose a second plan over the sibling aggregate: min_doc_count filter, the sibling's own bucket order with fetch=size to mirror visible buckets, gap policy, then a global AVG. Results render as InternalSimpleValue; empty input yields value null. Unsupported pipeline types and nested pipelines now fail with a clear error instead of being silently dropped. Verified end to end through DataFusion. Co-authored-by: Tanik Pansuriya <panbhai@amazon.com> Signed-off-by: Sachin Sriramagiri <srirasac@amazon.com>
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Explore these optional code suggestions:
|
|
❌ Gradle check result for 32a720f: FAILURE Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change? |
Description
Adds
avg_bucketsibling pipeline aggregation support, computed engine-side. Supersedes #21201, following its plan-composition strategy.Each sibling pipeline becomes a second plan wrapping the sibling's aggregate:
The filter/sort/fetch shaping mirrors the sibling's visible buckets — vanilla runs sibling pipelines post-truncation, so the pipeline must aggregate what the response shows, not every group. Plans are tagged
QueryPlans.Type.PIPELINE; the single result row maps back to pipelines by column name and renders via vanilla'sInternalSimpleValue(empty sibling →"value": null).Key semantics:
gap_policy: skip= SQLAVG's native NULL handling (excluded from numerator and denominator);insert_zeros=COALESCE(metric, 0).Scope:
avg_bucketover root-leveltermssiblings, single-levelbuckets_path(metric or_count), both gap policies. Everything else is rejected explicitly; other*_buckettypes are follow-ups reusing this machinery.Testing
additionalPlansfor multi-plan scenarios._count, empty sibling, and rejection.Related Issues
Supersedes #21201