Skip to content

Consolidate apache arrow imports #33

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions src/child.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@
* Strongly typed accessors for children, since arrow.Data.children[] is untyped
*/

import { Data } from "apache-arrow/data";
import { Vector } from "apache-arrow/vector";
import { Float } from "apache-arrow/type";
import { Data, Vector, type Float } from "apache-arrow";
import {
LineStringData,
MultiLineStringData,
Expand Down
2 changes: 1 addition & 1 deletion src/data.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Data } from "apache-arrow/data";
import { Data } from "apache-arrow";
import {
WKB,
Point,
Expand Down
6 changes: 1 addition & 5 deletions src/io/wkb.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { makeData } from "apache-arrow/data";
import { makeData, Field, FixedSizeList, Float64, List } from "apache-arrow";
import {
GeoArrowData,
LineStringData,
Expand All @@ -14,9 +14,6 @@ import type {
BinaryPolygonGeometry,
} from "@loaders.gl/schema";
import { assert, assertFalse } from "../algorithm/utils/assert";
import { FixedSizeList, Float64, List } from "apache-arrow/type";
import { Field } from "apache-arrow/schema";


export enum WKBType {
Point,
Expand All @@ -39,7 +36,6 @@ export function parseWkb(
): GeoArrowData {
const parsedGeometries: BinaryGeometry[] = [];


for (const item of iterBinary(data)) {
if (item === null) {
throw new Error("Null entries are not currently supported");
Expand Down
12 changes: 6 additions & 6 deletions src/type.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import {
Binary,
Struct,
Float,
List,
FixedSizeList,
type Binary,
type Struct,
type Float,
type List,
type FixedSizeList,
DataType,
} from "apache-arrow/type";
} from "apache-arrow";

// Note: this apparently has to be arrow.Float and not arrow.Float64 to ensure
// that recreating a data instance with arrow.makeData type checks using the
Expand Down
2 changes: 1 addition & 1 deletion src/vector.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Vector } from "apache-arrow/vector";
import { Vector } from "apache-arrow";
import {
Point,
LineString,
Expand Down
5 changes: 1 addition & 4 deletions src/worker/hard-clone.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
import { Data } from "apache-arrow/data";
import { DataType } from "apache-arrow/type";
import { Vector } from "apache-arrow/vector";
import { BufferType } from "apache-arrow/enum";
import { Data, DataType, Vector, BufferType } from "apache-arrow";
import type { Buffers } from "apache-arrow/data";

type TypedArray =
Expand Down
13 changes: 7 additions & 6 deletions src/worker/rehydrate.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import {
DataType,
BufferType,
Type,
Data,
Vector,
Field,
Null,
Int,
Float,
Expand All @@ -18,11 +22,8 @@ import {
FixedSizeList,
Map_,
Duration,
} from "apache-arrow/type";
import { BufferType, Type } from "apache-arrow/enum";
import { Data } from "apache-arrow/data";
import { Vector } from "apache-arrow/vector";
import { Field } from "apache-arrow/schema";
type DataType,
} from "apache-arrow";
import type { Buffers } from "apache-arrow/data";
import { Polygon, isPolygon } from "../type";
import { PolygonData } from "../data";
Expand Down
6 changes: 2 additions & 4 deletions src/worker/transferable.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
import { DataType } from "apache-arrow/type";
import { BufferType } from "apache-arrow/enum";
import { Data } from "apache-arrow/data";
import { Vector } from "apache-arrow/vector";
import { Data, Vector, BufferType, type DataType } from "apache-arrow";
import { hardClone } from "./hard-clone";

/**
Expand Down Expand Up @@ -63,6 +60,7 @@ export function preparePostMessage<T extends DataType>(
if (input.buffers[BufferType.OFFSET] !== undefined) {
transferArrayBuffers.push(input.buffers[BufferType.OFFSET].buffer);
}

if (input.buffers[BufferType.DATA] !== undefined) {
transferArrayBuffers.push(input.buffers[BufferType.DATA].buffer);
}
Expand Down