• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

keplergl / kepler.gl / 19670167673

25 Nov 2025 12:52PM UTC coverage: 61.76% (-0.007%) from 61.767%
19670167673

push

github

web-flow
fix: Allow passing arrow tables to ArrowDataContainer (#3242)

* fix: copy geometry when geometry is of binary format (#3236)

* fix: copy geometry when geometry is of binary format

Signed-off-by: Ihor Dykhta <dikhta.igor@gmail.com>

* nit

Signed-off-by: Ihor Dykhta <dikhta.igor@gmail.com>

---------

Signed-off-by: Ihor Dykhta <dikhta.igor@gmail.com>
Signed-off-by: Ilya Boyandin <ilyabo@gmail.com>

* fix: Allow passing arrow tables to ArrowDataContainer

Signed-off-by: Ilya Boyandin <ilyabo@gmail.com>

* only add arrowTable prop to CREATE_TABLE_TASK when set

Signed-off-by: Ilya Boyandin <ilyabo@gmail.com>

---------

Signed-off-by: Ihor Dykhta <dikhta.igor@gmail.com>
Signed-off-by: Ilya Boyandin <ilyabo@gmail.com>
Co-authored-by: Igor Dykhta <igorDykhta@users.noreply.github.com>

6349 of 12189 branches covered (52.09%)

Branch coverage included in aggregate %.

2 of 5 new or added lines in 2 files covered. (40.0%)

48 existing lines in 2 files now uncovered.

13043 of 19210 relevant lines covered (67.9%)

81.77 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

38.1
/src/utils/src/data-container-utils.ts
1
// SPDX-License-Identifier: MIT
2
// Copyright contributors to the kepler.gl project
3

4
import {ArrowDataContainer} from './arrow-data-container';
5
import {RowDataContainer} from './row-data-container';
6
import {IndexedDataContainer} from './indexed-data-container';
7

8
import {DataContainerInterface} from './data-container-interface';
9
import {ProtoDatasetField} from '@kepler.gl/types';
10
import * as arrow from 'apache-arrow';
11

12
export type DataContainerOptions = {
13
  inputDataFormat?: string; // one of DataForm
14
  fields?: ProtoDatasetField[];
15
  arrowTable?: arrow.Table;
16
};
17

18
export const DataForm = {
15✔
19
  ROWS_ARRAY: 'ROWS_ARRAY',
20
  COLS_ARRAY: 'COLS_ARRAY'
21
};
22

23
const defaultOptions: DataContainerOptions = {
15✔
24
  inputDataFormat: DataForm.ROWS_ARRAY
25
};
26

27
/**
28
 * Creates a data container wrapper for the data.
29
 * @param data Data.
30
 * @param options Options.
31
 * @returns A data container object which is based on data and options.
32
 */
33
export function createDataContainer(
34
  data: any[],
35
  options: DataContainerOptions = defaultOptions
179✔
36
): DataContainerInterface {
37
  options = {...defaultOptions, ...options};
341✔
38

39
  if (options.inputDataFormat === DataForm.ROWS_ARRAY) {
341!
40
    return new RowDataContainer({rows: data, fields: options.fields});
341✔
41
  } else if (options.inputDataFormat === DataForm.COLS_ARRAY) {
×
NEW
42
    return new ArrowDataContainer({cols: data, fields: options.fields, arrowTable: options.arrowTable});
×
43
  }
44

45
  throw Error('Failed to create a data container: not implemented format');
46
}
47

48
/**
UNCOV
49
 * Creates a data container wrapper around another data container.
×
50
 * @param dataContainer Parent data container.
51
 * @param indices An array of row indices in the parent data container.
52
 */
53
export function createIndexedDataContainer(
54
  dataContainer: DataContainerInterface,
55
  indices: number[]
56
): DataContainerInterface {
57
  return new IndexedDataContainer(dataContainer, indices);
58
}
59

60
/**
61
 * Get a sample of rows from a data container.
1✔
62
 * @param dataContainer Data container to get samples from.
63
 * @param sampleSize Max number of samples.
64
 * @returns A data container which contains samples from the original data container.
65
 */
66
export function getSampleData(
67
  dataContainer: DataContainerInterface,
68
  sampleSize = 500
69
): DataContainerInterface {
70
  const numberOfRows = dataContainer.numRows();
71
  const sampleStep = Math.max(Math.floor(numberOfRows / sampleSize), 1);
72

×
73
  const indices: number[] = [];
74
  for (let i = 0; i < numberOfRows; i += sampleStep) {
×
75
    indices.push(i);
×
76
  }
UNCOV
77

×
78
  return createIndexedDataContainer(dataContainer, indices);
×
UNCOV
79
}
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc