eed3si9n / scalaxb

scalaxb is an XML data binding tool for Scala.
http://scalaxb.org/
MIT License
335 stars 154 forks source link

XMLGregorianCalendar type blocks this lib in spark projects #543

Open atais opened 3 years ago

atais commented 3 years ago

steps

define schema A that has type="dt:date" element compile them.

problem

No Encoder found for javax.xml.datatype.XMLGregorianCalendar

expectation

Spark Encoders are actually a bit of pain in the ***, because there is not a lot of them right now: https://spark.apache.org/docs/2.1.0/api/java/org/apache/spark/sql/Encoders.html

So even the types prosed in https://github.com/eed3si9n/scalaxb/issues/376 will not solve the issue, because there is only an Encoder for java.sql.Date and java.sql.Timestamp

I know it sounds medieval but we basically used String for that fields 😢

So I guess, the most flexible and easy solution would be to have a field: dateTypeClass where user could provide a full path to the desired class. Let it be current Calendar, Date or String.

WDYT?

eed3si9n commented 3 years ago

Could you comment on https://github.com/eed3si9n/scalaxb/issues/376 please?