Solved

setting parentExternaliD as an empty string, "" and not as NULL

  • 2 May 2024
  • 1 reply
  • 19 views

Badge +1

Busy with training module:

Data Engineer Basics - Transform and Contextualize > CDF Transformations > Assets transformation

I have the following SQL:

 

The Preview works:

 

But, doing Run, leads to an error.

So, of course the NULL in the 1st row above ought to be   “ “ for the root asset.

Q1. How do I test for NULL and set NULL value to “ ” in the Spark SQL query?

Thank you!

Regards,

Doug

 

 

 

icon

Best answer by Sofie Haug 2 May 2024, 10:25

View original

1 reply

Userlevel 3
Badge +6

Hi @Mugless Durry 

you can use a IF statement, like: 

 

IF(parent_loc_id='' OR parent_loc_id IS NULL, '', parent_loc_id) AS parentExternalId,

 

Reply