Jump to content

converting Informatica transformations to Pyspark


ravikumar

Recommended Posts

I am trying to convert informatica transformation to pyspark transformation, but I am stuck in replacing char in the code shown below:

"DECODE(TRUE,
ISNULL(v_check_neg_**) OR v_check_neg_** = '', 
i_default,
NOT IS_NUMBER(v_check_neg_** , 
i_default,
REPLACECHR(0,v_check_neg_**, '+-0123456789.' ,'')<>'', 
i_default,
TO_DECIMAL(v_check_neg_**,5))


v_check_neg_** = IIF(INSTR(i_string_**,'-')!=0,'-'||SUBSTR(i_string_**,1,INSTR(i_string_**,'-')-1),i_string_**)"

This is what I tried:

def is_digit(value):
    if value:
        return value.isdigit()
    else:
        return False

is_digit_udf = udf(is_digit, BooleanType())

df_informatica=df_informatica.withColumn(column_name,when((isnull(col(column_name)) |(col(column_name==' ')),i_default).when(is_digit_udf(col(column_name)),i_default)

df_informatica=df_informatica.withColumn

Please help me convert informatica to pyspark transformation.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated