Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -555,6 +555,9 @@ private TimeLogicalTypeAnnotation(boolean isAdjustedToUTC, TimeUnit unit) {
@Override
@InterfaceAudience.Private
public OriginalType toOriginalType() {
if (!isAdjustedToUTC) {
return null;
}
switch (unit) {
case MILLIS:
return OriginalType.TIME_MILLIS;
Expand Down Expand Up @@ -634,6 +637,9 @@ private TimestampLogicalTypeAnnotation(boolean isAdjustedToUTC, TimeUnit unit) {
@Override
@InterfaceAudience.Private
public OriginalType toOriginalType() {
if (!isAdjustedToUTC) {
return null;
}
switch (unit) {
case MILLIS:
return OriginalType.TIMESTAMP_MILLIS;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,9 @@ public Optional<ConvertedType> visit(LogicalTypeAnnotation.DateLogicalTypeAnnota

@Override
public Optional<ConvertedType> visit(LogicalTypeAnnotation.TimeLogicalTypeAnnotation timeLogicalType) {
if (!timeLogicalType.isAdjustedToUTC()) {
return empty();
}
switch (timeLogicalType.getUnit()) {
case MILLIS:
return of(ConvertedType.TIME_MILLIS);
Expand All @@ -323,6 +326,9 @@ public Optional<ConvertedType> visit(LogicalTypeAnnotation.TimeLogicalTypeAnnota

@Override
public Optional<ConvertedType> visit(LogicalTypeAnnotation.TimestampLogicalTypeAnnotation timestampLogicalType) {
if (!timestampLogicalType.isAdjustedToUTC()) {
return empty();
}
switch (timestampLogicalType.getUnit()) {
case MICROS:
return of(ConvertedType.TIMESTAMP_MICROS);
Expand Down