duckdb / dbt-duckdb

dbt (http://getdbt.com) adapter for DuckDB (http://duckdb.org)
Apache License 2.0
881 stars 78 forks source link

is_number() incorrectly false on some int subtypes #304

Closed droher closed 9 months ago

droher commented 9 months ago

dbt's doc says that Column's is_number() should be true for any number type: https://docs.getdbt.com/reference/dbt-classes#column

But it looks like it's only recognizing certain types of duckdb integers. For example:

{{ col }}: {{ col.is_number() }}

yields

<Column event_key (UINTEGER)>: False
 <Column at_bats (TINYINT)>: False

<Column season (SMALLINT)>: True
<Column outs_recorded (INTEGER)>: True
jwills commented 9 months ago

@droher hey man, nice to hear from you (although I wish it were under happier circumstances!)

Looks like we need to subclass the dbt Column class in dbt-duckdb and fix this bit of it up: https://github.com/dbt-labs/dbt-core/blob/main/core/dbt/adapters/base/column.py#L52

droher commented 9 months ago

Thanks for the fix and nice to hear from you as well - I will have happier circumstances to report in a couple days when I release my baseball database that has been the impetus for all of the bug reports!