INT96 timestamp
| Also known as | INT96; Impala timestamp |
|---|---|
| Field | Data storage formats |
| Introduced | Physical type in Apache Parquet; written for timestamps by Impala, Hive and Spark |
| Key parts | 12 bytes: nanoseconds within the day (8 bytes) and a Julian day number (4 bytes) |
| Open source implementations | Apache Parquet, Apache Spark, Apache Iceberg (read only) |
| Related | Logical type, Apache Parquet, Apache Hive |
INT64 column with the Parquet TIMESTAMP logical type instead. Apache Spark 4.3.0 still writes timestamps as INT96 by default.[1]An INT96 timestamp is a timestamp stored in the 12-byte INT96 physical type of Apache Parquet: 8 bytes of nanoseconds within the day followed by 4 bytes of day number.[2] The encoding was introduced for nanosecond timestamps in Impala, and Apache Spark originally used the same timestamp type as Impala and Hive.[3] INT96 carries no logical type annotation, so a reader has to know the convention to treat it as a timestamp. The Parquet format has marked INT96 as deprecated since parquet-format 2.5.0, but the type is still common because Spark writes it by default.[1][4]
Status
Parquet format. PARQUET-323, "INT96 should be marked as deprecated", was fixed in parquet-format 2.5.0, together with PARQUET-1065, which deprecated type-defined sort ordering for INT96 statistics.[1][5] In parquet.thrift, the INT96 entry has no comment at 2.4.0, is commented "deprecated, only used by legacy implementations" from 2.5.0, and since 2.12.0 reads "deprecated, new Parquet writers should not write data in INT96".[6][7][8] The type has not been removed: parquet-format 2.14.0 added an INT96_TIMESTAMP_ORDER column order, which tells readers that INT96 statistics are ordered chronologically, and the thrift file notes that INT96 is still used in many legacy systems.[2]
Apache Spark. Spark has not deprecated writing INT96. In Spark 4.3.0, spark.sql.parquet.outputTimestampType still defaults to INT96, as it has since the setting was added in Spark 2.3.0.[4] A comment in Spark's Parquet schema converter says that TIMESTAMP_MICROS is recommended but INT96 stays the default to keep earlier behaviour.[3]
How it works
An INT96 value is 12 bytes. The thrift definition describes the legacy ordering rule: the last 4 bytes are the day as a little-endian 32-bit signed integer, and the first 8 bytes are nanoseconds as a little-endian 64-bit signed integer.[2] Spark interprets the day as a Julian day number and converts the value to microseconds since the Unix epoch, dividing the nanoseconds by 1,000, so sub-microsecond precision is lost on read.[9]
Because the type has no logical type, nothing in the file says whether a value is UTC-normalized or local time. Spark's spark.sql.parquet.int96TimestampConversion (default false) applies a time zone adjustment for INT96 data written by Impala, which the setting's documentation says uses a different offset than Hive and Spark.[4] Spark reads INT96 as a timestamp only while spark.sql.parquet.int96AsTimestamp is true, the default; otherwise it rejects the column.[4][3]
Calendar rebasing in Spark
Spark 3.0 moved from the hybrid Julian and Gregorian calendar to the Proleptic Gregorian calendar, which changes the meaning of very old dates and timestamps.[10] Spark 3.1 added spark.sql.legacy.parquet.int96RebaseModeInRead and InWrite, defaulting to EXCEPTION, so that reading or writing INT96 timestamps before 1900-01-01 failed instead of silently shifting.[11][12]
Spark 4.0.0 changed the defaults of these rebase settings to CORRECTED, which reads and writes values as they are (SPARK-46440), and removed the spark.sql.legacy names in favour of spark.sql.parquet.int96RebaseModeInRead and spark.sql.parquet.int96RebaseModeInWrite (SPARK-46447).[13][14][12] Both settings are internal in Spark 4.3.0 and default to CORRECTED.[4]
INT96 compared with standard Parquet timestamps
| INT96 timestamp | INT64 with TIMESTAMP logical type | |
|---|---|---|
| Status in Parquet | Deprecated since parquet-format 2.5.0[1] | Current |
| Size | 12 bytes | 8 bytes |
| Precision | Nanoseconds in storage; Spark keeps microseconds[9] | Unit stated in the annotation: MILLIS, MICROS or NANOS[15]
|
| UTC or local time | Not recorded in the file | Recorded by isAdjustedToUTC[15]
|
| Spark write setting | spark.sql.parquet.outputTimestampType=INT96 (default)[4]
|
TIMESTAMP_MICROS or TIMESTAMP_MILLIS[4]
|
| Apache Iceberg | Not used in the spec's Parquet type mapping; readable in imported data files[16][17] | The spec's mapping for timestamp and timestamptz[16]
|
Example
In Spark, setting the output type before writing produces standard INT64 timestamps instead of INT96:[4]
spark.conf.set("spark.sql.parquet.outputTimestampType", "TIMESTAMP_MICROS")
df = spark.sql("SELECT TIMESTAMP '2026-11-22 10:00:00' AS ts")
df.write.mode("overwrite").parquet("/tmp/ts_micros")
The setting changes only new files. Files already written with INT96 keep that encoding until they are rewritten.
See also
References
- ↑ 1.0 1.1 1.2 1.3 PARQUET-323: INT96 should be marked as deprecated. Apache Software Foundation JIRA.Retrieved 2026-11-22.
- ↑ 2.0 2.1 2.2 parquet.thrift (parquet-format 2.14.0). Apache Software Foundation.Retrieved 2026-11-22.
- ↑ 3.0 3.1 3.2 ParquetSchemaConverter.scala (Apache Spark v4.3.0). Apache Software Foundation.Retrieved 2026-11-22.
- ↑ 4.0 4.1 4.2 4.3 4.4 4.5 4.6 4.7 SQLConf.scala (Apache Spark v4.3.0). Apache Software Foundation.Retrieved 2026-11-22.
- ↑ CHANGES.md (parquet-format 2.5.0). Apache Software Foundation.Retrieved 2026-11-22.
- ↑ parquet.thrift (parquet-format 2.4.0). Apache Software Foundation.Retrieved 2026-11-22.
- ↑ parquet.thrift (parquet-format 2.5.0). Apache Software Foundation.Retrieved 2026-11-22.
- ↑ parquet.thrift (parquet-format 2.12.0). Apache Software Foundation.Retrieved 2026-11-22.
- ↑ 9.0 9.1 DateTimeUtils.scala (Apache Spark v4.3.0). Apache Software Foundation.Retrieved 2026-11-22.
- ↑ Spark SQL Migration Guide (docs/sql-migration-guide.md at v3.0.0). Apache Software Foundation.Retrieved 2026-11-22.
- ↑ SQLConf.scala (Apache Spark v3.1.1). Apache Software Foundation.Retrieved 2026-11-22.
- ↑ 12.0 12.1 Spark SQL Migration Guide (docs/sql-migration-guide.md at v4.0.0). Apache Software Foundation.Retrieved 2026-11-22.
- ↑ SPARK-46440: Set the rebase configs to the CORRECTED mode by default. Apache Software Foundation JIRA.Retrieved 2026-11-22.
- ↑ SPARK-46447: Remove the legacy datetime rebasing SQL configs. Apache Software Foundation JIRA.Retrieved 2026-11-22.
- ↑ 15.0 15.1 Parquet Logical Type Definitions (LogicalTypes.md, parquet-format 2.14.0). Apache Software Foundation.Retrieved 2026-11-22.
- ↑ 16.0 16.1 Iceberg Table Spec (format/spec.md at apache-iceberg-1.12.0). Apache Software Foundation.Retrieved 2026-11-22.
- ↑ Arrow: Support vectorized read of INT96 timestamp in imported data (#6962). GitHub, apache/iceberg.Retrieved 2026-11-22.