Skip to content

perf(optimizer): Avoid redundant project for the unnest#805

Open
srsuryadev wants to merge 1 commit intofacebookincubator:mainfrom
srsuryadev:export-D91549738
Open

perf(optimizer): Avoid redundant project for the unnest#805
srsuryadev wants to merge 1 commit intofacebookincubator:mainfrom
srsuryadev:export-D91549738

Conversation

@srsuryadev
Copy link
Contributor

@srsuryadev srsuryadev commented Jan 27, 2026

Summary:
Avoid unnecessary project for the unnest by pushing the aliasing to the output name of the unnest node.

For the issue: #787

Differential Revision: D91549738

Unit Tests

E2E Tests

buck run axiom/cli:cli
QL> EXPlAIN SELECT a, b FROM unnest(array[1, 2, 3], array[4, 5]) WITH ORDINALITY AS t(a, b, c);
Fragment 0:  numWorkers=1:
-- Unnest[2][dt3.__p6, dt3.__p10] -> a:INTEGER, b:INTEGER
  -- Project[1][expressions: (dt3.__p6:ARRAY<INTEGER>, {1, 2, 3}), (dt3.__p10:ARRAY<INTEGER>, {4, 5})] -> "dt3.__p6":ARRAY<INTEGER>, "dt3.__p10":ARRAY<INTEGER>
    -- Values[0][1 rows in 1 vectors] -> 
       Estimate: 1 rows, 0B peak memory


4.56ms / 4.09ms user / 0ns system (89%)

@meta-codesync
Copy link

meta-codesync bot commented Jan 27, 2026

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

@meta-cla meta-cla bot added the CLA Signed This label is managed by the Meta Open Source bot. label Jan 27, 2026
srsuryadev added a commit to srsuryadev/axiom that referenced this pull request Jan 27, 2026
…cubator#805)

Summary:

Avoid unnecessary project for the unnest by pushing the aliasing to the output name of the unnest node.

For the issue: facebookincubator#787

Differential Revision: D91549738
srsuryadev added a commit to srsuryadev/axiom that referenced this pull request Jan 27, 2026
…cubator#805)

Summary:

Avoid unnecessary project for the unnest by pushing the aliasing to the output name of the unnest node.

For the issue: facebookincubator#787

Differential Revision: D91549738
@srsuryadev srsuryadev force-pushed the export-D91549738 branch 2 times, most recently from a84379a to 2ce5e08 Compare January 27, 2026 14:49
srsuryadev added a commit to srsuryadev/axiom that referenced this pull request Jan 27, 2026
…cubator#805)

Summary:

Avoid unnecessary project for the unnest by pushing the aliasing to the output name of the unnest node.

For the issue: facebookincubator#787

Differential Revision: D91549738
srsuryadev added a commit to srsuryadev/axiom that referenced this pull request Jan 27, 2026
…cubator#805)

Summary:

Avoid unnecessary project for the unnest by pushing the aliasing to the output name of the unnest node.

For the issue: facebookincubator#787

Differential Revision: D91549738
srsuryadev added a commit to srsuryadev/axiom that referenced this pull request Jan 27, 2026
…cubator#805)

Summary:

Avoid unnecessary project for the unnest by pushing the aliasing to the output name of the unnest node.

For the issue: facebookincubator#787

Differential Revision: D91549738
@srsuryadev srsuryadev changed the title perf(optimizer): Avoid unnecessary project for the unnest perf(optimizer): Avoid redundant project for the unnest Jan 27, 2026
…bator#805)

Summary:
Avoid unnecessary project for the unnest by pushing the aliasing to the output name of the unnest node.

When we are traversing through the nodes in makeQueryGraph, when we see redundant projects after unnest nodes, we push the alias names to the unnest nodes' output column. Hence, existing logics in the optimizer helps to prune the project nodes.

For the issue: facebookincubator#787


Differential Revision: D91549738
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