Jonathan Meyer
11/17/2021, 11:39 AMingestionConfig on REALTIME tables
Is there any way to jsonPathString + further process the result with Groovy in transformConfig ?Jonathan Meyer
11/17/2021, 11:49 AM{"data": {
"someKey": <needs_processing>
}
}
I'd like to process data.someKey with Groovy
It's possible from the query side with :
groovy('{"returnType":"LONG","isSingleValue":true}', 'Long.valueOf((arg0.substring(0, 8) + arg0.substring(18)), 16)', userId)
Basically need to do this ahead of time in the transformConfig of a REALTIME tableJonathan Meyer
11/17/2021, 12:47 PMMayank
Jonathan Meyer
11/17/2021, 3:48 PM"ingestionConfig": {
"transformConfigs": [
{
"columnName": "userOid",
"transformFunction": "jsonPathString(data, '$.userId')"
},
{
"columnName": "userId",
"transformFunction": "Groovy({Long.valueOf((userOid.substring(0, 8) + userOid.substring(18)), 16)}, userOid)"
}
]
}Jonathan Meyer
11/17/2021, 3:49 PMuserId we use column userOid which is itself the output of a transformationJonathan Meyer
11/17/2021, 3:51 PM0.7.1-afa4b252ab1c424ddd6c859bb305b2aa342b66ed
And I haven't tested any other combinations of transformConfigs, so maybe some limitations still apply (e.g. order in which they are listed, maybe ?)Neha Pawar
Jonathan Meyer
11/17/2021, 5:12 PMMark Needham
Jonathan Meyer
11/18/2021, 12:00 PMMark Needham
data as a field in the schema as well? Or is it only a field in the source data?Jonathan Meyer
11/18/2021, 1:04 PM{
"some_field": ...,
"data": {
"userId": ...
}
}Mark Needham
Mark Needham
Jonathan Meyer
11/18/2021, 1:08 PMMark Needham
Mark Needham
Mark Needham
Jonathan Meyer
11/18/2021, 1:10 PMMark Needham
Mark Needham
"ingestionConfig": {
"transformConfigs": [{
"columnName": "userId",
"transformFunction": "Groovy({user_id}, user_id)"
}
}Mark Needham
Jonathan Meyer
11/18/2021, 1:14 PMMark Needham
Mark Needham
Jonathan Meyer
11/18/2021, 7:15 PMMark Needham
Jonathan Meyer
11/21/2021, 10:20 PMJonathan Meyer
11/21/2021, 10:20 PM"ingestionConfig": {
"transformConfigs": [{
"columnName": "userId",
"transformFunction": "user_id"
}]
}Mark Needham
Jonathan Meyer
12/07/2021, 7:39 PMJonathan Meyer
12/14/2021, 12:56 PMtransformConfigs + Groovy expressions in the recent releases ?
We've bumped from 0.7.1 to 0.9.0 with the following configuration on REALTIME table
"ingestionConfig": {
"transformConfigs": [
{
"columnName": "userOid",
"transformFunction": "jsonPathString(data, '$.userId')"
},
{
"columnName": "userId",
"transformFunction": "Groovy({Long.valueOf((userOid.substring(0, 8) + userOid.substring(18)), 16)}, userOid)"
},
]
}
}
This used to work, now raises Caught exception while transforming the record
Caused by: java.lang.NumberFormatException: For input string: "6049f2c188d36401807cf526"
java.lang.RuntimeException: Caught exception while transforming data type for column: userIdJonathan Meyer
12/14/2021, 12:59 PMuserOid is passed straight to userId without transformationJonathan Meyer
12/14/2021, 2:44 PMMark Needham
Jonathan Meyer
12/14/2021, 2:47 PMJonathan Meyer
12/14/2021, 3:24 PMMayank