Skip to content

Commit ef8e1df

Browse files
Instantiate DuckDBClient for Arrow tables (#322)
1 parent 8a4af97 commit ef8e1df

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/table.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import {ascending, descending, reverse} from "d3-array";
22
import {FileAttachment} from "./fileAttachment.js";
3+
import {isArrowTable} from "./arrow.js";
4+
import {DuckDBClient} from "./duckdb.js";
35

46
const nChecks = 20; // number of values to check in each array
57

@@ -170,9 +172,13 @@ export async function loadDataSource(source, mode) {
170172
switch (source.mimeType) {
171173
case "application/x-sqlite3": return source.sqlite();
172174
}
175+
if (/\.arrow$/i.test(source.name)) return DuckDBClient.of({__table: await source.arrow({version: 9})});
173176
}
174177
throw new Error(`unsupported file type: ${source.mimeType}`);
175178
}
179+
if ((mode === "table" || mode === "sql") && isArrowTable(source)) {
180+
return DuckDBClient.of({__table: source});
181+
}
176182
return source;
177183
}
178184

0 commit comments

Comments
 (0)