Skip to content
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

histogram causes crash #448

Closed
stratospark opened this issue Dec 7, 2021 · 2 comments · Fixed by #1769
Closed

histogram causes crash #448

stratospark opened this issue Dec 7, 2021 · 2 comments · Fixed by #1769
Labels
bug Something isn't working

Comments

@stratospark
Copy link
Contributor

The following currently breaks on https://shell.duckdb.org/. It works fine on my CLI.

DuckDB Web Shell
Database: v0.3.1-dev535
Package:  @duckdb/[email protected]

Connected to a transient in-memory database.
Enter .help for usage hints.

duckdb> create table t1 (i integer);
┌┐
└┘

duckdb> insert into t1 values (1),(2),(1);
┌───────┐
│ Count │
╞═══════╡
│     3 │
└───────┘

duckdb> select * from t1;
┌───┐
│ i │
╞═══╡
│ 1 │
│ 2 │
│ 1 │
└───┘

duckdb> select histogram(i) from t1;

error in browser console:

f272ce859168ca188950.wasm:0x1b25e3 Uncaught (in promise) RuntimeError: unreachable
    at f272ce859168ca188950.wasm:0x1b25e3
    at f272ce859168ca188950.wasm:0x1b8514
    at f272ce859168ca188950.wasm:0x1bc638
    at f272ce859168ca188950.wasm:0x1bc0b6
    at f272ce859168ca188950.wasm:0x1bc66e
    at f272ce859168ca188950.wasm:0xda902
    at f272ce859168ca188950.wasm:0x1411a2
    at f272ce859168ca188950.wasm:0x1402ea
    at f272ce859168ca188950.wasm:0xcc214
    at f272ce859168ca188950.wasm:0x1bd805

expected result

D .version
SQLite v0.3.1 88aa81c6b
msvc-1929

D select histogram(i) from t1;
┌──────────────┐
│ histogram(i) │
├──────────────┤
│ {1=2, 2=1}   │
└──────────────┘
@domoritz domoritz added the bug Something isn't working label Dec 7, 2021
ankoh added a commit that referenced this issue Dec 7, 2021
ankoh added a commit that referenced this issue Dec 7, 2021
@ankoh
Copy link
Member

ankoh commented Dec 7, 2021

Thanks for reporting this. That's a bug in the shell.
DuckDB-Wasm itself will return an arrow.Map_.

describe('GitHub issues', () => {
it('448', async () => {
conn = await db().connect();
await conn.query(`create temp table test448(i integer)`);
await conn.query(`insert into test448 values (1),(2),(1)`);
let result = await conn.query(`select * from test448`);
expect(result.numCols).toBe(1);
expect(result.length).toBe(3);
expect(result.getColumnAt(0)?.toArray()).toEqual(new Int32Array([1, 2, 1]));
result = await conn.query<{ i: arrow.Map_<arrow.Int32, arrow.Uint64> }>(`select histogram(i) from test448`);
expect(result.numCols).toBe(1);
expect(result.length).toBe(1);
const array = result.getColumnAt(0)!.toArray();
expect(array.length).toEqual(1);
expect(array[0].toString()).toEqual('{ 1: 2, 2: 1 }');
});

@sgilligan
Copy link

sgilligan commented Aug 20, 2022

@ankoh will the shell display the result? When I try (@duckdb/[email protected]), the shell shows an elapsed time count but nothing else. I must admit I'm having trouble retrieving histogram results. I get an undefined length from the result (vs the test above) eg: in console output here: https://codesandbox.io/s/confident-chaplygin-owxqh3?file=/src/DuckDb.js

[Edit] ignore me .. I see it is .getChildAt(0) for the histogram output (I've updated the sandbox with that)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants