You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by sh...@apache.org on 2021/07/14 04:57:01 UTC
[echarts] 01/02: refact(data): fix storage clone lost indices.
This is an automated email from the ASF dual-hosted git repository.
shenyi pushed a commit to branch dataset-perf
in repository https://gitbox.apache.org/repos/asf/echarts.git
commit e9e6077c0a7a6496034793c354c0336a7e2a33e2
Author: pissang <bm...@gmail.com>
AuthorDate: Wed Jul 14 12:55:45 2021 +0800
refact(data): fix storage clone lost indices.
---
src/data/DataStorage.ts | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/data/DataStorage.ts b/src/data/DataStorage.ts
index 01574ec..7c9322a 100644
--- a/src/data/DataStorage.ts
+++ b/src/data/DataStorage.ts
@@ -796,7 +796,7 @@ class DataStorage {
*/
map(dims: DimensionIndex[], cb: MapCb): DataStorage {
// TODO only clone picked chunks.
- const target = this.clone(dims, true);
+ const target = this.clone(dims);
const targetChunks = target._chunks;
@@ -854,7 +854,7 @@ class DataStorage {
valueDimension: DimensionIndex,
rate: number
) {
- const target = this.clone([valueDimension]);
+ const target = this.clone([valueDimension], true);
const targetStorage = target._chunks;
const dimStore = targetStorage[valueDimension];
const len = this.count();
@@ -941,7 +941,7 @@ class DataStorage {
sampleValue: (frameValues: ArrayLike<ParsedValue>) => ParsedValueNumeric,
sampleIndex: (frameValues: ArrayLike<ParsedValue>, value: ParsedValueNumeric) => number
): DataStorage {
- const target = this.clone([dimension]);
+ const target = this.clone([dimension], true);
const targetStorage = target._chunks;
const frameValues = [];
@@ -1108,7 +1108,7 @@ class DataStorage {
*
* @param clonedDims Determine which dims to clone. Will share the data if not specified.
*/
- clone(clonedDims?: number[], cloneIndices?: boolean): DataStorage {
+ clone(clonedDims?: number[], ignoreIndices?: boolean): DataStorage {
const target = new DataStorage();
const chunks = this._chunks;
const clonedDimsMap = clonedDims && reduce(clonedDims, (obj, dimIdx) => {
@@ -1128,7 +1128,7 @@ class DataStorage {
}
this._copyCommonProps(target);
- if (cloneIndices) {
+ if (!ignoreIndices) {
target._indices = this._cloneIndices();
}
target._updateGetRawIdx();
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org