Data engineer comparing original event timestamps with Parquet readback values to identify nanosecond precision loss.

Keep Nanosecond Events Distinct When Writing Parquet

Wed, Dec 2, 2026

Six event records can survive a Parquet write with the same IDs, the same row count and the same timestamp column name while still failing the only retention question that matters here: does each event ID still denote the exact instant supplied to the writer? Row membership and value fidelity are separate contracts. This article holds membership constant and tests value preservation at the serialization boundary.

The declared laboratory is intentionally narrow: Python 3.12, pyarrow==20.0.0, a direct Arrow table, six synthetic IDs, UTC timestamps, an INT64 carrier, and independent in-memory Parquet buffers. PyArrow 20.0.0 documents Python 3.12 support, and its normal package includes the Parquet interfaces used here; the installation guide also warns that a minimal conda-core variant has reduced functionality. The package pin is historical and reproducibility-oriented, not a latest-version claim.

Research for this manuscript was completed on December 2, 2026, in Africa/Nairobi. The laboratory cases P01–P10 below are designed but NOT EXECUTED. Therefore every numeric case result is an authored expectation derived from integer arithmetic and documented behavior, not an observation. No Python patch, Arrow C++ runtime, exception text, artifact hash or byte length is invented. The runnable fixture records those fields when a future operator executes it.

The release decision is explicit: accept only an artifact whose source-keyed instants reconcile exactly, reject unintended precision loss, hold when provenance or source is missing, rebuild from the retained source when necessary, and qualify consumers before selecting a nanosecond-native artifact.

Define what exact event-time retention means

Exact retention is equality of represented instants by event_id, not equality of displayed timestamp text and not equality of storage units. If source event A is the integer nanosecond count 1700000000000000100, a readback value in nanoseconds must normalize to that same integer. A readback value in microseconds is acceptable only if multiplying its integer carrier by 1,000 produces the same source nanoseconds exactly. Arrow timestamp types carry a unit (seconds, milliseconds, microseconds or nanoseconds) and may carry a timezone; an integer without its unit is incomplete evidence.

Nulls are part of the contract. Event F is null before construction and must remain null after readback. The other five event IDs must remain present exactly once. Event time is not the row key, so duplicate timestamps are permitted when they already exist in the source. The aligned control intentionally contains A/B and C/D duplicate times. A duplicate is corruption only when two unequal source instants become equal after serialization; this article calls that a new collision.

Acceptance therefore requires all of the following: the expected six IDs with no extras or duplicates; the expected null position; a supported readback timestamp unit; source provenance matching the candidate; and exact equality of every normalized non-null value to the source integer. A valid Parquet schema or six-row count cannot substitute for those checks. read_table can read selected columns, so even row count with no timestamp value inspection cannot establish timestamp retention.

This boundary differs from PyArrow schema projection and source-column retention, where the primary risk is membership of fields. Here both columns stay present; writer serialization may change particular timestamp values.

Trace the writer's precision controls

PyArrow 20.0.0 separates three controls that are easy to conflate. version selects the Parquet logical-format feature set available to the writer; coerce_timestamps requests a target timestamp resolution; and allow_truncated_timestamps controls whether loss caused by an explicit coercion may proceed. The write_table signature defaults version='2.6'; its documentation says nanosecond timestamps are available in 2.6, while version 1.0 and 2.4 default nanoseconds to microseconds when coerce_timestamps is omitted. It also says lossy coercion raises unless truncation is allowed, and that allowing truncation does not itself request a coercion.

That version parameter is not the installed PyArrow package version. It is also not data_page_version: the same reference documents a separate page-format setting whose default is 1.0 and explicitly says it does not determine file-schema logical types or Arrow-to-Parquet timestamp casting. The fixture therefore records package/runtime identity separately from the Parquet version option and leaves page version at its explicit default only because the experiment is not about page encoding.

For every write, this article pins use_deprecated_int96_timestamps=False, flavor=None, store_schema=False, compression="NONE", use_dictionary=False, and write_statistics=False. INT96 precedence and Arrow-schema restoration are therefore deliberately removed from the test. PyArrow documents that INT96 can take priority over timestamp coercion and that store_schema=True can preserve Arrow-specific schema information such as timezone metadata; neither mechanism is needed to answer the bounded value-retention question.

Serialization success is only a stage. A completed writer yields candidate bytes; those bytes must then be read without a forced schema, normalized by the actual readback unit, reconciled by ID against the pre-Arrow source oracle, and assigned an operational disposition.

Build the independent six-event fixture

The source populations are Python integers before Arrow exists. BASE is 1700000000000000000. Population U adds nanosecond offsets [100, 900, 1000, 1900, 2000, null] to IDs A–F. Population A adds [0, 0, 1000, 1000, 2000, null]. The expected lossy microsecond normalization for U is therefore offsets [0, 0, 1000, 1000, 2000, null]: positive integer division by 1,000 removes the submicrosecond residuals.

That arithmetic predicts per-ID deltas [-100, -900, 0, -900, 0, null]. Five non-null source instants in U become three distinct non-null instants after lossy microsecond coercion. Three values change: A, B and D. Two newly collapsed source pairs appear: A/B and C/D. These are fixture mathematics, not measured PyArrow output.

Use an isolated Python 3.12 environment and install the full PyPI package pin rather than a reduced core package. The exact patch and Arrow C++ runtime are execution evidence, so this unexecuted manuscript does not fill them in. The script below prints them when actually run. PyArrow 20.0.0 documents support for Python 3.12.

python3.12 -m venv .venv-parquet-ns
. .venv-parquet-ns/bin/activate
python -m pip install --upgrade pip
python -m pip install --only-binary=:all: "pyarrow==20.0.0"
python parquet_ns_fixture.py

Keep the oracle outside Arrow

The manifest is canonical JSON built from decimal strings for nanosecond values, avoiding accidental loss in JSON consumers that cannot represent every 64-bit integer exactly. The source hash is computed before Arrow construction. Only then does the fixture construct timestamp[ns, tz=UTC] and cast that array back to int64 to prove that the Arrow input agrees with the independent manifest. PyArrow's timestamp factory defines the supported units and timezone parameter, while compute.cast documents safe conversion checks; the source comparison remains the authority for whether information was preserved.

This is the same evidence discipline as independent ingestion-completeness reconciliation: expected population evidence must not be derived from the candidate under test. The parser workflow from that article is not imported here.

# parquet_ns_fixture.py
import hashlib
import itertools
import json
import platform
import sys

import pyarrow as pa
import pyarrow.compute as pc
import pyarrow.parquet as pq

BASE = 1_700_000_000_000_000_000
IDS = ["A", "B", "C", "D", "E", "F"]
U_OFFSETS = [100, 900, 1000, 1900, 2000, None]
A_OFFSETS = [0, 0, 1000, 1000, 2000, None]
UNIT_TO_NS = {"ns": 1, "us": 1_000, "ms": 1_000_000, "s": 1_000_000_000}
FIXTURE_ID = "parquet-ns-six-events-v1"


def source_values(offsets):
    return [None if x is None else BASE + x for x in offsets]


U_NS = source_values(U_OFFSETS)
A_NS = source_values(A_OFFSETS)

SOURCE_MANIFEST = {
    "fixture_id": FIXTURE_ID,
    "base_ns": str(BASE),
    "populations": {
        "U": [
            {"event_id": i, "event_time_ns": None if v is None else str(v)}
            for i, v in zip(IDS, U_NS)
        ],
        "A": [
            {"event_id": i, "event_time_ns": None if v is None else str(v)}
            for i, v in zip(IDS, A_NS)
        ],
    },
}
SOURCE_JSON = json.dumps(
    SOURCE_MANIFEST,
    sort_keys=True,
    separators=(",", ":"),
    ensure_ascii=False,
).encode("utf-8")
SOURCE_SHA256 = hashlib.sha256(SOURCE_JSON).hexdigest()


def runtime_record():
    return {
        "python": sys.version,
        "python_implementation": platform.python_implementation(),
        "pyarrow_python": pa.__version__,
        "arrow_cpp": pa.cpp_version,
        "platform": platform.platform(),
    }


def make_table(values_ns):
    ts = pa.array(values_ns, type=pa.timestamp("ns", tz="UTC"))
    recovered = pc.cast(ts, pa.int64(), safe=True).to_pylist()
    assert recovered == values_ns, (recovered, values_ns)
    return pa.table(
        {
            "event_id": pa.array(IDS, type=pa.string()),
            "event_time": ts,
        }
    )


def canonical_options(version, coerce_timestamps, allow_truncated_timestamps):
    return {
        "version": version,
        "coerce_timestamps": coerce_timestamps,
        "allow_truncated_timestamps": allow_truncated_timestamps,
        "use_deprecated_int96_timestamps": False,
        "flavor": None,
        "store_schema": False,
        "compression": "NONE",
        "use_dictionary": False,
        "write_statistics": False,
    }


def normalize_to_ns(raw_values, unit):
    if unit not in UNIT_TO_NS:
        raise ValueError(f"unsupported timestamp unit: {unit!r}")

    factor = UNIT_TO_NS[unit]
    out = []

    for value in raw_values:
        if value is None:
            out.append(None)
            continue

        ns = value factor
        if ns < -(1 << 63) or ns > (1 << 63) - 1:
            raise OverflowError(
                f"normalized nanoseconds out of int64 range: {ns}"
            )
        out.append(ns)

    return out


def source_map(values_ns):
    return dict(zip(IDS, values_ns))


def collision_pairs(original_by_id, normalized_by_id):
    pairs = []

    for left, right in itertools.combinations(IDS, 2):
        original_left = original_by_id[left]
        original_right = original_by_id[right]
        output_left = normalized_by_id[left]
        output_right = normalized_by_id[right]

        if (
            original_left is None
            or original_right is None
            or output_left is None
            or output_right is None
        ):
            continue

        if original_left != original_right and output_left == output_right:
            pairs.append([left, right])

    return pairs


def inspect_success(case_id, data, original_ns, options):
    artifact_sha = hashlib.sha256(data).hexdigest()

    reader = pa.BufferReader(data)
    table = pq.read_table(reader)  # all columns, no filters, no forced schema

    ids = table["event_id"].to_pylist()
    if len(ids) != len(IDS) or ids != IDS or len(set(ids)) != len(ids):
        raise AssertionError(f"unexpected IDs: {ids!r}")

    ts_type = table.schema.field("event_time").type
    if not pa.types.is_timestamp(ts_type):
        raise TypeError(f"event_time is not timestamp: {ts_type}")

    unit = ts_type.unit
    raw_ints = pc.cast(
        table["event_time"], pa.int64(), safe=True
    ).to_pylist()
    normalized = normalize_to_ns(raw_ints, unit)

    expected = source_map(original_ns)
    actual = dict(zip(ids, normalized))

    null_positions = [
        event_id
        for event_id, value in zip(ids, normalized)
        if value is None
    ]
    expected_nulls = [
        event_id
        for event_id, value in zip(IDS, original_ns)
        if value is None
    ]

    if null_positions != expected_nulls:
        raise AssertionError((null_positions, expected_nulls))

    deltas = {
        event_id: (
            None
            if expected[event_id] is None
            else actual[event_id] - expected[event_id]
        )
        for event_id in IDS
    }

    pf = pq.ParquetFile(pa.BufferReader(data))

    event_col = next(
        pf.schema.column(index)
        for index in range(len(pf.schema))
        if pf.schema.column(index).path == "event_time"
    )

    metadata = {
        "parquet_schema_text": str(pf.schema),
        "schema_arrow_text": str(pf.schema_arrow),
        "event_time": {
            "name": event_col.name,
            "path": event_col.path,
            "physical_type": event_col.physical_type,
            "logical_type_runtime_text": str(event_col.logical_type),
            "converted_type": event_col.converted_type,
        },
    }

    return {
        "case": case_id,
        "status": "WRITE_AND_READ_COMPLETED",
        "source_sha256": SOURCE_SHA256,
        "options": options,
        "artifact_sha256": artifact_sha,
        "artifact_length": len(data),
        "readback_unit": unit,
        "readback_raw_int64": dict(zip(ids, raw_ints)),
        "normalized_ns": actual,
        "delta_ns": deltas,
        "new_collisions": collision_pairs(expected, actual),
        "metadata": metadata,
        "exact": actual == expected,
    }


def write_candidate(case_id, table, original_ns, options):
    sink = pa.BufferOutputStream()  # fresh per candidate

    try:
        pq.write_table(table, sink, *options)
    except Exception as exc:
        # Preserve failure evidence. Do not inspect or accept partial bytes.
        return {
            "case": case_id,
            "status": "WRITE_REJECTED",
            "source_sha256": SOURCE_SHA256,
            "options": options,
            "failure_phase": "pq.write_table",
            "exception_class": type(exc).__name__,
            "exception_message": str(exc),
            "artifact_accepted": False,
        }, None

    data = sink.getvalue().to_pybytes()
    evidence = inspect_success(
        case_id,
        data,
        original_ns,
        options,
    )
    return evidence, data


def expected_lossy_u():
    return [
        None if value is None else (value // 1_000) * 1_000
        for value in U_NS
    ]


def assert_expected_math():
    lossy = expected_lossy_u()

    offsets = [
        None if value is None else value - BASE
        for value in lossy
    ]
    assert offsets == [0, 0, 1000, 1000, 2000, None]

    deltas = [
        None if source is None else output - source
        for source, output in zip(U_NS, lossy)
    ]
    assert deltas == [-100, -900, 0, -900, 0, None]

    assert len({v for v in U_NS if v is not None}) == 5
    assert len({v for v in lossy if v is not None}) == 3

    assert collision_pairs(
        source_map(U_NS),
        source_map(lossy),
    ) == [["A", "B"], ["C", "D"]]


def preflight_microsecond_alignment(values_ns):
    return all(
        value is None or value % 1_000 == 0
        for value in values_ns
    )


def main():
    # Execution must record this exact runtime.
    # This manuscript does not pre-fill it.
    print(json.dumps(runtime_record(), indent=2, sort_keys=True))

    assert sys.version_info[:2] == (3, 12), sys.version
    assert pa.__version__ == "20.0.0", pa.__version__

    assert_expected_math()

    u = make_table(U_NS)
    aligned = make_table(A_NS)

    ledger = []
    artifacts = {}

    matrix = {
        "P01": (
            u,
            U_NS,
            canonical_options("2.6", None, False),
        ),
        "P02": (
            u,
            U_NS,
            canonical_options("2.6", "us", False),
        ),
        "P03": (
            u,
            U_NS,
            canonical_options("2.6", "us", True),
        ),
        "P04": (
            u,
            U_NS,
            canonical_options("1.0", None, False),
        ),
        "P05": (
            u,
            U_NS,
            canonical_options("1.0", "us", True),
        ),
        "P06": (
            aligned,
            A_NS,
            canonical_options("1.0", None, False),
        ),
        "P07": (
            u,
            U_NS,
            canonical_options("2.6", None, True),
        ),
    }

    for case_id in [
        "P01",
        "P02",
        "P03",
        "P04",
        "P05",
        "P06",
        "P07",
    ]:
        table, original, options = matrix[case_id]

        evidence, data = write_candidate(
            case_id,
            table,
            original,
            options,
        )
        ledger.append(evidence)

        if data is not None:
            artifacts[case_id] = data

    # P08: upcast P03 readback. Requires P03 successful bytes.
    if "P03" not in artifacts:
        ledger.append(
            {
                "case": "P08",
                "status": "BLOCKED",
                "reason": "P03 artifact unavailable",
            }
        )
    else:
        p03_table = pq.read_table(
            pa.BufferReader(artifacts["P03"])
        )

        upcast = pc.cast(
            p03_table["event_time"],
            pa.timestamp("ns", tz="UTC"),
            safe=True,
        )
        upcast_ns = pc.cast(
            upcast,
            pa.int64(),
            safe=True,
        ).to_pylist()

        actual = dict(
            zip(
                p03_table["event_id"].to_pylist(),
                upcast_ns,
            )
        )
        expected = source_map(U_NS)

        ledger.append(
            {
                "case": "P08",
                "status": "CAST_COMPLETED",
                "source_sha256": SOURCE_SHA256,
                "parent_artifact_sha256": hashlib.sha256(
                    artifacts["P03"]
                ).hexdigest(),
                "target_type": "timestamp[ns, tz=UTC]",
                "normalized_ns": actual,
                "delta_ns": {
                    event_id: (
                        None
                        if expected[event_id] is None
                        else actual[event_id] - expected[event_id]
                    )
                    for event_id in IDS
                },
                "exact": actual == expected,
            }
        )

    # P09: application preflight. Writer invocation count must remain zero.
    writer_invocations = 0
    aligned_for_us = preflight_microsecond_alignment(U_NS)

    if aligned_for_us:
        writer_invocations += 1

    ledger.append(
        {
            "case": "P09",
            "status": (
                "PREFLIGHT_REJECTED"
                if not aligned_for_us
                else "UNEXPECTED_PREFLIGHT_ACCEPT"
            ),
            "source_sha256": SOURCE_SHA256,
            "policy": "all non-null original_ns % 1000 == 0",
            "writer_invocation_count": writer_invocations,
        }
    )

    # P10: rebuild from retained original U under a new candidate identity.
    p10_options = canonical_options("2.6", None, False)

    p10_evidence, p10_data = write_candidate(
        "P10",
        make_table(U_NS),
        U_NS,
        p10_options,
    )
    p10_evidence[
        "candidate_identity"
    ] = "P10-rebuild-from-retained-U"

    if "P03" in artifacts:
        p10_evidence[
            "replaces_lossy_artifact_sha256"
        ] = hashlib.sha256(artifacts["P03"]).hexdigest()

    ledger.append(p10_evidence)

    # Expected-case assertions belong to the test harness,
    # not to article observations.
    by_case = {
        row["case"]: row
        for row in ledger
    }

    assert set(by_case) == {
        f"P{i:02d}"
        for i in range(1, 11)
    }
    assert by_case["P09"]["writer_invocation_count"] == 0

    print(
        json.dumps(
            {
                "fixture_id": FIXTURE_ID,
                "source_sha256": SOURCE_SHA256,
                "ledger": ledger,
            },
            indent=2,
            sort_keys=True,
            default=str,
        )
    )


if name == "__main__":
    main()

Establish the native-nanosecond baseline

P01 is the positive control: U, version='2.6', coerce_timestamps=None, allow_truncated_timestamps=False, plus the fixed options shared by all writes. The PyArrow 20.0.0 writer reference says version 2.6 supports nanosecond timestamps natively and that omitted coercion for 2.6 writes them without loss of resolution. The expected P01 result is therefore exact retention of all five non-null source integers and F as null.

A future execution must treat P01 as a gate, not as decorative control output. If P01 fails because the runtime is wrong, the package lacks Parquet support, the constructed Arrow integers do not match the manifest, IDs drift, readback uses an unsupported unit, or normalized values differ, the later loss experiments cannot be interpreted cleanly. Preserve that failure and stop release qualification; do not rewrite expected values to match whatever appeared.

Each candidate gets a new BufferOutputStream. Only if pq.write_table returns successfully does the script call getvalue(), hash the completed bytes, and create a new BufferReader for readback. A rejected write does not produce an accepted artifact. The fixture deliberately does not assert that a failed buffer is empty or that a write failure is transactional.

Normalization is integer-only. The readback Arrow type supplies the unit. The fixture casts the timestamp array to its integer carrier, then multiplies by 1, 1_000, 1_000_000 or 1_000_000_000 for ns/us/ms/s respectively. It rejects unknown units and checks that the normalized result fits signed 64-bit nanoseconds. No precision assertion passes through Python datetime, floating-point epoch seconds or formatted strings.

Read values and metadata as separate evidence

The artifact record captures both Parquet metadata and decoded Arrow values, but those answer different questions. ColumnSchema exposes physical_type, logical_type, converted_type, name and path; the fixture records the runtime text actually returned rather than inventing a portable logical-type serialization. It separately records ParquetFile.schema_arrow and the readback timestamp unit.

The Parquet specification defines an adjusted timestamp as a count of its declared units since the Unix epoch; for the INT64 carrier, the unit gives the meaning of the integer. Metadata can therefore explain representation, but it does not prove that the represented value equals the source. That proof comes from the source-keyed integer comparison.

This separation resembles the evidence boundary in evidence for Parquet row-group pruning: metadata-level evidence and returned rows are related but not interchangeable. No pruning test is introduced here.

Make strict writes reject unaligned values

P02 changes one control from P01: it explicitly requests coerce_timestamps='us' while keeping allow_truncated_timestamps=False. U contains A=BASE+100, B=BASE+900, and D=BASE+1900, none of which is exactly divisible by 1,000 nanoseconds. PyArrow documents that lossy coercion raises unless truncation is allowed. The expected diagnostic is therefore a write-phase precision-loss rejection.

P04 reaches the same diagnostic through a different control path: U, version='1.0', coerce_timestamps=None, allow_truncated_timestamps=False. The 20.0.0 API reference says omitted coercion under version 1.0 chooses microseconds for nanosecond input, so the same three residual-bearing values make that implicit version-dependent conversion lossy and are expected to be rejected. P01 is essential because it shows the same source table is expected to serialize under the native-nanosecond configuration.

The fixture captures failure phase, exception class and message exactly as the future runtime emits them. This manuscript does not supply a guessed Arrow exception type or phrase. A rejection counts as the intended diagnostic only if the surrounding evidence supports a precision cause: the source table already matched the integer oracle, P01 is valid, the relevant options are exactly recorded, and the failure occurs during pq.write_table. An import error, unsupported package build, invalid buffer operation, malformed source, wrong Python version or unrelated exception is an unresolved failure, not a successful P02/P04 diagnostic.

This distinction matters operationally. A negative control can pass as a test because the writer rejects the planned lossy conversion, while the candidate itself has no accepted artifact. The evidence row must remain in the ledger anyway. Silently omitting failed cases would erase the very control that distinguishes precision rejection from generic pipeline instability.

Permit truncation and expose the changed instants

P03 requests version='2.6', coerce_timestamps='us', allow_truncated_timestamps=True. P05 uses version='1.0' with the same explicit microsecond coercion and permission. Because the target unit is explicitly us in both cases, the authored expectation for U is the same: six IDs survive, F stays null, and the integer nanoseconds normalize as follows. PyArrow documents that truncation permission suppresses the loss error when a coercion is requested; it does not turn the result into exact data.

ID

Original offset from BASE (ns)

Expected normalized output offset (ns)

Expected delta (ns)

A

100

0

-100

B

900

0

-900

C

1000

1000

0

D

1900

1000

-900

E

2000

2000

0

F

null

null

null

The three changed values are precise: A is expected to move from 1700000000000000100 to 1700000000000000000; B from 1700000000000000900 to 1700000000000000000; and D from 1700000000000001900 to 1700000000000001000. C and E are already microsecond-aligned and therefore retain their instants even under the coarser representation.

Count new collisions by source identity

The correct collision test is source-aware. A and B begin as unequal non-null source instants and are expected to become equal at BASE. C and D begin unequal and are expected to become equal at BASE+1000. Those are the two new collision pairs. The number of distinct non-null instants therefore drops from five to three.

That does not mean rows merged. All six event IDs remain separate rows. A timestamp coincidence is a value collision, not row duplication. Conversely, exact retention can fail without any collision: a timestamp could move to a unique wrong instant. The contract therefore checks every per-ID delta first and treats collision counting as an additional diagnostic, not as the only loss detector.

Compare an aligned microsecond input

P06 changes the source population to aligned A and uses version='1.0', coerce_timestamps=None, allow_truncated_timestamps=False. A's non-null offsets are [0, 0, 1000, 1000, 2000]; every value is divisible by 1,000. Under the version-dependent microsecond representation documented for version 1.0, no residual digits need to be discarded.

The expected result is therefore exact instant retention despite a coarser readback representation. The unit may be microseconds, but multiplying each readback integer by 1,000 should reproduce the original nanosecond integer exactly. This is why “timestamp became microseconds” and “timestamp lost information” are not synonyms.

Population A also contains legitimate duplicate event times: A and B both equal BASE, while C and D both equal BASE+1000. The new-collision definition excludes those pairs because their source instants were already equal. P06 therefore expects zero new collisions. A validator that rejects every duplicated timestamp would falsely reject a valid dataset because event time is not the row key.

This distinction between physical integer scale and represented instant is also the useful boundary when reading pandas datetime-unit migration pitfalls. A change in integer unit can alter the raw integer magnitude while leaving the same instant intact; this fixture avoids pandas entirely and proves equivalence by explicit unit normalization.

P06 is the control that rejects a plausible false explanation for P03: “microsecond storage is always corrupt.” It is not. The failure condition is discarded source information, which depends on source alignment and the conversion contract.

Test permission flags without requesting coercion

P07 isolates the permission flag. It uses U with version='2.6', coerce_timestamps=None, and allow_truncated_timestamps=True. The writer reference states two relevant behaviors: version 2.6 supports native nanoseconds when coercion is omitted, and allow_truncated_timestamps=True does not by itself cause truncation when coerce_timestamps is None.

The expected P07 result is therefore the same value fidelity as P01: exact normalized nanoseconds, five distinct non-null instants, no new collisions. The flag is permission for a requested lossy conversion; it is not a request to reduce precision.

For incident review, inspect the actual option record instead of relying on a remembered default. Two artifacts both labeled “Parquet 2.6” can differ if one explicitly requests coerce_timestamps='us'. Two jobs both setting allow_truncated_timestamps=True can differ if only one requests a coarser unit. The candidate evidence must preserve the full option tuple because value behavior follows the combination.

Do not infer behavior from defaults

There is a documentation discrepancy worth preserving. The PyArrow 20.0.0 write_table API and implementation render the function signature with version='2.6' and describe 2.6 as the default. The versioned narrative Parquet guide, however, says the default is version 1.0 while also explaining that 2.6 can store nanoseconds without casting.

This article does not silently reconcile those incompatible statements. It prefers the versioned signature and implementation for describing the 20.0.0 callable default, but the fixture removes the ambiguity by explicitly setting version in every write. Future observed divergences should be recorded with their runtime rather than generalized to all Arrow versions.

Show why upcasting cannot recover discarded precision

P08 starts only from successful P03 bytes. It reads P03 normally, then casts the readback timestamp column to timestamp[ns, tz=UTC]. Arrow's cast API changes an array to a target type and can enforce safe conversion checks, but a cast does not have access to digits already discarded before or during serialization.

Suppose P03 readback carries the expected microsecond integer corresponding to BASE. Upcasting to nanoseconds multiplies that count by 1,000. The resulting nanosecond integer is still 1700000000000000000, not A's original 1700000000000000100 and not B's original 1700000000000000900. Likewise, the microsecond value for BASE+1000 upcasts to 1700000000000001000, not D's original 1700000000000001900.

The reason is mathematical: the lossy mapping is many-to-one. For this positive-epoch fixture, every source integer from BASE+0 through BASE+999 maps to the same whole-microsecond count after truncation. A and B therefore share one output. C and D share another. Once only the quotient remains, the residuals 100, 900 and 900 nanoseconds are no longer represented anywhere in the artifact under test.

Changing the declared unit can widen the numerical scale, but it cannot choose which residual was originally attached to which event. A timestamp[ns] label after P08 is therefore not evidence of original nanosecond precision. The validator must compare the upcast integers back to U and is expected to observe the same deltas as P03: A -100, B -900, D -900, with C/E exact and F null.

Recovery requires an independent retained source containing those residuals. Padding zeros, interpolation, string formatting or a type cast would invent or merely rescale data, not reconstruct the supplied instants.

Reject loss before the writer runs

P09 moves the precision rule in front of the serializer. Its application policy is simple and intentionally independent of PyArrow: every non-null source nanosecond integer must satisfy original_ns % 1000 == 0 before a job is allowed to choose a microsecond-retention contract. U fails because A, B and D have nonzero remainders. The expected disposition is rejection with writer invocation count zero.

This preflight is not an Arrow feature and should not be attributed to automatic writer validation. It is producer policy: “for an exact-retention artifact constrained to microseconds, prove representability before calling the writer.” The writer options then become implementation of an already-qualified contract rather than the first place the pipeline discovers that business data cannot fit.

A production gate should apply the check to the same canonical source identity later used in artifact evidence. If the source manifest is absent, malformed, duplicated, or does not match the table construction input, do not substitute the Arrow table as a new oracle. That would let an earlier transformation erase the evidence required to detect itself.

The preflight also makes intentional quantization a separate decision. If a business process truly wants to round or truncate timestamps, that requires its own approved transformation contract and different acceptance criteria. It is outside this exact-retention article.

Fail closed when evidence is incomplete

Acceptance requires complete case and provenance evidence, not “most checks looked good.” The release gate should block on missing P01–P10 ledger rows, duplicate or unexpected event IDs, an unknown readback unit, mismatched source hash, missing null-policy evidence, unresolved write exceptions, or a candidate whose bytes cannot be tied to recorded options. A missing failure record is not partial success.

A useful comparator also includes a deliberately wrong expectation. For example, change the expected P03 delta for B from -900 to 0 in a test-only manifest. The reconciliation must reject that expectation because the normalized output predicted from microsecond truncation is BASE while B's source is BASE+900. If the comparator still reports success, it is not actually source-keyed or is accidentally comparing the candidate to itself.

Unexpected observations must be preserved with runtime and artifact identity. Investigate documentation, package build, option plumbing and data construction; do not edit the expected manifest to fit an unexplained result.

Rebuild from the retained original

P10 demonstrates the recovery boundary. It does not repair P03 bytes. It returns to retained original U, constructs a fresh Arrow table, and writes a new candidate with version='2.6', no coercion and strict truncation settings. The new candidate has its own artifact hash and identity, while the ledger keeps the P03 lossy hash as the artifact being replaced.

The expected P10 result is the same exact value relationship as P01. If that future execution succeeds and the target consumers are qualified for the chosen representation, the new candidate can move toward ACCEPT_EXACT. The old P03 evidence remains valuable because it explains why the previous artifact was rejected; it should not be overwritten by the rebuild.

If the authoritative full-precision source no longer exists, the correct state is HOLD_SOURCE. P08 already established the information-theoretic reason: a coarsened artifact does not contain enough information to reconstruct the original residuals. Another upstream source may later be declared authoritative, but that is a provenance decision, not a Parquet trick.

Rollback should also be described precisely. Selecting a previously accepted artifact is rollback. An in-memory BufferOutputStream experiment does not prove storage atomicity, remote publication semantics or transaction behavior, all of which are excluded from this fixture.

Reconcile every case before choosing an artifact

The evidence ledger below is the complete authored expectation. Because the laboratory has not been executed, the observation column is NOT EXECUTED for every case. Future runs should replace that status only with captured evidence, never with the expectations themselves.

Case

Expected outcome

Actual observation

Evidence identity required

Disposition if expectation is confirmed

P01

U; 2.6 native ns; exact values

NOT EXECUTED

source SHA, options, artifact SHA/length, unit, values, metadata

ACCEPT_EXACT candidate baseline

P02

Explicit us + strict: precision-loss write rejection

NOT EXECUTED

source SHA, options, write phase, actual exception class/message

REJECT_PRECISION; no accepted artifact

P03

Explicit us + allowed loss: three changed values; A/B and C/D new collisions

NOT EXECUTED

source SHA, artifact SHA/length, normalized values, deltas, collisions

REJECT_PRECISION despite diagnostic success

P04

1.0 default coercion + strict: reject unaligned U

NOT EXECUTED

source SHA, options, actual write failure evidence

REJECT_PRECISION; no accepted artifact

P05

1.0 explicit us + allowed loss: same value loss as P03

NOT EXECUTED

source SHA, artifact SHA/length, per-ID comparison

REJECT_PRECISION

P06

Aligned A under 1.0: exact instants, zero new collisions

NOT EXECUTED

A source SHA relationship, unit, normalized values, metadata

ACCEPT_EXACT for fixture, subject to consumer qualification

P07

2.6 native ns with permission flag only: exact values

NOT EXECUTED

source SHA, explicit options, artifact identity, comparison

ACCEPT_EXACT for fixture

P08

Cast P03 readback to ns; residuals still absent

NOT EXECUTED

parent P03 artifact SHA, target type, post-cast integers, deltas

REJECT_PRECISION; cast is not recovery

P09

U fails % 1000 == 0; writer calls remain zero

NOT EXECUTED

source SHA, policy version, invocation counter

REJECT_PRECISION before serialization

P10

Rebuild from retained U as new 2.6 native candidate; exact values

NOT EXECUTED

source SHA, new candidate SHA/length, replaced P03 SHA if present

REBUILD_FROM_SOURCE then ACCEPT_EXACT if all gates pass

P08 has an explicit parent-child relationship: it is evidence about a transformation of P03 readback, not an independent source reconstruction. P10 has the opposite relationship: it is a new candidate sourced from retained U, with P03 preserved only as historical rejected evidence.

Separate a diagnostic pass from acceptance

A diagnostic can succeed while an artifact remains unpublishable. If P03 eventually produces exactly the predicted three changed values and two new collision pairs, that confirms the planned loss mechanism under the pinned fixture. It does not turn P03 into an accepted exact-retention artifact. Likewise, P02 can be a successful negative control because the writer rejects the lossy request, yet there are no accepted candidate bytes from that case.

Conversely, a successful P01 or P10 validates only the declared fixture and runtime. It does not qualify every Arrow release, every timestamp range, negative epochs, every Parquet reader, remote storage, distributed publication, or downstream table format. Expectations are not PASS records. Until execution captures runtime and evidence, this manuscript remains explicitly unexecuted.

Assign compatibility decisions and operational ownership

Artifact selection should turn the technical findings into a small set of operational states rather than one overloaded PASS/FAIL bit.

Condition

Decision

Required next evidence or action

Owner

Exact per-ID instants, complete provenance, supported unit, no unresolved failures

ACCEPT_EXACT

Preserve ledger and select candidate only for qualified consumers

Release owner

Any unintended nonzero per-ID delta or new collision from unequal source instants

REJECT_PRECISION

Keep source and failure/loss evidence; block publication

Validation owner

Candidate bytes exist but source hash/options/identity cannot be established

HOLD_PROVENANCE

Recover trustworthy provenance before comparison

Exporter + release owner

Loss is known but authoritative full-precision source is unavailable

HOLD_SOURCE

Locate/declare authoritative source; do not invent residuals

Source-data owner

Retained authoritative source exists after lossy candidate

REBUILD_FROM_SOURCE

Create new candidate identity and rerun full reconciliation

Exporter owner

Native-nanosecond candidate is exact locally but target reader support is untested

QUALIFY_CONSUMER

Test named consumer/version against required logical type and values

Consumer/platform owner

Source retention belongs to the source-data owner: preserve authoritative full-precision integers and source identity long enough to rebuild. Exporter configuration belongs to the pipeline/export owner: pin and record version, coercion, truncation permission, and the shared writer controls. Validation belongs to a separate release or data-quality function when possible: compare source-keyed values, nulls, IDs, metadata and failures without deriving expectations from the artifact. Final artifact selection belongs to the release owner, who should choose among accepted identities rather than mutating evidence in place.

Consumer qualification is a separate gate because the 20.0.0 writer documentation warns that files using newer Parquet logical-format versions may not be readable in every implementation. The contextual discussion of table-format interoperability and reader support reinforces the broader point that cross-engine support is a compatibility question, not something inferred from one writer. This fixture does not test any downstream consumer, so an exact 2.6 artifact may still require QUALIFY_CONSUMER before release.

The Parquet logical specification currently describes TIMESTAMP with a unit and UTC-adjustment semantics and also discusses a wider physical carrier. That broader specification must not be used to imply this PyArrow 20.0.0 INT64 fixture supports or exercises the wider carrier. The scope remains the declared INT64 positive-epoch values only.

Continue pipeline validation with Refonte Learning

The operational handoff from this lab is compact: retain the canonical source manifest, preserve the exact writer-option record, capture runtime and artifact identity when the fixture is actually executed, reconcile every event ID in integer nanoseconds, and make the release decision from evidence rather than from schema labels or successful serialization alone. If loss is unintended, reject it; if provenance is missing, hold it; if the full-precision source survives, rebuild a new candidate; if native nanoseconds are required, qualify the named consumer before publication.

For engineers building the broader foundations around that workflow, Refonte Learning's Data Engineering Program lists a three-month period with 12–14 hours per week. Its curriculum covers data engineering foundations, data warehousing and ETL, and big-data technologies and pipeline design, with Hadoop and Spark named as examples; the page also lists streaming and batch ingestion, transformation, real-time processing, storage and governance among its featured areas. It describes projects, virtual-internship and mentorship opportunities, and says successful completion receives a Training Certificate and a Certificate of Internship. The admission section specifies working toward a bachelor's or higher-level degree.

The page does not establish that this exact PyArrow/Parquet precision lab is taught, nor does this article infer a guaranteed internship placement, specific mentoring cadence or specialist coverage beyond the verified program information. The relevant takeaway is narrower: precise serialization decisions become reliable only when pipeline foundations, source contracts and validation ownership are treated as one connected engineering system.