my data's schema looks like this:
root
|-- dt: string (nullable = true)
|-- myarr: array (nullable = true)
| |-- element: map (containsNull = true)
| | |-- key: string
| | |-- value: string (valueContainsNull = true)
entryPage: Unit = ()
"myarr" is a Seq of size 2 constantly.
I'm trying to refer to the elements of this array inside a udf call:
filter(callUDF("size", $"myarr[0]") > 0 && callUDF("size", $"myarr[1]") > 0)
but I'm getting the below exception:
org.apache.spark.sql.AnalysisException: cannot resolve '`myarr[0]`' given input columns: [dt, myarr];;
'Filter (('size('myarr[0]) > 0) && ('size('myarr[1]) > 0))
Any ideas why?
Thanks!