fix select serde

This commit is contained in:
fjy 2014-04-10 15:35:55 -07:00
parent b273f1b101
commit 7a8b9c2160
1 changed files with 9 additions and 1 deletions

View File

@ -22,6 +22,7 @@ package io.druid.query.select;
import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import com.metamx.common.ISE;
import org.joda.time.DateTime; import org.joda.time.DateTime;
import java.util.Map; import java.util.Map;
@ -50,7 +51,14 @@ public class EventHolder
public DateTime getTimestamp() 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 @JsonProperty