fix: override is_string/is_number/is_float type classification for Databricks types
Summary
col.is_string(), col.is_number(), col.is_float(), and col.is_numeric() all return False for Databricks/Spark column types because the base Column class only recognizes PostgreSQL-style type names.
Closes #1380 Related: dbt-labs/dbt-spark#658
Root Cause
The base Column class from dbt-adapters defines is_string() etc. using type name sets that include PostgreSQL types (text, character varying, etc.) but not Spark/Databricks types (string, int, bigint, double, etc.).
DatabricksColumn inherits from SparkColumn which inherits from the base Column, but neither overrides these classification methods.
Fix
Override is_string(), is_number(), is_float(), is_integer(), and is_numeric() on DatabricksColumn with the complete set of Spark/Databricks type names:
- String types:
string,varchar,char,text, etc. - Numeric types:
tinyint,smallint,int,integer,bigint,long,float,double,decimal,numeric,real(plusdecimal(p,s)variants) - Float types:
float,double,real - Integer types:
tinyint,smallint,int,integer,bigint,long
Verification
Column: name03 | Data Type: string | Is String: True (was: False)
Column: age | Data Type: int | Is Number: True (was: False)
Checklist
- [x] No breaking changes — only adds overrides, doesn't change any existing behavior for correctly-typed columns
- [x] Covers all Spark/Databricks primitive types
HI @psaikaushik can you select Allow edits from maintainers or do a rebase from main. The tests are failing because the branch is in an inconsistent state w.r.t CI and can 't review without it.
HI @psaikaushik can you select
Allow edits from maintainersor do a rebase from main. The tests are failing because the branch is in an inconsistent state w.r.t CI and can 't review without it.
Rebased and also allowed edits for maintainers. thanks for pointing it out! @sd-db
Let us look to add tests + update CHANGELOG
Added tests and also updated changelog
@sd-db : Fixed the broken formatting test. Please take a look now. thanks!