0

So we have a struct with an array in a nested struct in a JSON object, so we have column JSON then there is an array type called address in the nested struct. We are looking to encrypt some of these fields using fernet. At moment I have only got this far:

df = df.withColumn("json", col("json").withField(arrayPath, transform("json." + arrayPath, lambda x : x.withField(field, encrypt("json." + arrayPath + "." + field, lit(encryptKey))))))  

Arraypath is the path to the array struct and the field we want to encrypt is in the field variable. I get the error 'TypeError: encoding without a string argument' as I can't drill down to the string value in the encrypt function call, any suggestions?

Alex Ott
  • 80,552
  • 8
  • 87
  • 132
T.UK
  • 65
  • 2
  • 8

0 Answers0