Converting SQL ISNULL and DATEADD to Google Cloud Data Fusion Wrangler

85 Views Asked by At

I'm working on a data transformation project in Google Cloud Data Fusion, and I'm looking for assistance in converting the following SQL expression into a Cloud Data Fusion Wrangler transformation:

"ISNULL(CASE WHEN isnull(a s) IS NOT NULL THEN DATEADD(minute, 20, isnull(a, s)) END, '') AS time"

I need to achieve the same result using Cloud Data Fusion Wrangler, and I'm not sure which functions and steps are needed to replicate this SQL logic. The expression involves handling null values and adding minutes to a date.

Any guidance, Wrangler transformations, or step-by-step instructions would be greatly appreciated. Thank you for your help!

I attempted to convert the SQL expression to Cloud Data Fusion Wrangler by using functions available in Wrangler. Specifically, I tried using the "set-column "

1

There are 1 best solutions below

0
On

CDAP and Cloud Data Fusion wrangler are using JEXL3.0 as an expression language. So instead of ISNULL you can use ternary operator, e.g. ISNULL(a,b) becomes a != null ? a : b.

For the date manipulation I would recommend to check the manual here: https://cdap.atlassian.net/wiki/spaces/DOCS/pages/1099759621/Performing+simple+date+transformations+in+Wrangler.

E.g. adding 20 minutes would look like value.plusMinutes(20).