Skip to content

NanoSecond Timestamp values aren't converted into Generic mode #15098

@ayushtkn

Description

@ayushtkn

Apache Iceberg version

main (development)

Query engine

None

Please describe the bug 🐞

While fetching the initial default values for columns of type nanosecond timestamp, Long is returned instead of the generic types.

The reason being:

public static Object internalToGeneric(Type type, Object value) {
if (null == value) {
return null;
}
switch (type.typeId()) {
case DATE:
return DateTimeUtil.dateFromDays((Integer) value);
case TIME:
return DateTimeUtil.timeFromMicros((Long) value);
case TIMESTAMP:
if (((Types.TimestampType) type).shouldAdjustToUTC()) {
return DateTimeUtil.timestamptzFromMicros((Long) value);
} else {
return DateTimeUtil.timestampFromMicros((Long) value);
}
case FIXED:
return ByteBuffers.toByteArray((ByteBuffer) value);
}
return value;

The internalToGeneric method only handles TIMESTAMP not the TIMESTAMP_NANO

Willingness to contribute

  • I can contribute a fix for this bug independently
  • I would be willing to contribute a fix for this bug with guidance from the Iceberg community
  • I cannot contribute a fix for this bug at this time

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions