observablehq / stdlib

The Observable standard library.
https://observablehq.com/@observablehq/standard-library
ISC License
957 stars 83 forks source link

silently accept an empty array? #327

Open Fil opened 1 year ago

Fil commented 1 year ago

even though Arrow doesn't know what to do with the empty array, it seems to me that

a = DuckDBClient.of({ name: [] })

should not throw an error. I'm not sure if this is enough, though (do we want to create an empty table with no columns; possibly respect a .columns property on the empty array)?

A related case is when the array contains tricky objects, for example:

DuckDBClient.of({ name: [{ a: {} }, {}] })

this currently fails with the Arrow error: TypeError: Cannot read properties of undefined (reading 'constructor'), when we could maybe cast to strings (?).

🤔