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: 

Get Size of a column in Bytes for a Pyspark Data frame

Anbazhagananbut
New Contributor II

Hello All,

I have a column in a dataframe which i struct type.I want to find the size of the column in bytes.it is getting failed while loading in snowflake.

I could see size functions avialable to get the length.how to calculate the size in bytes for a column in pyspark dataframe.

pyspark.sql.functions.size(col)

Collection function: returns the length of the array or map stored in the column.

Please help me on this case.

Thanks

1 REPLY 1

sean_owen
Databricks Employee
Databricks Employee

There isn't one size for a column; it takes some amount of bytes in memory, but a different amount potentially when serialized on disk or stored in Parquet. You can work out the size in memory from its data type; an array of 100 bytes takes 100 bytes; a long takes 8 bytes, etc.

Connect with Databricks Users in Your Area

Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you won’t want to miss the chance to attend and share knowledge.

If there isn’t a group near you, start one and help create a community that brings people together.

Request a New Group