Skip to content

feat(optimizer): Support DISTINCT aggregation on single set of arguments with order-by#1007

Open
kagamiori wants to merge 1 commit intofacebookincubator:mainfrom
kagamiori:export-D95008102
Open

feat(optimizer): Support DISTINCT aggregation on single set of arguments with order-by#1007
kagamiori wants to merge 1 commit intofacebookincubator:mainfrom
kagamiori:export-D95008102

Conversation

@kagamiori
Copy link
Contributor

@kagamiori kagamiori commented Mar 5, 2026

Summary:
Previously, axiom optimizer allows agg(distinct ...) aggregation calls when there is no
order by in the aggregation call. This PR allows agg(distinct ... order by ...) when the
order-by keys are a subset of distinct arguments.

Distinct aggregations with order-by on columns not included in distinct arguments are not
supported in the parallel execution mode (i.e., number of drivers * number of workers > 1).
This follows the same behavior as Presto and DuckDB.

Differential Revision: D95008102

@meta-codesync
Copy link

meta-codesync bot commented Mar 5, 2026

@kagamiori has exported this pull request. If you are a Meta employee, you can view the originating Diff in D95008102.

@meta-cla meta-cla bot added the CLA Signed This label is managed by the Meta Open Source bot. label Mar 5, 2026
kagamiori added a commit to kagamiori/verax that referenced this pull request Mar 5, 2026
…nts with order-by (facebookincubator#1007)

Summary:

Previously, axiom optimizer allows `agg(distinct ...)` aggregation calls when there is no 
`order by` in the aggregation call. This PR allows `agg(distinct ... order by ...)` when the 
order-by keys are a subset of distinct arguments.

Differential Revision: D95008102
kagamiori added a commit to kagamiori/verax that referenced this pull request Mar 5, 2026
…nts with order-by (facebookincubator#1007)

Summary:

Previously, axiom optimizer allows `agg(distinct ...)` aggregation calls when there is no 
`order by` in the aggregation call. This PR allows `agg(distinct ... order by ...)` when the 
order-by keys are a subset of distinct arguments.

Differential Revision: D95008102
kagamiori added a commit to kagamiori/verax that referenced this pull request Mar 6, 2026
…nts with order-by (facebookincubator#1007)

Summary:

Previously, axiom optimizer allows `agg(distinct ...)` aggregation calls when there is no 
`order by` in the aggregation call. This PR allows `agg(distinct ... order by ...)` when the 
order-by keys are a subset of distinct arguments.

Distinct aggregations with order-by on columns not included in distinct arguments are not 
supported in the parallel execution mode (i.e., number of drivers * number of workers > 1). 
This follows the same behavior as Presto and DuckDB.

Differential Revision: D95008102
kagamiori added a commit to kagamiori/verax that referenced this pull request Mar 6, 2026
…nts with order-by (facebookincubator#1007)

Summary:
Pull Request resolved: facebookincubator#1007

Previously, axiom optimizer allows `agg(distinct ...)` aggregation calls when there is no
`order by` in the aggregation call. This PR allows `agg(distinct ... order by ...)` when the
order-by keys are a subset of distinct arguments.

Distinct aggregations with order-by on columns not included in distinct arguments are not supported in the parallel execution mode (i.e., number of drivers * number of workers > 1). This follows the same behavior as Presto and DuckDB.

Differential Revision: D95008102
kagamiori added a commit to kagamiori/verax that referenced this pull request Mar 10, 2026
…nts with order-by (facebookincubator#1007)

Summary:

Previously, axiom optimizer allows `agg(distinct ...)` aggregation calls when there is no 
`order by` in the aggregation call. This PR allows `agg(distinct ... order by ...)` when the 
order-by keys are a subset of distinct arguments.

Distinct aggregations with order-by on columns not included in distinct arguments are not 
supported in the parallel execution mode (i.e., number of drivers * number of workers > 1). 
This follows the same behavior as Presto and DuckDB.

Differential Revision: D95008102
kagamiori added a commit to kagamiori/verax that referenced this pull request Mar 10, 2026
…nts with order-by (facebookincubator#1007)

Summary:

Previously, axiom optimizer allows `agg(distinct ...)` aggregation calls when there is no 
`order by` in the aggregation call. This PR allows `agg(distinct ... order by ...)` when the 
order-by keys are a subset of distinct arguments.

Distinct aggregations with order-by on columns not included in distinct arguments are not 
supported in the parallel execution mode (i.e., number of drivers * number of workers > 1). 
This follows the same behavior as Presto and DuckDB.

Differential Revision: D95008102
kagamiori added a commit to kagamiori/verax that referenced this pull request Mar 10, 2026
…nts with order-by (facebookincubator#1007)

Summary:
Pull Request resolved: facebookincubator#1007

Previously, axiom optimizer allows `agg(distinct ...)` aggregation calls when there is no
`order by` in the aggregation call. This PR allows `agg(distinct ... order by ...)` when the
order-by keys are a subset of distinct arguments.

Distinct aggregations with order-by on columns not included in distinct arguments are not supported in the parallel execution mode (i.e., number of drivers * number of workers > 1). This follows the same behavior as Presto and DuckDB.

Differential Revision: D95008102
…nts with order-by (facebookincubator#1007)

Summary:

Previously, axiom optimizer allows `agg(distinct ...)` aggregation calls when there is no 
`order by` in the aggregation call. This PR allows `agg(distinct ... order by ...)` when the 
order-by keys are a subset of distinct arguments.

Distinct aggregations with order-by on columns not included in distinct arguments are not 
supported in the parallel execution mode (i.e., number of drivers * number of workers > 1). 
This follows the same behavior as Presto and DuckDB.

Differential Revision: D95008102
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot. fb-exported meta-exported

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant