ahmed
06/26/2022, 11:54 PM"ingestionConfig": {
"transformConfigs": [{
"columnName": "fcm_token",
"transformFunction": "Groovy({import javax.crypto.Cipher;import javax.crypto.spec.SecretKeySpec;Cipher cipher = Cipher.getInstance('AES/ECB/PKCS5Padding');cipher.init(Cipher.ENCRYPT_MODE, new SecretKeySpec('1234567812345678'.getBytes('UTF-8'), 'AES'));cipher.doFinal(fcm_token_raw.getBytes('UTF-8')).encodeBase64())).encodeBase64()},fcm_token_raw)"
}]
ahmed
06/27/2022, 12:50 AMMayank
Mayank
Neha Pawar
"transformConfigs": [
{
"columnName": "labels_json_str",
"transformFunction": "Groovy({def labelsMap = [:]; for (int i = 0; i < labels.size(); i++) { labelsMap[labels[i].element.key] = labels[i].element.value; }; return groovy.json.JsonOutput.toJson(labelsMap)}, labels)"
}
]
there might be some other syntax error in the script.Neha Pawar
ahmed
06/27/2022, 5:33 PM"ingestionConfig": {
"transformConfigs": [{
"columnName": "fcm_token",
"transformFunction": "encrypt(cm_token_raw)"
}]
},
ERROR : 2022/06/27 164816.179 INFO [AddTableCommand] [main] {"_code":400,"_error":"Invalid transform function 'encrypt(fcm_token_raw)' for column 'fcm_token'"}
but when I tried @Neha Pawar approach it finally worked 🥳🥳
Thank you both for your help 😍Neha Pawar
ahmed
06/27/2022, 5:49 PM"transformFunction": "Groovy({import javax.crypto.Cipher;import java.security.Key;import javax.crypto.spec.SecretKeySpec;Key aesKey = new SecretKeySpec('1234567812345678'.getBytes('UTF-8'), 'AES');Cipher cipher = Cipher.getInstance('AES/ECB/PKCS5Padding');cipher.init(Cipher.ENCRYPT_MODE, aesKey);return cipher.doFinal(fcm_token_raw.getBytes('UTF-8')).encodeBase64()},fcm_token_raw)"
Neha Pawar
Ehsan Irshad
02/07/2023, 6:40 AMEhsan Irshad
02/07/2023, 8:07 AMEhsan Irshad
02/08/2023, 2:21 AM