On Thu, Aug 23, 2018 at 9:09 PM, kant kodali <[email protected]> wrote:
>                 // Since these types are not quoted and produce a malformed
> JSON string, quote it here.
>                 if (datum instanceof java.sql.Timestamp || datum instanceof
> java.sql.Time || datum instanceof java.sql.Date) {
>                     return
> buffer.append("\"").append(datum).append("\"").toString();
>                 }
>                 return super.toString(datum);

I suspect datum is always a Long type, but you could check by adding
logging to do something
like Class c = datum.getClass(); System.out.println("Saw
class:"+c.getName()); before the if (might
get lucky and have more info about the LogicalType.)  If it does work
the way you are looking, I bet
the class is more likely org.joda.time.DateTime than one of the
java.sql.*s you are looking for:

https://avro.apache.org/docs/1.8.2/api/java/org/apache/avro/data/TimeConversions.TimestampConversion.html

Note, if you do find out that datum has some nice way to tell it's the
logical type, you likely want
to .append(super.toString(datum)) between the quotes instead of doing
.append(datum) to the first
double quote string.

Reply via email to