Skip to content

Commit

Permalink
clean
Browse files Browse the repository at this point in the history
Signed-off-by: Xun Li <[email protected]>
  • Loading branch information
lixun910 committed Nov 2, 2023
1 parent b76ae9b commit 2631251
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 8 deletions.
2 changes: 0 additions & 2 deletions src/constants/src/default-settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -497,8 +497,6 @@ const GREEN2 = '74, 165, 150';
const RED = '237, 88, 106';
const ORANGE = '231, 110, 58';

export const ARROW_GEO_METADATA_KEY = 'geo';

export const FIELD_TYPE_DISPLAY = {
[ALL_FIELD_TYPES.boolean]: {
label: 'bool',
Expand Down
1 change: 0 additions & 1 deletion src/layers/src/geojson-layer/geojson-layer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,6 @@ export default class GeoJsonLayer extends Layer {

updateLayerMeta(dataContainer) {
const getFeature = this.getPositionAccessor(dataContainer);

this.dataToFeature = getGeojsonDataMaps(dataContainer, getFeature);
// get bounds from features
const bounds = getGeojsonBounds(this.dataToFeature);
Expand Down
1 change: 1 addition & 0 deletions src/layers/src/geojson-layer/geojson-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ export enum FeatureTypes {
type FeatureTypeMap = {
[key in FeatureTypes]: boolean;
};
/* eslint-enable */

export function parseGeoJsonRawFeature(rawFeature: unknown): Feature | null {
if (typeof rawFeature === 'object') {
Expand Down
10 changes: 5 additions & 5 deletions src/processors/src/data-processor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.

import {Table as ApacheArrowTable, Field as ArrowField, RecordBatch} from 'apache-arrow';
import * as arrow from 'apache-arrow';
import {csvParseRows} from 'd3-dsv';
import {DATA_TYPES as AnalyzerDATA_TYPES} from 'type-analyzer';
import normalize from '@mapbox/geojson-normalize';
Expand Down Expand Up @@ -398,15 +398,15 @@ export function processKeplerglDataset(
* @param arrowTable the arrow table to parse
* @returns dataset containing `fields` and `rows` or null
*/
export function processArrowTable(arrowBatches: RecordBatch[]): ProcessorResult | null {
export function processArrowTable(arrowBatches: arrow.RecordBatch[]): ProcessorResult | null {
if (arrowBatches.length === 0) {
return null;
}
const arrowTable = new ApacheArrowTable(arrowBatches);
const arrowTable = new arrow.Table(arrowBatches);
const fields: Field[] = [];

// parse fields
arrowTable.schema.fields.forEach((field: ArrowField, index: number) => {
arrowTable.schema.fields.forEach((field: arrow.Field, index: number) => {
const isGeometryColumn = field.metadata.get('ARROW:extension:name')?.startsWith('geoarrow');
fields.push({
name: field.name,
Expand All @@ -427,7 +427,7 @@ export function processArrowTable(arrowBatches: RecordBatch[]): ProcessorResult

const cols = [...Array(arrowTable.numCols).keys()].map(i => arrowTable.getChildAt(i));
// return empty rows and use raw arrow table to construct column-wise data container
return {info: {format: 'Arrow'}, fields, rows: [], cols, metadata: arrowTable.schema.metadata};
return {fields, rows: [], cols, metadata: arrowTable.schema.metadata};
}

export const DATASET_HANDLERS = {
Expand Down
1 change: 1 addition & 0 deletions src/processors/src/file-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ export async function* makeProgressIterator(
let rowCount = 0;

for await (const batch of asyncIterator) {
// the length could be stored in `batch.length` for arrow batch
const rowCountInBatch = (batch.data && (batch.data.length || batch.length)) || 0;
rowCount += rowCountInBatch;
const percent = Number.isFinite(batch.bytesUsed) ? batch.bytesUsed / info.size : null;
Expand Down

0 comments on commit 2631251

Please sign in to comment.