You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
var tempDF = df
val listOfFields = List("idNumber","firstName","secondName,","email","phone")
listOfFields.forEach( eachField => {
val lens = Lens("eventData.stringVals." + eachField)(tempDF.schema)
val tempFunc = lens.setDF(col(eachField)) //df contains column with values to replace at root level
tempDF = tempFunc(tempDF)
}
with 3 fileds in the listOfFields code executes in fast. But when I add 5 fields it slows down. I am trying to replace around 25 values in a complex DF which contians 100s of columns at multilelvels.
Please review and suggest a better option.
Thank you,
Che
The text was updated successfully, but these errors were encountered:
I am trying to modify multiple values in a complex DF.
I have copied the relevant parts below.
df.printSchema
root
..|--eventData
........|--stringVals
............|--idNumber
............|--firstName
............|--secondName
............|--email
............|--phone
............|--age
............|--dob
..|--idNumber
..|--firstName
..|--secondName
..|--email
..|--phone
var tempDF = df
val listOfFields = List("idNumber","firstName","secondName,","email","phone")
listOfFields.forEach( eachField => {
val lens = Lens("eventData.stringVals." + eachField)(tempDF.schema)
val tempFunc = lens.setDF(col(eachField)) //df contains column with values to replace at root level
tempDF = tempFunc(tempDF)
}
with 3 fileds in the listOfFields code executes in fast. But when I add 5 fields it slows down. I am trying to replace around 25 values in a complex DF which contians 100s of columns at multilelvels.
Please review and suggest a better option.
Thank you,
Che
The text was updated successfully, but these errors were encountered: