Find a column by name in a row in scala spark

I have a Seq[Row].Each row is an Array of Struct.Struct has four fields: a,b,c and d all of which are String.The data in a particular row is something like this:

[{a:ahahk,b:ridj,c:qpsj,d:qmdjdh},{a:lyev,b:ehsa,c:pkeg,d:apht}]

I want to check that if there is a field with name 'c' and 'a' when I loop over the Seq of Rows.

What are some possible solutions for such a scenario if I want to create a udf in spark which takes Seq[Row] and finds the presence of the fields'a' and 'c' and then proceed as per the presence of these fields?

Topic dataframe sequence scala apache-spark bigdata

Category Data Science

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.