cancel
Showing results for 
Search instead for 
Did you mean: 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
cancel
Showing results for 
Search instead for 
Did you mean: 

(Design Decision) Why VOID in STRUCT is not castable to VARIANT?

Dhruv-22
Contributor III

I asked a question recently about VOID in STRUCT failing to cast to VARIANT, whereas a VOID column is castable to VARIANT. Link

Earlier I thought it might be an error since cast was possible somehow. But the community members replied that this is the expected behaviour and not an error.

I will post an example here.

%sql
CREATE OR REPLACE TEMPORARY VIEW v_temp AS
VALUES (NULL, DATE'2025-12-31'), (NULL, DATE'2026-04-12'), (NULL, DATE'2026-06-23') AS T(PAYMENT_DATE, TRANSACTION_DATE);

SELECT PAYMENT_DATE, TYPEOF(PAYMENT_DATE), TRANSACTION_DATE, TYPEOF(TRANSACTION_DATE)
FROM v_temp;

Dhruv22_1-1785672645237.png

Dhruv22_2-1785672677715.png

Dhruv22_3-1785672691891.png

I checked the variant encoding docs in parquet. And VOID is a type in variant. Link

Dhruv22_4-1785672772815.png

What is the design decision that led to VOID being excluded from STRUCT columns for casting to VARIANT?

Kindly note that I want to know the design decision or rationale behind this. I don't need any way arounds this behaviour. I know this is the implementation and am interested in knowing why it was designed so?

 

 

 

0 REPLIES 0