Problem
When you try to query a view or table that contains a column of type VARIANT on serverless compute, you receive the following error.
[UNSUPPORTED_OPERATION] data type is not supported.
Cause
You’re using serverless environment version 1, which does not support VARIANT. Serverless environment 1 is based on Databricks Runtime 14.3 LTS, which is lower than the minimum runtime requirement for VARIANT. Support for VARIANT is available with Databricks SQL and Databricks Runtime 15.3 and above.
Solution
Switch to serverless environment version 2, which uses a newer Databricks Runtime that supports VARIANT.
To change your serverless environment from version 1 to version 2:
- Open your notebook in Databricks.
- Locate the Environment icon in right side panel of the notebook interface.
- Click to expand, and look for the Environment version option.
- Click the chevron to expand the dropdown and choose version 2 from the available options.
For more information, review the VARIANT type (AWS | Azure | GCP) documentation.