From c4e6560fa7134809a60aae4cbf3d3f17ab91e3a4 Mon Sep 17 00:00:00 2001 From: Robert Burke Date: Thu, 7 Jun 2018 10:34:22 -0700 Subject: [PATCH] Combine immutability type fixes. (#3) * Update Schema.java The type sets are final mutable types, but with immutable implementations. This doesn't communicate the desired semantic guarantees of the immutable implementation. * Remove unneeded collection import. --- .../java/org/apache/beam/sdk/schemas/Schema.java | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/sdks/java/core/src/main/java/org/apache/beam/sdk/schemas/Schema.java b/sdks/java/core/src/main/java/org/apache/beam/sdk/schemas/Schema.java index 817e0248ac16d..020fedebea39f 100644 --- a/sdks/java/core/src/main/java/org/apache/beam/sdk/schemas/Schema.java +++ b/sdks/java/core/src/main/java/org/apache/beam/sdk/schemas/Schema.java @@ -28,7 +28,6 @@ import java.util.Arrays; import java.util.List; import java.util.Objects; -import java.util.Set; import java.util.stream.Collector; import java.util.stream.Collectors; import javax.annotation.Nullable; @@ -222,13 +221,13 @@ public enum TypeName { MAP, ROW; // The field is itself a nested row. - public static final Set NUMERIC_TYPES = ImmutableSet.of( + public static final ImmutableSet NUMERIC_TYPES = ImmutableSet.of( BYTE, INT16, INT32, INT64, DECIMAL, FLOAT, DOUBLE); - public static final Set STRING_TYPES = ImmutableSet.of(STRING); - public static final Set DATE_TYPES = ImmutableSet.of(DATETIME); - public static final Set COLLECTION_TYPES = ImmutableSet.of(ARRAY); - public static final Set MAP_TYPES = ImmutableSet.of(MAP); - public static final Set COMPOSITE_TYPES = ImmutableSet.of(ROW); + public static final ImmutableSet STRING_TYPES = ImmutableSet.of(STRING); + public static final ImmutableSet DATE_TYPES = ImmutableSet.of(DATETIME); + public static final ImmutableSet COLLECTION_TYPES = ImmutableSet.of(ARRAY); + public static final ImmutableSet MAP_TYPES = ImmutableSet.of(MAP); + public static final ImmutableSet COMPOSITE_TYPES = ImmutableSet.of(ROW); public boolean isPrimitiveType() { return !isCollectionType() && !isMapType() && !isCompositeType();