Skip to content

Review #2514 for code improvements: row scope copied for every group #2668

Open

Description

@mathiasrw

This is not a bug report. It is an invitation to look at #2514 again, because the fix may be wider than the problem and adds work for every group. The goal is to understand the change and decide whether anything should be improved. The notes below come from a quick read of the diff, not from a measured analysis.

The concerns:

  • A copy of the row scope for every group, always. compileGroup (src/423groupby.js) now adds this.groupSources.set(g, Object.assign({}, p)) when a new group starts, whether or not the select has a correlated subquery. That is a copy and a WeakMap write per group in the grouping loop. Not measured.
  • Every plain column of a grouped select now reads from that copy. compileSelectGroup1 (src/424select.js) compiles each yy.Column as (this.groupSources.get(g) || g)[...], not only those inside a subquery. That changes how all grouped selects read their columns to fix the correlated case.
  • Copying only when the select contains a correlated subquery, and handing that subquery only the values it uses, would keep the change where the problem is.

Related: #1106.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions