duckdb / duckdb-wasm

WebAssembly version of DuckDB
https://shell.duckdb.org
MIT License
1.2k stars 127 forks source link

[WASM] Get wrong result, using Array with Interval #1203

Closed zhejiangxiaomai closed 3 months ago

zhejiangxiaomai commented 1 year ago

What happens?

When I use array with Interval. The result is not as expected.

To Reproduce

using https://shell.duckdb.org/ When I type "select INTERVAL 30 SECONDS;", result is 00:00:30. But the strange thing is When I type "select ARRAY[INTERVAL 30 SECONDS];", result is 00:00:00.030 . image

OS:

DuckDB Web Shell

DuckDB Version:

v0.0.1-dev0

DuckDB Client:

web

Full Name:

zhenhui zhao

Affiliation:

zhenhui.zhao@intel.com

Have you tried this on the latest master branch?

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

Mytherin commented 1 year ago

Thanks for the report!

It looks like this is exclusively a problem in the WASM version - likely related to the result set conversion there.

carlopi commented 1 year ago

Hi @zhejiangxiaomai!

This looks like it's working now in a more "uniform way", but there has been an independent regression on this:

duckdb> select interval 30 seconds;
┌────────────────────────────────────────────────────────┐
│ to_seconds(CAST(30 AS BIGINT))                         │
╞════════════════════════════════════════════════════════╡
│ 0 years 6 mons -64771072 days 0 hours 0 mins 0.00 secs │
└────────────────────────────────────────────────────────┘
Elapsed: 32 ms

duckdb> select array [interval 30 seconds];
┌──────────────────────────────────────────────────────────┐
│ (ARRAY[to_seconds(CAST(30 AS BIGINT))])                  │
╞══════════════════════════════════════════════════════════╡
│ [0 years 6 mons -64771072 days 0 hours 0 mins 0.00 secs] │
└──────────────────────────────────────────────────────────┘
Elapsed: 10 ms

so that the result is currently non-sensical.

I will have a look, thanks for your report!

carlopi commented 3 months ago

Thanks, this is solved thanks to #1769