Skip to content

Commit 88b51f4

Browse files
author
Claude
committed
Lint.
1 parent 1d0a0ef commit 88b51f4

File tree

2 files changed

+5
-4
lines changed
  • sdks/java
    • extensions/avro/src/main/java/org/apache/beam/sdk/extensions/avro/schemas/utils
    • io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigquery

2 files changed

+5
-4
lines changed

sdks/java/extensions/avro/src/main/java/org/apache/beam/sdk/extensions/avro/schemas/utils/AvroUtils.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1033,7 +1033,7 @@ private static FieldType toFieldType(TypeWithNullability type) {
10331033
}
10341034
// TODO: Remove once Avro 1.12+ has timestamp-nanos
10351035
if (fieldType == null
1036-
&& TIMESTAMP_NANOS_LOGICAL_TYPE.equals(avroSchema.getProp("logicalType"))) {
1036+
&& avroSchema.getProp("logicalType").equals(TIMESTAMP_NANOS_LOGICAL_TYPE)) {
10371037
fieldType = FieldType.logicalType(Timestamp.NANOS);
10381038
}
10391039

@@ -1407,7 +1407,7 @@ private static Object convertLogicalType(
14071407
TypeWithNullability type = new TypeWithNullability(avroSchema);
14081408

14091409
// TODO: Remove this workaround once Avro is upgraded to 1.12+ where timestamp-nanos
1410-
if (TIMESTAMP_NANOS_LOGICAL_TYPE.equals(type.type.getProp("logicalType"))) {
1410+
if (type.type.getProp("logicalType").equals(TIMESTAMP_NANOS_LOGICAL_TYPE)) {
14111411
if (type.type.getType() == Type.LONG) {
14121412
Long nanos = (Long) value;
14131413
// Check if Beam expects Timestamp logical type

sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/BigQueryAvroUtils.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,7 @@ private static Object convertRequiredField(String name, Schema schema, Object v)
412412
// ideally Instant but TableRowJsonCoder encodes as String
413413
return formatTimestamp((Long) v, TimestampPrecision.MICROSECONDS);
414414
// TODO: Use LogicalTypes.TimestampNanos once avro version is updated.
415-
} else if (TIMESTAMP_NANOS_LOGICAL_TYPE.equals(schema.getProp("logicalType"))) {
415+
} else if (schema.getProp("logicalType").equals(TIMESTAMP_NANOS_LOGICAL_TYPE)) {
416416
// SQL type TIMESTAMP
417417
// ideally Instant but TableRowJsonCoder encodes as String
418418
return formatTimestamp((Long) v, TimestampPrecision.NANOSECONDS);
@@ -650,7 +650,8 @@ private static TableFieldSchema typedTableFieldSchema(Schema type, Boolean useAv
650650
}
651651
case LONG:
652652
// TODO: Use LogicalTypes.TimestampNanos once avro version is updated.
653-
if (useAvroLogicalTypes && (TIMESTAMP_NANOS_LOGICAL_TYPE.equals(type.getProp("logicalType")))) {
653+
if (useAvroLogicalTypes
654+
&& (type.getProp("logicalType").equals(TIMESTAMP_NANOS_LOGICAL_TYPE))) {
654655
return fieldSchema.setType("TIMESTAMP");
655656
}
656657
if (logicalType instanceof LogicalTypes.TimeMicros) {

0 commit comments

Comments
 (0)