mirror of https://github.com/apache/druid.git
Add TimestampSpec format for microsecond (#6395)
This commit is contained in:
parent
aef022de98
commit
47a6cca013
|
@ -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
|
||||
|
||||
|
|
|
@ -71,8 +71,9 @@ public class TimestampParser
|
|||
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 @@ public class TimestampParser
|
|||
{
|
||||
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)) {
|
||||
|
|
Loading…
Reference in New Issue