I am trying to get the column name from one column and pass it as a parameter to udf. for eg. I have a DataFrame:
| name | array_column | column4 | column5 |
|--------|--------------------|---------|---------|
| first | column4,column5 | V1 | V2 |
| test | column4,column5 | V1 | V2 |
| choose | column3,column5 | V1 | V2 |
df.withcolumn("test",udf(array_column(0),arraycolumn(1)))
where array_column(0) and array_column(1) which are column4 and column5 respectively represents 2 column names in the dataframe.
I want to bascially do udf(column4,column5) but i need to get array_column values and pass them as a paramter of my udf
I tried setting it, but for some reason the column is not called properly. It is called as String instead of the elements of the array
col1, col2, col3, col4andmetrics.metricsis of type array of size 2, and has as value[col4, col5].