rpbouman / huey

A UI for DuckDB
MIT License
199 stars 14 forks source link

Refactor data type and value handling #54

Closed rpbouman closed 7 months ago

rpbouman commented 7 months ago

We have the following type systems to deal with:

the relationships between these systems:

When we execute a query to populate the axes/tuples, we obtain a resultset as an "Arrow table". This is where it becomes interesting:

Once we got the value from the resultset, we often need to format it so it can be presented in the UI. For formatting of numbers and dates we use the Intl.NumberFormat or Intl.DateTimeFormat instances and those accept javascript values

The real trouble starts when we need to use the values returned by a resultset as values for parameters in a prepared statement. There is absolutely no guarantee that this will work. Even a relatively simple case, where we receive a Javascript BigInt instance from the resultset fails when we try to bind it (see: https://github.com/duckdb/duckdb-wasm/issues/1563)