Skip to content

Commit adb2270

Browse files
committed
fix(client-core): Table pivot incorrectly behaves with multiple measures
1 parent d7be090 commit adb2270

File tree

5 files changed

+18
-18
lines changed

5 files changed

+18
-18
lines changed

packages/cubejs-client-core/dist/cubejs-client-core.esm.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ function () {
331331
};
332332
};
333333

334-
return this.pivot(pivotConfig).map(function (_ref19) {
334+
return this.pivot(normalizedPivotConfig).map(function (_ref19) {
335335
var xValues = _ref19.xValues,
336336
yValuesArray = _ref19.yValuesArray;
337337
return yValuesArray.map(function (_ref20) {
@@ -342,9 +342,9 @@ function () {
342342
return normalizedPivotConfig.x.map(valueToObject(xValues, m)).concat(normalizedPivotConfig.y.map(valueToObject(yValues, m))).reduce(function (a, b) {
343343
return Object.assign(a, b);
344344
}, {});
345-
});
346-
}).reduce(function (a, b) {
347-
return a.concat(b);
345+
}).reduce(function (a, b) {
346+
return Object.assign(a, b);
347+
}, {});
348348
});
349349
}
350350
}, {

packages/cubejs-client-core/dist/cubejs-client-core.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ function () {
335335
};
336336
};
337337

338-
return this.pivot(pivotConfig).map(function (_ref19) {
338+
return this.pivot(normalizedPivotConfig).map(function (_ref19) {
339339
var xValues = _ref19.xValues,
340340
yValuesArray = _ref19.yValuesArray;
341341
return yValuesArray.map(function (_ref20) {
@@ -346,9 +346,9 @@ function () {
346346
return normalizedPivotConfig.x.map(valueToObject(xValues, m)).concat(normalizedPivotConfig.y.map(valueToObject(yValues, m))).reduce(function (a, b) {
347347
return Object.assign(a, b);
348348
}, {});
349-
});
350-
}).reduce(function (a, b) {
351-
return a.concat(b);
349+
}).reduce(function (a, b) {
350+
return Object.assign(a, b);
351+
}, {});
352352
});
353353
}
354354
}, {

packages/cubejs-client-core/dist/cubejs-client-core.umd.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14304,7 +14304,7 @@
1430414304
};
1430514305
};
1430614306

14307-
return this.pivot(pivotConfig).map(function (_ref19) {
14307+
return this.pivot(normalizedPivotConfig).map(function (_ref19) {
1430814308
var xValues = _ref19.xValues,
1430914309
yValuesArray = _ref19.yValuesArray;
1431014310
return yValuesArray.map(function (_ref20) {
@@ -14315,9 +14315,9 @@
1431514315
return normalizedPivotConfig.x.map(valueToObject(xValues, m)).concat(normalizedPivotConfig.y.map(valueToObject(yValues, m))).reduce(function (a, b) {
1431614316
return Object.assign(a, b);
1431714317
}, {});
14318-
});
14319-
}).reduce(function (a, b) {
14320-
return a.concat(b);
14318+
}).reduce(function (a, b) {
14319+
return Object.assign(a, b);
14320+
}, {});
1432114321
});
1432214322
}
1432314323
}, {

packages/cubejs-client-core/src/ResultSet.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -200,13 +200,13 @@ export default class ResultSet {
200200
})
201201
);
202202

203-
return this.pivot(pivotConfig).map(({ xValues, yValuesArray }) => (
203+
return this.pivot(normalizedPivotConfig).map(({ xValues, yValuesArray }) => (
204204
yValuesArray.map(([yValues, m]) => (
205205
normalizedPivotConfig.x.map(valueToObject(xValues, m))
206206
.concat(normalizedPivotConfig.y.map(valueToObject(yValues, m)))
207207
.reduce((a, b) => Object.assign(a, b), {})
208-
))
209-
)).reduce((a, b) => a.concat(b));
208+
)).reduce((a, b) => Object.assign(a, b), {})
209+
));
210210
}
211211

212212
tableColumns(pivotConfig) {

packages/cubejs-react/dist/cubejs-react.umd.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@
267267
return store[key] || (store[key] = value !== undefined ? value : {});
268268
})('versions', []).push({
269269
version: _core.version,
270-
mode: _library ? 'pure' : 'global',
270+
mode: 'global',
271271
copyright: '© 2018 Denis Pushkarev (zloirock.ru)'
272272
});
273273
});
@@ -1434,7 +1434,7 @@
14341434
// Set @@toStringTag to native iterators
14351435
_setToStringTag(IteratorPrototype, TAG, true);
14361436
// fix for some old engines
1437-
if (typeof IteratorPrototype[ITERATOR$3] != 'function') _hide(IteratorPrototype, ITERATOR$3, returnThis);
1437+
if (!_library && typeof IteratorPrototype[ITERATOR$3] != 'function') _hide(IteratorPrototype, ITERATOR$3, returnThis);
14381438
}
14391439
}
14401440
// fix Array#{values, @@iterator}.name in V8 / FF
@@ -1443,7 +1443,7 @@
14431443
$default = function values() { return $native.call(this); };
14441444
}
14451445
// Define iterator
1446-
if (BUGGY || VALUES_BUG || !proto[ITERATOR$3]) {
1446+
if ((!_library || FORCED) && (BUGGY || VALUES_BUG || !proto[ITERATOR$3])) {
14471447
_hide(proto, ITERATOR$3, $default);
14481448
}
14491449
// Plug for library

0 commit comments

Comments
 (0)