Skip to content

Commit b879065

Browse files
nandorKollargszadovszky
authored andcommitted
PARQUET-1387: Nanosecond precision time and timestamp - parquet-format (#102)
1 parent 677ed8e commit b879065

2 files changed

Lines changed: 15 additions & 3 deletions

File tree

LogicalTypes.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ The sort order used for `DATE` is signed.
256256

257257
`TIME` is used for a logical time type without a date with millisecond or microsecond precision.
258258
The type has two type parameters: UTC adjustment (`true` or `false`)
259-
and precision (`MILLIS` or `MICROS`).
259+
and precision (`MILLIS` or `MICROS`, `NANOS`).
260260

261261
`TIME` with precision `MILLIS` is used for millisecond precision.
262262
It must annotate an `int32` that stores the number of
@@ -266,6 +266,10 @@ milliseconds after midnight.
266266
It must annotate an `int64` that stores the number of
267267
microseconds after midnight.
268268

269+
`TIME` with precision `NANOS` is used for nanosecond precision.
270+
It must annotate an `int64` that stores the number of
271+
nanoseconds after midnight.
272+
269273
The sort order used for `TIME` is signed.
270274

271275
#### Deprecated time ConvertedType
@@ -305,7 +309,7 @@ with precision `MICROS`. Like the logical type counterpart, it must annotate an
305309

306310
`TIMESTAMP` is used for a combined logical date and time type, with
307311
millisecond or microsecond precision. The type has two type parameters:
308-
UTC adjustment (`true` or `false`) and precision (`MILLIS` or `MICROS`).
312+
UTC adjustment (`true` or `false`) and precision (`MILLIS` or `MICROS`, `NANOS`).
309313

310314
`TIMESTAMP` with precision `MILLIS` is used for millisecond precision.
311315
It must annotate an `int64` that stores the number of
@@ -315,6 +319,12 @@ milliseconds from the Unix epoch, 00:00:00.000 on 1 January 1970, UTC.
315319
It must annotate an `int64` that stores the number of
316320
microseconds from the Unix epoch, 00:00:00.000000 on 1 January 1970, UTC.
317321

322+
`TIMESTAMP` with precision `NANOS` is used for nanosecond precision.
323+
It must annotate an `int64` that stores the number of
324+
nanoseconds from the Unix epoch, 00:00:00.000000000 on 1 January 1970, UTC.
325+
Valid values for nanosecond precision are between
326+
00:12:43 21 September 1677 UTC and 23:47:16 11 April 2262 UTC.
327+
318328
The sort order used for `TIMESTAMP` is signed.
319329

320330
#### Deprecated timestamp ConvertedType

src/main/thrift/parquet.thrift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,9 +257,11 @@ struct DecimalType {
257257
/** Time units for logical types */
258258
struct MilliSeconds {}
259259
struct MicroSeconds {}
260+
struct NanoSeconds {}
260261
union TimeUnit {
261262
1: MilliSeconds MILLIS
262263
2: MicroSeconds MICROS
264+
3: NanoSeconds NANOS
263265
}
264266

265267
/**
@@ -275,7 +277,7 @@ struct TimestampType {
275277
/**
276278
* Time logical type annotation
277279
*
278-
* Allowed for physical types: INT32 (millis), INT64 (micros)
280+
* Allowed for physical types: INT32 (millis), INT64 (micros, nanos)
279281
*/
280282
struct TimeType {
281283
1: required bool isAdjustedToUTC

0 commit comments

Comments
 (0)