Skip to content

Bug with Group by with Cube operation #644

Closed

Description

@nobjr

Hi,

I believe that there is problem with following operation using alasql and group by with cube clause:

alasql('select a, b, suM(v) from ? group by cube(a, b)',  [[{a: 2, b: 2, v: 15}, {a: 2, b: 4, v: 20}]]);

the result was:

[ { a: null, b: null, 'SUM(v)': 35 },
{ a: 2, b: null, 'SUM(v)': 50 },
{ a: 2, b: 2, 'SUM(v)': 15 },
{ a: null, b: 4, 'SUM(v)': 20 },
{ a: 2, b: 4, 'SUM(v)': 20 } ]

but the correct result must be:

[ { a: null, b: null, 'SUM(v)': 35 },
{ a: 2, b: null, 'SUM(v)': 35 },
{ a: 2, b: 2, 'SUM(v)': 15 },
{ a: null, b: 4, 'SUM(v)': 20 },
{ a: 2, b: 4, 'SUM(v)': 20 } ]

Can anyone help me?

Thanks.

Activity

  1. mathiasrw commented on Apr 1, 2016

    @mathiasrw
    Member

    @agershun we need you on this one...

  2. added a commit that references this issue on Oct 20, 2026
    7d4c54e
  3. mathiasrw commented on Oct 21, 2026

    @mathiasrw
    Member

    Fix released as part of v4.21.0

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