Skip to content

Commit

Permalink
Fix parsing decimal type and bigint type in arrow format
Browse files Browse the repository at this point in the history
  • Loading branch information
lixun910 committed Jul 24, 2024
1 parent 73157cd commit 5a6d882
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/layers/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export {pointToPolygonGeo} from './grid-layer/grid-utils';
import {default as HexagonLayer} from './hexagon-layer/hexagon-layer';
import {default as GeojsonLayer} from './geojson-layer/geojson-layer';
export {default as GeojsonLayer, defaultElevation, defaultLineWidth, defaultRadius} from './geojson-layer/geojson-layer';
export {default as PointLayer} from './point-layer/point-layer';
import {default as ClusterLayer} from './cluster-layer/cluster-layer';
import {default as IconLayer} from './icon-layer/icon-layer';
import {default as HeatmapLayer} from './heatmap-layer/heatmap-layer';
Expand Down
4 changes: 2 additions & 2 deletions src/utils/src/arrow-data-container.ts
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ export function arrowDataTypeToFieldType(arrowType: arrow.DataType): string {
return ALL_FIELD_TYPES.date;
} else if (arrow.DataType.isTimestamp(arrowType) || arrow.DataType.isTime(arrowType)) {
return ALL_FIELD_TYPES.timestamp;
} else if (arrow.DataType.isFloat(arrowType)) {
} else if (arrow.DataType.isFloat(arrowType) || arrow.DataType.isDecimal(arrowType)) {
return ALL_FIELD_TYPES.real;
} else if (arrow.DataType.isInt(arrowType)) {
return ALL_FIELD_TYPES.integer;
Expand Down Expand Up @@ -259,7 +259,7 @@ export function arrowDataTypeToAnalyzerDataType(
return AnalyzerDATA_TYPES.DATE;
} else if (arrow.DataType.isTimestamp(arrowType) || arrow.DataType.isTime(arrowType)) {
return AnalyzerDATA_TYPES.DATETIME;
} else if (arrow.DataType.isFloat(arrowType)) {
} else if (arrow.DataType.isFloat(arrowType) || arrow.DataType.isDecimal(arrowType)) {
return AnalyzerDATA_TYPES.FLOAT;
} else if (arrow.DataType.isInt(arrowType)) {
return AnalyzerDATA_TYPES.INT;
Expand Down
4 changes: 2 additions & 2 deletions src/utils/src/data-scale-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ export function getQuantileDomain(
sortFunc?: sort
): number[] {
const values = typeof valueAccessor === 'function' ? data.map(valueAccessor) : data;

return values.filter(notNullorUndefined).sort(sortFunc);
// in case values are bigints, we need to convert them to numbers
return values.map(Number).filter(notNullorUndefined).sort(sortFunc);
}

/**
Expand Down

0 comments on commit 5a6d882

Please sign in to comment.