Skip to content

[Optimizer] With unnest using aliases results in unnecessary project operation #787

@srsuryadev

Description

@srsuryadev

With unnest using aliases results in unnecessary aliasing,

Example:

For the query:

 SELECT a, b FROM unnest(array[1, 2, 3], array[4, 5]) AS t(a, b)
Expected: true
-- Project[3][expressions: (a:INTEGER, "e"), (b:INTEGER, "e_0")] -> a:INTEGER, b:INTEGER
  -- Unnest[2][dt3.__p6, dt3.__p10] -> e:INTEGER, e_0: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] -> 

Ideally, we should not have the unncessary Project[3]

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions