I have a Scala dataframe which has this schema:
filter_msg.printSchema()
root
|-- value: array (nullable = true)
| |-- element: string (containsNull = true)
and data sample:
|[SD:GK, 3.16.0, OS:Linux, (x86_64), AID:176]|
I want to extract the values from this array string where element starts with say SD and get the value and then If its OS get the value. The problem is the position in the array string is not always same it keeps varying so I cant use
filter_msg.select($"value".getItem(1).as("SD"))
The output should give me a dataframe:
Output=GK | Linux
Output.printSchema()
String,String