Skip to content

Using a tree data structure to model query pipeline #1

@ananis25

Description

@ananis25

Currently, we represent the query pipeline using the over attribute on each SQLNode. That is, From(person) >> Select(...) results in a new Select node, Select(..., over = From(person)). While we can still compose queries by rebasing nodes recursively, having access to only the intermediate parent is a bit limiting.

We could instead use a data structure like an AST to represent the full query. Most of the annotate/resolve/link code already specializes on each SQLNode type, we only need to cast it to the tree visitor pattern. This should help fix some issues from the Julia library which are definitely present in the python port.

  1. bound references are not rebased MechanicalRabbit/FunSQL.jl#13 - visit all children and update query handles after rebasing
  2. do not collapse a Group node when an aggregate is used in Bind MechanicalRabbit/FunSQL.jl#12 - visit children nodes, check for a Bind node. Not collapse the Group node if present.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions