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: 

sharikrishna26.medium.com

SIRIGIRI
Contributor

Spark Dataframes Schema

Schema inference is not reliable.

We have the following problems in schema inference:

  1. Automatic inferring of schema is often incorrect
  2. Inferring schema is additional work for Spark, and it takes some extra time
  3. Schema inference is conflicting with the schema validation

4. It might also change the column order

We have two approaches to do it.

  1. Schema DDL String
  2. Struct Type Object

Further Detailed description please refer this link

https://sharikrishna26.medium.com/spark-dataframes-schema-6fe1f90a56c

Please like,share,comment

Happy New year 2023

3 REPLIES 3

Rishabh-Pandey
Esteemed Contributor

Thanks for sharing

Rishabh Pandey

Aviral-Bhardwaj
Esteemed Contributor III

good post thanks

AviralBhardwaj

Varshith
New Contributor III

one other difference between those 2 approaches is that In Schema DDL String approach we use STRING, INT etc.. But In Struct Type Object approach we can only use Spark datatypes such as StringType(), IntegerType(), 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