Difference between “ And ‘ in Spark Dataframe API

SIRIGIRI HARI KRISHNA
Towards Dev
Published in
2 min readJan 13, 2023

--

You must tell your compiler that you want to represent a string inside a string using a different symbol for the inner string.

Here is an example.

“ Name = “HARI” “

The above is wrong. Why? Because the inner string “HARI” and the outer string are using the same “ symbol. And the compiler gets confused that where the string starts and where it is ending.

The below is correct. Why? Because the compiler knows the outer string starts with a “ and it ends with a “. Similarly, it knows the inner string starts with a ‘ and it ends with a ‘. So you have a clear demarkation of both the strings.

“ Name = ‘HARI’ “

The below is also correct. Why? Because the compiler knows the outer string starts with a ‘ and it ends with a ‘. Similarly, it knows the inner string starts with a “ and it ends with a “. So you have a clear demarkation of both the strings.

‘ Name = “HARI” ‘

--

--

Data Engineer passionate about Spark, Azure, and the Cloud. Simplifying data complexities on my Medium blog. Let's dive into the world of data together!