duckdb / duckdb-wasm

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

Omitted rows from result / results returned on error #1329

Closed jonathanswenson closed 1 week ago

jonathanswenson commented 1 year ago

What happens?

When I run the following query on duckdb shell, I get different results than when I run it in the CLI

with data as ( 
  select 2 as "col1" 
  union all 
  select 1 
  union all 
  select 0 
  union all 
  select -1
) select col1, ln(col1) from data;

In shell / wasm I get a result back, but for some reason it only has a single row and does not show any error

image

In the cli I get an error (I think that's what expected).

v0.8.2-dev1764 07b0b0a2a4
Enter ".help" for usage hints.
Connected to a transient in-memory database.
Use ".open FILENAME" to reopen on a persistent database.
D with data as ( select 2 as "col1" union all select 1 union all select 0 union all select -1) select col1, ln(col1) from data;
Error: Out of Range Error: cannot take logarithm of zero

To Reproduce

with data as ( 
  select 2 as "col1" 
  union all 
  select 1 
  union all 
  select 0 
  union all 
  select -1
) select col1, ln(col1) from data;

Browser/Environment:

Chrome 114

Device:

Macbook Pro M1

DuckDB-Wasm Version:

v0.8.2-dev1585

DuckDB-Wasm Deployment:

shell.duckdb.org

Full Name:

Jonathan Swenson

Affiliation:

Omni

carlopi commented 3 months ago

Update: this now makes a bit more sense, see https://shell.duckdb.org/#queries=v0,with-data-as-(-%0A--select-2-as-%22col1%22-%0A--union-all-%0A--select-1-%0A--union-all-%0A--select-0-%0A--union-all-%0A--select-%201%0A)-select-col1%2C-ln(col1)-from-data~, where an empty result is shown instead of a broken ones.

Still is not ideal, we need to find where the ConversionErrors disappears.

carlopi commented 1 week ago

Update/2: Now this fails as it in the CLI.

CLI:

carlo@ScroogeMcDuck duckdb_httpfs % duckdb
v1.1.1 af39bd0dcf
Enter ".help" for usage hints.
Connected to a transient in-memory database.
Use ".open FILENAME" to reopen on a persistent database.
D with data as ( 
    select 2 as "col1" 
    union all 
    select 1 
    union all 
    select 0 
    union all 
    select -1
  ) select col1, ln(col1) from data;
Out of Range Error: cannot take logarithm of zero
D 

DuckDB Wasm:

duckdb> with data as ( 
   ...>   select 2 as "col1" 
   ...>   union all 
   ...>   select 1 
   ...>   union all 
   ...>   select 0 
   ...>   union all 
   ...>   select -1
   ...> ) select col1, ln(col1) from data;
Out of Range Error: cannot take logarithm of zero

(see live at https://shell.duckdb.org/#queries=v0,with-data-as-(-%0A--select-2-as-%22col1%22-%0A--union-all-%0A--select-1-%0A--union-all-%0A--select-0-%0A--union-all-%0A--select-%201%0A)-select-col1%2C-ln(col1)-from-data)