Skip to content

Commit

Permalink
distsql: support window functions in distsql
Browse files Browse the repository at this point in the history
Adds support of window functions in DistSQL.
A stage of windower processors is added
for a particular PARTITION BY scheme, all
window functions with the same partitioning
are processed by that stage. We also cache
sorted partitions if more than one window
function has the same ORDER BY clause.

A doc describing the details of the
implementation is out.

Note: memory accounting is not done,
I plan on adding that after this PR.

Resolves: cockroachdb#24425.

Release note: None
  • Loading branch information
yuzefovich committed Jul 24, 2018
1 parent 864dddf commit 55dd1c9
Show file tree
Hide file tree
Showing 10 changed files with 2,925 additions and 375 deletions.
444 changes: 444 additions & 0 deletions pkg/sql/distsql_physical_planner.go

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions pkg/sql/distsqlrun/api.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions pkg/sql/distsqlrun/processors.go
Original file line number Diff line number Diff line change
Expand Up @@ -1052,6 +1052,12 @@ func newProcessor(
}
return newProjectSetProcessor(flowCtx, processorID, core.ProjectSet, inputs[0], post, outputs[0])
}
if core.Windower != nil {
if err := checkNumInOut(inputs, outputs, 1, 1); err != nil {
return nil, err
}
return newWindower(flowCtx, processorID, core.Windower, inputs[0], post, outputs[0])
}
return nil, errors.Errorf("unsupported processor core %s", core)
}

Expand Down
Loading

0 comments on commit 55dd1c9

Please sign in to comment.