Is there an Encoder for Map type in Java Spark?

Viewed 27
1 Answers

This is not exactly an answer, but if someone came here with the same question but in Scala instead of Java, they can use the ExpressionEncoder:

import org.apache.spark.sql.catalyst.encoders.ExpressionEncoder

// ...

def outputEncoder: Encoder[Map[String, Int]] = ExpressionEncoder()

For the original question in Java, this link about how to write a custom encoder might help.

Related