Skip to content

TimestampWriter isn't being used #475

Description

@ashleycoxley

When trying to write to a field with type Types.TimestampType.withoutZone(), I'm getting the exception
java.time.LocalDateTime cannot be cast to java.time.OffsetDateTime.

This appears to be due to a case match miss in the GenericParquetWriter - for all primitives of type TIMESTAMP_MICROS, the TimestamptzWriter is returned. I believe it should only be returned when shouldAdjustToUTC is true; and the TimestampWriter returned otherwise (similar to the implementation in GenericParquetReaders).

in GenericParquetWriter:

case TIMESTAMP_MICROS:
    return new TimestamptzWriter(desc);

in GenericParquetReader:

case TIMESTAMP_MICROS:
    TimestampType tsMicrosType = (TimestampType)expected;
    if (tsMicrosType.shouldAdjustToUTC()) {
        return new GenericParquetReaders.TimestamptzReader(desc);
    }

    return new GenericParquetReaders.TimestampReader(desc);

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions