From 7a8b9c2160b666b3e590d50c27f938399a7ab1c9 Mon Sep 17 00:00:00 2001 From: fjy Date: Thu, 10 Apr 2014 15:35:55 -0700 Subject: [PATCH] fix select serde --- .../main/java/io/druid/query/select/EventHolder.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/processing/src/main/java/io/druid/query/select/EventHolder.java b/processing/src/main/java/io/druid/query/select/EventHolder.java index 1ac3661d1f5..aa4f6418289 100644 --- a/processing/src/main/java/io/druid/query/select/EventHolder.java +++ b/processing/src/main/java/io/druid/query/select/EventHolder.java @@ -22,6 +22,7 @@ package io.druid.query.select; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; import com.google.common.collect.Maps; +import com.metamx.common.ISE; import org.joda.time.DateTime; import java.util.Map; @@ -50,7 +51,14 @@ public class EventHolder public DateTime getTimestamp() { - return (DateTime) event.get(timestampKey); + Object retVal = event.get(timestampKey); + if (retVal instanceof String) { + return new DateTime(retVal); + } else if (retVal instanceof DateTime) { + return (DateTime) retVal; + } else { + throw new ISE("Do not understand format [%s]", retVal.getClass()); + } } @JsonProperty