Skip to content
Open
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
20 changes: 20 additions & 0 deletions benches/bunarrow.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { open } from '..';
import { run, bench } from 'mitata';

const db = open('/tmp/test.db');
const connection = db.connect();
connection.query(`INSTALL arrow`)
connection.query(`LOAD arrow`)
const q = 'SELECT * FROM to_arrow_ipc((select i, i as a from generate_series(1, 100000) s(i)))';

const p = connection.prepare(q);
console.log('benchmarking query: ' + q);

bench('duckdb', () => {
p.query().map(d=>d.ipc);
});

await run({ percentiles: false });

connection.close();
db.close();
15 changes: 15 additions & 0 deletions tests/bunarrow.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { open } from '..';
import { tableFromIPC } from 'apache-arrow';
const db = open(':memory:');
const con = db.connect();
con.query(`INSTALL arrow;`);
con.query(`LOAD arrow;`);
const ipc = con.query(`
SELECT * FROM to_arrow_ipc((
SELECT
42 as value
))`);
const data = tableFromIPC(ipc.map(d => d.ipc));
console.log(data.toString());
con.close();
db.close();
32 changes: 32 additions & 0 deletions tests/bunarrow_vega_lite.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { open } from '..';
import { tableFromIPC } from 'apache-arrow';
const vl = require('vega-lite');
const vega = require('vega');
const db = open(':memory:');
const con = db.connect();
con.query(`INSTALL arrow;`);
con.query(`LOAD arrow;`);
const ipc = con.query(`
SELECT * FROM to_arrow_ipc((
SELECT 'a' as id,42 as value
UNION
SELECT 'b', 35
))`);
const data = tableFromIPC(ipc.map(d => d.ipc))
const vlSpec = {
"data": {"values": data},
"mark": "bar",
"encoding": {
"x": {"field": "id", "type": "ordinal"},
"y": {"field": "value", "type": "quantitative"}
}
}
const view = new vega.View(vega.parse(vl.compile(vlSpec).spec),{renderer: 'none'});
view.toSVG().then(async function (svg) {
await Bun.write("tests/vega_lite_test.svg", svg);
console.log("vega_lite_test.svg written");
}).catch(function(err) {
console.error(err);
});
con.close();
db.close();