When i am trying to use UDF it is giving me a error code snippet: def encode_bill_sha(s): str1=hashlib.sha256(s.encode()) str_hex=str1.hexdigest() return str_hex udftest=udf(lambda z:encode_bill_sha(z),StringType()) df22=df1.withColumn("encoded1",udftest("Bill_raw_text")) Error: cannot resolve 'encdoded1' given input columns: [Bill_raw_text, age, encoded1, name]; 'Project ['encdoded1] +- Project [Bill_raw_text#51, age#52L, name#53, (Bill_raw_text#51) AS encoded1#141] +- Relation [Bill_raw_text#51,age#52L,name#53] json
Very nice video
When i am trying to use UDF it is giving me a error
code snippet:
def encode_bill_sha(s):
str1=hashlib.sha256(s.encode())
str_hex=str1.hexdigest()
return str_hex
udftest=udf(lambda z:encode_bill_sha(z),StringType())
df22=df1.withColumn("encoded1",udftest("Bill_raw_text"))
Error:
cannot resolve 'encdoded1' given input columns: [Bill_raw_text, age, encoded1, name];
'Project ['encdoded1]
+- Project [Bill_raw_text#51, age#52L, name#53, (Bill_raw_text#51) AS encoded1#141]
+- Relation [Bill_raw_text#51,age#52L,name#53] json