spark-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Koert Kuipers <>
Subject map transform on array in spark sql
Date Tue, 04 Apr 2017 03:18:17 GMT
i have a DataFrame where one column has type:

  StructField("a", typeA, nullableA),
  StructField("b", typeB, nullableB)

i would like to map over this array to pick the first element in the
struct. so the result should be a ArrayType(typeA, nullableA). i realize i
can do this with a scala udf if i know typeA. but what if i dont know typeA?

basically i would like to do an expression like:
map(col("x"), _(0)))

any suggestions?

View raw message