Skip to content

BUG: Sum Aggregation calculated incorrectly #864

Closed
@ppiyush13

Description

Hello Team,
First of all I would like to thank you guys for such a useful aggregation engine available in browser.
Keep up the good work.
I would like to discuss the bug that I have found in perspective core engine.

I am rendering perspective-viewer as follows:

<perspective-viewer 
        style="height: 500px; width: 1000px;" 
	columns='["count"]' 
        row-pivots='["section1", "section2"]' /> 

In all the below scenarios perspective-viewer configs remains the same.

Scenario 1

Lets assume I have following data

[
	{
		section1: '100',
		section2: '1',
		count: 5
	},
	{
		section1: '101',
		section2: '2',
		count: 7
	},
	{
		section1: 'A',
		section2: 'B',
		count: 13
	},
]

It works as expected and display aggregation result as following:

image

Irrespective of data orde, it works correctly as expected.

Scenario 2

Lets assume following data for this scenario:

[
	{
		section1: '10000',
		section2: '1',
		count: 5
	},
	{
		section1: '101',
		section2: '2',
		count: 7
	},
	{
		section1: 'A',
		section2: 'B',
		count: 13
	},
]

Generating following view:

image

The last data entry which is

 {
	section1: 'A',
	section2: 'B',
	count: 13
},

is not rendered as expected. Top level label, ie section1: A, is missing and also its section2 key is merged with top level label 101.

Scenario 3

Now lets assume the following data:

[
	{
		section1: '10000',
		section2: '10000',
		count: 5
	},
	{
		section1: '101',
		section2: '2',
		count: 7
	},
	{
		section1: 'A',
		section2: 'B',
		count: 13
	},
]

We get following view:

image

Now both A and B are missing.
Count value of Count value of 101 |_ 2 is 20, which is also incorrect.

Scenario 4

Now lets decrease first object's section1 and section2 below 10000.

[
	{
		section1: '9999',
		section2: '9999',
		count: 5
	},
	{
		section1: '101',
		section2: '2',
		count: 7
	},
	{
		section1: 'A',
		section2: 'B',
		count: 13
	},
]

image

Now it seems to work fine as expected
So only values greater than and equal to 10000 are affected and not displayed.

Scenario 5

Lets make keys with alphabetic values as the first record in array.

[
	{
		section1: 'A',
		section2: 'B',
		count: 13
	},
	{
		section1: '10000',
		section2: '10000',
		count: 5
	},
	{
		section1: '10001',
		section2: '10000',
		count: 6
	},
	{
		section1: '10000',
		section2: '10002',
		count: 8
	},
	{
		section1: '101',
		section2: '2',
		count: 7
	},
]

Mysteriously this time as well it is working fine.

image

Can you please fix this issue as this has serious impact on users.

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions