You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by GitBox <gi...@apache.org> on 2018/09/27 16:38:46 UTC
[GitHub] fjy closed pull request #6395: Add TimestampSpec format for
microsecond
fjy closed pull request #6395: Add TimestampSpec format for microsecond
URL: https://github.com/apache/incubator-druid/pull/6395
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
diff --git a/docs/content/ingestion/ingestion-spec.md b/docs/content/ingestion/ingestion-spec.md
index 7978f6ff561..590ea30cd99 100644
--- a/docs/content/ingestion/ingestion-spec.md
+++ b/docs/content/ingestion/ingestion-spec.md
@@ -187,7 +187,7 @@ handle all formatting decisions on their own, without using the ParseSpec.
| Field | Type | Description | Required |
|-------|------|-------------|----------|
| column | String | The column of the timestamp. | yes |
-| format | String | iso, millis, posix, auto or any [Joda time](http://joda-time.sourceforge.net/apidocs/org/joda/time/format/DateTimeFormat.html) format. | no (default == 'auto' |
+| format | String | iso, posix, millis, micro, nano, auto or any [Joda time](http://joda-time.sourceforge.net/apidocs/org/joda/time/format/DateTimeFormat.html) format. | no (default == 'auto' |
### DimensionsSpec
diff --git a/java-util/src/main/java/org/apache/druid/java/util/common/parsers/TimestampParser.java b/java-util/src/main/java/org/apache/druid/java/util/common/parsers/TimestampParser.java
index 38f12060942..ecd06f822f9 100644
--- a/java-util/src/main/java/org/apache/druid/java/util/common/parsers/TimestampParser.java
+++ b/java-util/src/main/java/org/apache/druid/java/util/common/parsers/TimestampParser.java
@@ -71,8 +71,9 @@
return DateTimes.of(ParserUtils.stripQuotes(input));
};
} else if ("posix".equalsIgnoreCase(format)
- || "millis".equalsIgnoreCase(format)
- || "nano".equalsIgnoreCase(format)) {
+ || "millis".equalsIgnoreCase(format)
+ || "micro".equalsIgnoreCase(format)
+ || "nano".equalsIgnoreCase(format)) {
final Function<Number, DateTime> numericFun = createNumericTimestampParser(format);
return input -> {
Preconditions.checkArgument(!Strings.isNullOrEmpty(input), "null timestamp");
@@ -104,6 +105,8 @@
{
if ("posix".equalsIgnoreCase(format)) {
return input -> DateTimes.utc(TimeUnit.SECONDS.toMillis(input.longValue()));
+ } else if ("micro".equalsIgnoreCase(format)) {
+ return input -> DateTimes.utc(TimeUnit.MICROSECONDS.toMillis(input.longValue()));
} else if ("nano".equalsIgnoreCase(format)) {
return input -> DateTimes.utc(TimeUnit.NANOSECONDS.toMillis(input.longValue()));
} else if ("ruby".equalsIgnoreCase(format)) {
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org