Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API, Core: implement types timestamp_ns and timestamptz_ns #8971

Closed
wants to merge 9 commits into from
Prev Previous commit
Next Next commit
chore: cleanup exceptions thrown for timestamp unit
  • Loading branch information
jacobmarble committed Nov 7, 2023
commit 5278960af1d6c120869d1f6b4660240aeb8da681
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public static String humanTimestamp(Types.TimestampType tsType, Long value) {
case NANOS:
return ChronoUnit.NANOS.addTo(EPOCH, value).toString();
default:
throw new IllegalArgumentException("Invalid timestamp unit: " + tsType.unit());
throw new UnsupportedOperationException("Unsupported timestamp unit: " + tsType.unit());
}
} else {
switch (tsType.unit()) {
Expand All @@ -72,7 +72,7 @@ public static String humanTimestamp(Types.TimestampType tsType, Long value) {
case NANOS:
return ChronoUnit.NANOS.addTo(EPOCH, value).toLocalDateTime().toString();
default:
throw new IllegalArgumentException("Invalid timestamp unit: " + tsType.unit());
throw new UnsupportedOperationException("Unsupported timestamp unit: " + tsType.unit());
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,8 @@ public OrcValueWriter<?> primitive(Type.PrimitiveType iPrimitive, TypeDescriptio
? GenericOrcWriters.timestampnsTz()
: GenericOrcWriters.timestampns();
default:
throw new IllegalArgumentException("Invalid timestamp unit: " + timestampType.unit());
throw new UnsupportedOperationException(
"Unsupported timestamp unit: " + timestampType.unit());
}
case STRING:
return GenericOrcWriters.strings();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ public Optional<Types.NestedField> primitive(TypeDescription primitive) {
icebergID, isOptional, name, Types.TimestampType.nanosWithoutZone());
break;
default:
throw new IllegalStateException("Invalid Timestamp unit found in ORC type attribute");
throw new UnsupportedOperationException("Unsupported timestamp unit: " + unit);
}
break;
case TIMESTAMP_INSTANT:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,8 @@ public Optional<ParquetValueWriters.PrimitiveWriter<?>> visit(
? new TimestamptznsWriter(desc)
: new TimestampnsWriter(desc));
default:
throw new IllegalArgumentException(
"Timestamp unit %s not supported" + timestampType.getUnit());
throw new UnsupportedOperationException(
"Unsupported timestamp unit" + timestampType.getUnit());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ public Optional<Type> visit(
: TimestampType.nanosWithoutZone());
default:
throw new UnsupportedOperationException(
"Cannot convert unsupported timestamp unit: " + timestampType.getUnit());
"Unsupported timestamp unit: " + timestampType.getUnit());
}
}

Expand Down