duckdb / duckdb/duckdb-node

[nodejs] `register_buffer()` registers only first table

Open
#32 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
91
Forks
36
PR merge metrics
No merged PRs in 30d

Description

### What happens?

[register_buffer()](https://duckdb.org/docs/api/nodejs/reference#module_duckdb..Connection+register_buffer) function takes an `ArrowIterable` as argument for buffers to register. This implies that it's possible to register multiple of them under one table. However, when more than one is provided, only the first one is registered

### To Reproduce

Example - following code outputs "3" rather than "6" as expected

```typescript
import { tableFromArrays, tableToIPC } from 'apache-arrow';
import { Database } from 'duckdb';

const db = new Database(':memory:');
const sampleDataPart1 = tableFromArrays({
a: [1, 2, 3],
});
const sampleDataPart2 = tableFromArrays({
a: [4, 5, 6],
});

db.exec(` INSTALL arrow; LOAD arrow;`, (err) => {
if (err) {
throw err;
}
db.register_buffer(
'sample_data',
[tableToIPC(sampleDataPart1), tableToIPC(sampleDataPart2)],
true,
(err) => {
if (err) {
throw err;
}
db.all('select count(*) as total from sample_data', (err, res) => {
if (err) {
throw err;
}
console.log((res[0] as any).total);
});
}
);
});
```

### OS:

macos

### DuckDB Version:

0.8.1

### DuckDB Client:

NodeJS

### Full Name:

Przemek Maciolek

### Affiliation:

Motif Analytics

### Have you tried this on the latest `main` branch?

I have tested with a main build

### Have you tried the steps to reproduce? Do they include all relevant data and configuration? Does the issue you report still appear there?

- [X] Yes, I have

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.