SQL Data Types
SQL data type rules
Databricks uses several rules to resolve conflicts among data types:
- Promotion safely expands a type to a wider type.
- Implicit downcasting narrows a type. The opposite of promotion.
- Implicit crosscasting transforms a type into a type of another type family.
You can also explicitly cast between many types:
- cast function casts between most types, and returns errors if it cannot.
- try_cast function works like cast function but returns NULL when passed invalid values.
- Other builtin functions cast between types using provided format directives.
Type precedence graph
SQL data type rules | Databricks on AWS