ravikumar Posted September 17, 2022 Share Posted September 17, 2022 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. 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.