You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by se...@apache.org on 2018/04/23 04:44:56 UTC
[04/17] flink git commit: [hotfix] [core] Fix checkstyle in
org.apache.flink.api.common.typeinfo
[hotfix] [core] Fix checkstyle in org.apache.flink.api.common.typeinfo
Project: http://git-wip-us.apache.org/repos/asf/flink/repo
Commit: http://git-wip-us.apache.org/repos/asf/flink/commit/a0ef71b7
Tree: http://git-wip-us.apache.org/repos/asf/flink/tree/a0ef71b7
Diff: http://git-wip-us.apache.org/repos/asf/flink/diff/a0ef71b7
Branch: refs/heads/release-1.5
Commit: a0ef71b7b6f9815276581931e5fbaa0c374c502d
Parents: c11477a
Author: Stephan Ewen <se...@apache.org>
Authored: Tue Apr 17 19:17:44 2018 +0200
Committer: Stephan Ewen <se...@apache.org>
Committed: Sun Apr 22 22:42:18 2018 +0200
----------------------------------------------------------------------
.../flink/api/common/typeinfo/AtomicType.java | 10 +--
.../api/common/typeinfo/BasicArrayTypeInfo.java | 53 ++++++++------
.../api/common/typeinfo/BasicTypeInfo.java | 77 ++++++++++----------
.../api/common/typeinfo/FractionalTypeInfo.java | 4 +-
.../api/common/typeinfo/IntegerTypeInfo.java | 2 +-
.../api/common/typeinfo/NothingTypeInfo.java | 8 +-
.../api/common/typeinfo/NumericTypeInfo.java | 4 +-
.../common/typeinfo/PrimitiveArrayTypeInfo.java | 40 +++++-----
.../api/common/typeinfo/SqlTimeTypeInfo.java | 12 +--
.../flink/api/common/typeinfo/TypeHint.java | 10 +--
.../flink/api/common/typeinfo/TypeInfo.java | 5 +-
.../api/common/typeinfo/TypeInfoFactory.java | 5 +-
.../api/common/typeinfo/TypeInformation.java | 69 +++++++++---------
.../apache/flink/api/common/typeinfo/Types.java | 6 +-
.../flink/api/common/typeinfo/TypeHintTest.java | 22 +++---
tools/maven/suppressions-core.xml | 8 --
16 files changed, 173 insertions(+), 162 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flink/blob/a0ef71b7/flink-core/src/main/java/org/apache/flink/api/common/typeinfo/AtomicType.java
----------------------------------------------------------------------
diff --git a/flink-core/src/main/java/org/apache/flink/api/common/typeinfo/AtomicType.java b/flink-core/src/main/java/org/apache/flink/api/common/typeinfo/AtomicType.java
index ccd36c0..11f804f 100644
--- a/flink-core/src/main/java/org/apache/flink/api/common/typeinfo/AtomicType.java
+++ b/flink-core/src/main/java/org/apache/flink/api/common/typeinfo/AtomicType.java
@@ -26,19 +26,19 @@ import org.apache.flink.api.common.typeutils.TypeComparator;
* An atomic type is a type that is treated as one indivisible unit and where the entire type acts
* as a key. The atomic type defines the method to create a comparator for this type as a key.
* Example atomic types are the basic types (int, long, String, ...) and comparable custom classes.
- * <p>
- * In contrast to atomic types are composite types, where the type information is aware of the individual
+ *
+ * <p>In contrast to atomic types are composite types, where the type information is aware of the individual
* fields and individual fields may be used as a key.
*/
@Public
public interface AtomicType<T> {
-
+
/**
* Creates a comparator for this type.
- *
+ *
* @param sortOrderAscending True, if the comparator should define the order to be ascending,
* false, if the comparator should define the order to be descending.
- * @param executionConfig The config from which the comparator will be parameterized. Parameterization
+ * @param executionConfig The config from which the comparator will be parametrized. Parametrization
* includes for example registration of class tags for frameworks like Kryo.
* @return A comparator for this type.
*/
http://git-wip-us.apache.org/repos/asf/flink/blob/a0ef71b7/flink-core/src/main/java/org/apache/flink/api/common/typeinfo/BasicArrayTypeInfo.java
----------------------------------------------------------------------
diff --git a/flink-core/src/main/java/org/apache/flink/api/common/typeinfo/BasicArrayTypeInfo.java b/flink-core/src/main/java/org/apache/flink/api/common/typeinfo/BasicArrayTypeInfo.java
index 25b2850..a0d7989 100644
--- a/flink-core/src/main/java/org/apache/flink/api/common/typeinfo/BasicArrayTypeInfo.java
+++ b/flink-core/src/main/java/org/apache/flink/api/common/typeinfo/BasicArrayTypeInfo.java
@@ -18,41 +18,47 @@
package org.apache.flink.api.common.typeinfo;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Objects;
-
-import org.apache.flink.annotation.PublicEvolving;
import org.apache.flink.annotation.Public;
+import org.apache.flink.annotation.PublicEvolving;
import org.apache.flink.api.common.ExecutionConfig;
-import org.apache.flink.api.common.typeutils.TypeSerializer;
-import org.apache.flink.api.common.typeutils.base.array.StringArraySerializer;
import org.apache.flink.api.common.functions.InvalidTypesException;
+import org.apache.flink.api.common.typeutils.TypeSerializer;
import org.apache.flink.api.common.typeutils.base.GenericArraySerializer;
+import org.apache.flink.api.common.typeutils.base.array.StringArraySerializer;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Objects;
import static org.apache.flink.util.Preconditions.checkNotNull;
+/**
+ * Type information for arrays boxed primitive types.
+ *
+ * @param <T> The type (class) of the array itself.
+ * @param <C> The type (class) of the array component.
+ */
@Public
public final class BasicArrayTypeInfo<T, C> extends TypeInformation<T> {
private static final long serialVersionUID = 1L;
- public static final BasicArrayTypeInfo<String[], String> STRING_ARRAY_TYPE_INFO = new BasicArrayTypeInfo<String[], String>(String[].class, BasicTypeInfo.STRING_TYPE_INFO);
-
- public static final BasicArrayTypeInfo<Boolean[], Boolean> BOOLEAN_ARRAY_TYPE_INFO = new BasicArrayTypeInfo<Boolean[], Boolean>(Boolean[].class, BasicTypeInfo.BOOLEAN_TYPE_INFO);
- public static final BasicArrayTypeInfo<Byte[], Byte> BYTE_ARRAY_TYPE_INFO = new BasicArrayTypeInfo<Byte[], Byte>(Byte[].class, BasicTypeInfo.BYTE_TYPE_INFO);
- public static final BasicArrayTypeInfo<Short[], Short> SHORT_ARRAY_TYPE_INFO = new BasicArrayTypeInfo<Short[], Short>(Short[].class, BasicTypeInfo.SHORT_TYPE_INFO);
- public static final BasicArrayTypeInfo<Integer[], Integer> INT_ARRAY_TYPE_INFO = new BasicArrayTypeInfo<Integer[], Integer>(Integer[].class, BasicTypeInfo.INT_TYPE_INFO);
- public static final BasicArrayTypeInfo<Long[], Long> LONG_ARRAY_TYPE_INFO = new BasicArrayTypeInfo<Long[], Long>(Long[].class, BasicTypeInfo.LONG_TYPE_INFO);
- public static final BasicArrayTypeInfo<Float[], Float> FLOAT_ARRAY_TYPE_INFO = new BasicArrayTypeInfo<Float[], Float>(Float[].class, BasicTypeInfo.FLOAT_TYPE_INFO);
- public static final BasicArrayTypeInfo<Double[], Double> DOUBLE_ARRAY_TYPE_INFO = new BasicArrayTypeInfo<Double[], Double>(Double[].class, BasicTypeInfo.DOUBLE_TYPE_INFO);
- public static final BasicArrayTypeInfo<Character[], Character> CHAR_ARRAY_TYPE_INFO = new BasicArrayTypeInfo<Character[], Character>(Character[].class, BasicTypeInfo.CHAR_TYPE_INFO);
-
+ public static final BasicArrayTypeInfo<String[], String> STRING_ARRAY_TYPE_INFO = new BasicArrayTypeInfo<>(String[].class, BasicTypeInfo.STRING_TYPE_INFO);
+
+ public static final BasicArrayTypeInfo<Boolean[], Boolean> BOOLEAN_ARRAY_TYPE_INFO = new BasicArrayTypeInfo<>(Boolean[].class, BasicTypeInfo.BOOLEAN_TYPE_INFO);
+ public static final BasicArrayTypeInfo<Byte[], Byte> BYTE_ARRAY_TYPE_INFO = new BasicArrayTypeInfo<>(Byte[].class, BasicTypeInfo.BYTE_TYPE_INFO);
+ public static final BasicArrayTypeInfo<Short[], Short> SHORT_ARRAY_TYPE_INFO = new BasicArrayTypeInfo<>(Short[].class, BasicTypeInfo.SHORT_TYPE_INFO);
+ public static final BasicArrayTypeInfo<Integer[], Integer> INT_ARRAY_TYPE_INFO = new BasicArrayTypeInfo<>(Integer[].class, BasicTypeInfo.INT_TYPE_INFO);
+ public static final BasicArrayTypeInfo<Long[], Long> LONG_ARRAY_TYPE_INFO = new BasicArrayTypeInfo<>(Long[].class, BasicTypeInfo.LONG_TYPE_INFO);
+ public static final BasicArrayTypeInfo<Float[], Float> FLOAT_ARRAY_TYPE_INFO = new BasicArrayTypeInfo<>(Float[].class, BasicTypeInfo.FLOAT_TYPE_INFO);
+ public static final BasicArrayTypeInfo<Double[], Double> DOUBLE_ARRAY_TYPE_INFO = new BasicArrayTypeInfo<>(Double[].class, BasicTypeInfo.DOUBLE_TYPE_INFO);
+ public static final BasicArrayTypeInfo<Character[], Character> CHAR_ARRAY_TYPE_INFO = new BasicArrayTypeInfo<>(Character[].class, BasicTypeInfo.CHAR_TYPE_INFO);
+
// --------------------------------------------------------------------------------------------
private final Class<T> arrayClass;
private final TypeInformation<C> componentInfo;
-
+
private BasicArrayTypeInfo(Class<T> arrayClass, BasicTypeInfo<C> componentInfo) {
this.arrayClass = checkNotNull(arrayClass);
this.componentInfo = checkNotNull(componentInfo);
@@ -77,7 +83,7 @@ public final class BasicArrayTypeInfo<T, C> extends TypeInformation<T> {
public int getArity() {
return 1;
}
-
+
@Override
@PublicEvolving
public int getTotalFields() {
@@ -114,7 +120,7 @@ public final class BasicArrayTypeInfo<T, C> extends TypeInformation<T> {
if (componentInfo.getTypeClass().equals(String.class)) {
return (TypeSerializer<T>) StringArraySerializer.INSTANCE;
} else {
- return (TypeSerializer<T>) new GenericArraySerializer<C>(
+ return (TypeSerializer<T>) new GenericArraySerializer<>(
this.componentInfo.getTypeClass(),
this.componentInfo.createSerializer(executionConfig));
}
@@ -138,7 +144,6 @@ public final class BasicArrayTypeInfo<T, C> extends TypeInformation<T> {
return Objects.hash(arrayClass, componentInfo);
}
-
@Override
public boolean canEqual(Object obj) {
return obj instanceof BasicArrayTypeInfo;
@@ -146,7 +151,7 @@ public final class BasicArrayTypeInfo<T, C> extends TypeInformation<T> {
@Override
public String toString() {
- return this.getClass().getSimpleName()+"<"+this.componentInfo+">";
+ return this.getClass().getSimpleName() + "<" + componentInfo + ">";
}
// --------------------------------------------------------------------------------------------
@@ -162,7 +167,7 @@ public final class BasicArrayTypeInfo<T, C> extends TypeInformation<T> {
return (BasicArrayTypeInfo<X, C>) TYPES.get(type);
}
- private static final Map<Class<?>, BasicArrayTypeInfo<?, ?>> TYPES = new HashMap<Class<?>, BasicArrayTypeInfo<?, ?>>();
+ private static final Map<Class<?>, BasicArrayTypeInfo<?, ?>> TYPES = new HashMap<>();
static {
TYPES.put(String[].class, STRING_ARRAY_TYPE_INFO);
http://git-wip-us.apache.org/repos/asf/flink/blob/a0ef71b7/flink-core/src/main/java/org/apache/flink/api/common/typeinfo/BasicTypeInfo.java
----------------------------------------------------------------------
diff --git a/flink-core/src/main/java/org/apache/flink/api/common/typeinfo/BasicTypeInfo.java b/flink-core/src/main/java/org/apache/flink/api/common/typeinfo/BasicTypeInfo.java
index e2fd74e..f19865e 100644
--- a/flink-core/src/main/java/org/apache/flink/api/common/typeinfo/BasicTypeInfo.java
+++ b/flink-core/src/main/java/org/apache/flink/api/common/typeinfo/BasicTypeInfo.java
@@ -18,17 +18,8 @@
package org.apache.flink.api.common.typeinfo;
-import java.lang.reflect.Constructor;
-import java.math.BigDecimal;
-import java.math.BigInteger;
-import java.util.Arrays;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Objects;
-
-import org.apache.flink.annotation.PublicEvolving;
import org.apache.flink.annotation.Public;
+import org.apache.flink.annotation.PublicEvolving;
import org.apache.flink.api.common.ExecutionConfig;
import org.apache.flink.api.common.functions.InvalidTypesException;
import org.apache.flink.api.common.typeutils.TypeComparator;
@@ -59,6 +50,15 @@ import org.apache.flink.api.common.typeutils.base.StringComparator;
import org.apache.flink.api.common.typeutils.base.StringSerializer;
import org.apache.flink.api.common.typeutils.base.VoidSerializer;
+import java.lang.reflect.Constructor;
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.util.Arrays;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Objects;
+
import static org.apache.flink.util.Preconditions.checkNotNull;
/**
@@ -70,31 +70,30 @@ public class BasicTypeInfo<T> extends TypeInformation<T> implements AtomicType<T
private static final long serialVersionUID = -430955220409131770L;
- public static final BasicTypeInfo<String> STRING_TYPE_INFO = new BasicTypeInfo<String>(String.class, new Class<?>[]{}, StringSerializer.INSTANCE, StringComparator.class);
- public static final BasicTypeInfo<Boolean> BOOLEAN_TYPE_INFO = new BasicTypeInfo<Boolean>(Boolean.class, new Class<?>[]{}, BooleanSerializer.INSTANCE, BooleanComparator.class);
- public static final BasicTypeInfo<Byte> BYTE_TYPE_INFO = new IntegerTypeInfo<Byte>(Byte.class, new Class<?>[]{Short.class, Integer.class, Long.class, Float.class, Double.class, Character.class}, ByteSerializer.INSTANCE, ByteComparator.class);
- public static final BasicTypeInfo<Short> SHORT_TYPE_INFO = new IntegerTypeInfo<Short>(Short.class, new Class<?>[]{Integer.class, Long.class, Float.class, Double.class, Character.class}, ShortSerializer.INSTANCE, ShortComparator.class);
- public static final BasicTypeInfo<Integer> INT_TYPE_INFO = new IntegerTypeInfo<Integer>(Integer.class, new Class<?>[]{Long.class, Float.class, Double.class, Character.class}, IntSerializer.INSTANCE, IntComparator.class);
- public static final BasicTypeInfo<Long> LONG_TYPE_INFO = new IntegerTypeInfo<Long>(Long.class, new Class<?>[]{Float.class, Double.class, Character.class}, LongSerializer.INSTANCE, LongComparator.class);
- public static final BasicTypeInfo<Float> FLOAT_TYPE_INFO = new FractionalTypeInfo<Float>(Float.class, new Class<?>[]{Double.class}, FloatSerializer.INSTANCE, FloatComparator.class);
- public static final BasicTypeInfo<Double> DOUBLE_TYPE_INFO = new FractionalTypeInfo<Double>(Double.class, new Class<?>[]{}, DoubleSerializer.INSTANCE, DoubleComparator.class);
- public static final BasicTypeInfo<Character> CHAR_TYPE_INFO = new BasicTypeInfo<Character>(Character.class, new Class<?>[]{}, CharSerializer.INSTANCE, CharComparator.class);
- public static final BasicTypeInfo<Date> DATE_TYPE_INFO = new BasicTypeInfo<Date>(Date.class, new Class<?>[]{}, DateSerializer.INSTANCE, DateComparator.class);
- public static final BasicTypeInfo<Void> VOID_TYPE_INFO = new BasicTypeInfo<Void>(Void.class, new Class<?>[]{}, VoidSerializer.INSTANCE, null);
- public static final BasicTypeInfo<BigInteger> BIG_INT_TYPE_INFO = new BasicTypeInfo<BigInteger>(BigInteger.class, new Class<?>[]{}, BigIntSerializer.INSTANCE, BigIntComparator.class);
- public static final BasicTypeInfo<BigDecimal> BIG_DEC_TYPE_INFO = new BasicTypeInfo<BigDecimal>(BigDecimal.class, new Class<?>[]{}, BigDecSerializer.INSTANCE, BigDecComparator.class);
+ public static final BasicTypeInfo<String> STRING_TYPE_INFO = new BasicTypeInfo<>(String.class, new Class<?>[]{}, StringSerializer.INSTANCE, StringComparator.class);
+ public static final BasicTypeInfo<Boolean> BOOLEAN_TYPE_INFO = new BasicTypeInfo<>(Boolean.class, new Class<?>[]{}, BooleanSerializer.INSTANCE, BooleanComparator.class);
+ public static final BasicTypeInfo<Byte> BYTE_TYPE_INFO = new IntegerTypeInfo<>(Byte.class, new Class<?>[]{Short.class, Integer.class, Long.class, Float.class, Double.class, Character.class}, ByteSerializer.INSTANCE, ByteComparator.class);
+ public static final BasicTypeInfo<Short> SHORT_TYPE_INFO = new IntegerTypeInfo<>(Short.class, new Class<?>[]{Integer.class, Long.class, Float.class, Double.class, Character.class}, ShortSerializer.INSTANCE, ShortComparator.class);
+ public static final BasicTypeInfo<Integer> INT_TYPE_INFO = new IntegerTypeInfo<>(Integer.class, new Class<?>[]{Long.class, Float.class, Double.class, Character.class}, IntSerializer.INSTANCE, IntComparator.class);
+ public static final BasicTypeInfo<Long> LONG_TYPE_INFO = new IntegerTypeInfo<>(Long.class, new Class<?>[]{Float.class, Double.class, Character.class}, LongSerializer.INSTANCE, LongComparator.class);
+ public static final BasicTypeInfo<Float> FLOAT_TYPE_INFO = new FractionalTypeInfo<>(Float.class, new Class<?>[]{Double.class}, FloatSerializer.INSTANCE, FloatComparator.class);
+ public static final BasicTypeInfo<Double> DOUBLE_TYPE_INFO = new FractionalTypeInfo<>(Double.class, new Class<?>[]{}, DoubleSerializer.INSTANCE, DoubleComparator.class);
+ public static final BasicTypeInfo<Character> CHAR_TYPE_INFO = new BasicTypeInfo<>(Character.class, new Class<?>[]{}, CharSerializer.INSTANCE, CharComparator.class);
+ public static final BasicTypeInfo<Date> DATE_TYPE_INFO = new BasicTypeInfo<>(Date.class, new Class<?>[]{}, DateSerializer.INSTANCE, DateComparator.class);
+ public static final BasicTypeInfo<Void> VOID_TYPE_INFO = new BasicTypeInfo<>(Void.class, new Class<?>[]{}, VoidSerializer.INSTANCE, null);
+ public static final BasicTypeInfo<BigInteger> BIG_INT_TYPE_INFO = new BasicTypeInfo<>(BigInteger.class, new Class<?>[]{}, BigIntSerializer.INSTANCE, BigIntComparator.class);
+ public static final BasicTypeInfo<BigDecimal> BIG_DEC_TYPE_INFO = new BasicTypeInfo<>(BigDecimal.class, new Class<?>[]{}, BigDecSerializer.INSTANCE, BigDecComparator.class);
// --------------------------------------------------------------------------------------------
private final Class<T> clazz;
-
+
private final TypeSerializer<T> serializer;
private final Class<?>[] possibleCastTargetTypes;
-
+
private final Class<? extends TypeComparator<T>> comparatorClass;
-
-
+
protected BasicTypeInfo(Class<T> clazz, Class<?>[] possibleCastTargetTypes, TypeSerializer<T> serializer, Class<? extends TypeComparator<T>> comparatorClass) {
this.clazz = checkNotNull(clazz);
this.possibleCastTargetTypes = checkNotNull(possibleCastTargetTypes);
@@ -102,7 +101,7 @@ public class BasicTypeInfo<T> extends TypeInformation<T> implements AtomicType<T
// comparator can be null as in VOID_TYPE_INFO
this.comparatorClass = comparatorClass;
}
-
+
// --------------------------------------------------------------------------------------------
/**
@@ -142,25 +141,25 @@ public class BasicTypeInfo<T> extends TypeInformation<T> implements AtomicType<T
public int getTotalFields() {
return 1;
}
-
+
@Override
@PublicEvolving
public Class<T> getTypeClass() {
return this.clazz;
}
-
+
@Override
@PublicEvolving
public boolean isKeyType() {
return true;
}
-
+
@Override
@PublicEvolving
public TypeSerializer<T> createSerializer(ExecutionConfig executionConfig) {
return this.serializer;
}
-
+
@Override
@PublicEvolving
public TypeComparator<T> createComparator(boolean sortOrderAscending, ExecutionConfig executionConfig) {
@@ -172,7 +171,7 @@ public class BasicTypeInfo<T> extends TypeInformation<T> implements AtomicType<T
}
// --------------------------------------------------------------------------------------------
-
+
@Override
public int hashCode() {
return (31 * Objects.hash(clazz, serializer, comparatorClass)) + Arrays.hashCode(possibleCastTargetTypes);
@@ -197,12 +196,12 @@ public class BasicTypeInfo<T> extends TypeInformation<T> implements AtomicType<T
return false;
}
}
-
+
@Override
public String toString() {
return clazz.getSimpleName();
}
-
+
// --------------------------------------------------------------------------------------------
@PublicEvolving
@@ -210,12 +209,12 @@ public class BasicTypeInfo<T> extends TypeInformation<T> implements AtomicType<T
if (type == null) {
throw new NullPointerException();
}
-
+
@SuppressWarnings("unchecked")
BasicTypeInfo<X> info = (BasicTypeInfo<X>) TYPES.get(type);
return info;
}
-
+
private static <X> TypeComparator<X> instantiateComparator(Class<? extends TypeComparator<X>> comparatorClass, boolean ascendingOrder) {
try {
Constructor<? extends TypeComparator<X>> constructor = comparatorClass.getConstructor(boolean.class);
@@ -225,9 +224,9 @@ public class BasicTypeInfo<T> extends TypeInformation<T> implements AtomicType<T
throw new RuntimeException("Could not initialize basic comparator " + comparatorClass.getName(), e);
}
}
-
+
private static final Map<Class<?>, BasicTypeInfo<?>> TYPES = new HashMap<Class<?>, BasicTypeInfo<?>>();
-
+
static {
TYPES.put(String.class, STRING_TYPE_INFO);
TYPES.put(Boolean.class, BOOLEAN_TYPE_INFO);
http://git-wip-us.apache.org/repos/asf/flink/blob/a0ef71b7/flink-core/src/main/java/org/apache/flink/api/common/typeinfo/FractionalTypeInfo.java
----------------------------------------------------------------------
diff --git a/flink-core/src/main/java/org/apache/flink/api/common/typeinfo/FractionalTypeInfo.java b/flink-core/src/main/java/org/apache/flink/api/common/typeinfo/FractionalTypeInfo.java
index b4e53d4..d398e4a 100644
--- a/flink-core/src/main/java/org/apache/flink/api/common/typeinfo/FractionalTypeInfo.java
+++ b/flink-core/src/main/java/org/apache/flink/api/common/typeinfo/FractionalTypeInfo.java
@@ -35,7 +35,7 @@ public class FractionalTypeInfo<T> extends NumericTypeInfo<T> {
private static final long serialVersionUID = 554334260950199994L;
- private static final HashSet<Class<?>> fractionalTypes = new HashSet<Class<?>>(
+ private static final HashSet<Class<?>> fractionalTypes = new HashSet<>(
Arrays.asList(
Double.class,
Float.class));
@@ -43,7 +43,7 @@ public class FractionalTypeInfo<T> extends NumericTypeInfo<T> {
protected FractionalTypeInfo(Class<T> clazz, Class<?>[] possibleCastTargetTypes, TypeSerializer<T> serializer, Class<? extends TypeComparator<T>> comparatorClass) {
super(clazz, possibleCastTargetTypes, serializer, comparatorClass);
- checkArgument(fractionalTypes.contains(clazz),
+ checkArgument(fractionalTypes.contains(clazz),
"The given class %s is not a fractional type.", clazz.getSimpleName());
}
}
http://git-wip-us.apache.org/repos/asf/flink/blob/a0ef71b7/flink-core/src/main/java/org/apache/flink/api/common/typeinfo/IntegerTypeInfo.java
----------------------------------------------------------------------
diff --git a/flink-core/src/main/java/org/apache/flink/api/common/typeinfo/IntegerTypeInfo.java b/flink-core/src/main/java/org/apache/flink/api/common/typeinfo/IntegerTypeInfo.java
index 02b416a..4ceec2b 100644
--- a/flink-core/src/main/java/org/apache/flink/api/common/typeinfo/IntegerTypeInfo.java
+++ b/flink-core/src/main/java/org/apache/flink/api/common/typeinfo/IntegerTypeInfo.java
@@ -35,7 +35,7 @@ public class IntegerTypeInfo<T> extends NumericTypeInfo<T> {
private static final long serialVersionUID = -8068827354966766955L;
- private static final HashSet<Class<?>> integerTypes = new HashSet<Class<?>>(
+ private static final HashSet<Class<?>> integerTypes = new HashSet<>(
Arrays.asList(
Integer.class,
Long.class,
http://git-wip-us.apache.org/repos/asf/flink/blob/a0ef71b7/flink-core/src/main/java/org/apache/flink/api/common/typeinfo/NothingTypeInfo.java
----------------------------------------------------------------------
diff --git a/flink-core/src/main/java/org/apache/flink/api/common/typeinfo/NothingTypeInfo.java b/flink-core/src/main/java/org/apache/flink/api/common/typeinfo/NothingTypeInfo.java
index 033a0e9..73b916f 100644
--- a/flink-core/src/main/java/org/apache/flink/api/common/typeinfo/NothingTypeInfo.java
+++ b/flink-core/src/main/java/org/apache/flink/api/common/typeinfo/NothingTypeInfo.java
@@ -18,8 +18,8 @@
package org.apache.flink.api.common.typeinfo;
-import org.apache.flink.annotation.PublicEvolving;
import org.apache.flink.annotation.Public;
+import org.apache.flink.annotation.PublicEvolving;
import org.apache.flink.api.common.ExecutionConfig;
import org.apache.flink.api.common.typeutils.TypeSerializer;
import org.apache.flink.types.Nothing;
@@ -29,9 +29,9 @@ import org.apache.flink.types.Nothing;
*/
@Public
public class NothingTypeInfo extends TypeInformation<Nothing> {
-
+
private static final long serialVersionUID = 1L;
-
+
@Override
@PublicEvolving
public boolean isBasicType() {
@@ -55,7 +55,7 @@ public class NothingTypeInfo extends TypeInformation<Nothing> {
public int getTotalFields() {
return 0;
}
-
+
@Override
@PublicEvolving
public Class<Nothing> getTypeClass() {
http://git-wip-us.apache.org/repos/asf/flink/blob/a0ef71b7/flink-core/src/main/java/org/apache/flink/api/common/typeinfo/NumericTypeInfo.java
----------------------------------------------------------------------
diff --git a/flink-core/src/main/java/org/apache/flink/api/common/typeinfo/NumericTypeInfo.java b/flink-core/src/main/java/org/apache/flink/api/common/typeinfo/NumericTypeInfo.java
index fea8abe..a553e41 100644
--- a/flink-core/src/main/java/org/apache/flink/api/common/typeinfo/NumericTypeInfo.java
+++ b/flink-core/src/main/java/org/apache/flink/api/common/typeinfo/NumericTypeInfo.java
@@ -35,7 +35,7 @@ public abstract class NumericTypeInfo<T> extends BasicTypeInfo<T> {
private static final long serialVersionUID = -5937777910658986986L;
- private static final HashSet<Class<?>> numericalTypes = new HashSet<Class<?>>(
+ private static final HashSet<Class<?>> numericalTypes = new HashSet<>(
Arrays.asList(
Integer.class,
Long.class,
@@ -49,7 +49,7 @@ public abstract class NumericTypeInfo<T> extends BasicTypeInfo<T> {
TypeComparator<T>> comparatorClass) {
super(clazz, possibleCastTargetTypes, serializer, comparatorClass);
- checkArgument(numericalTypes.contains(clazz),
+ checkArgument(numericalTypes.contains(clazz),
"The given class %s is not a numerical type", clazz.getSimpleName());
}
}
http://git-wip-us.apache.org/repos/asf/flink/blob/a0ef71b7/flink-core/src/main/java/org/apache/flink/api/common/typeinfo/PrimitiveArrayTypeInfo.java
----------------------------------------------------------------------
diff --git a/flink-core/src/main/java/org/apache/flink/api/common/typeinfo/PrimitiveArrayTypeInfo.java b/flink-core/src/main/java/org/apache/flink/api/common/typeinfo/PrimitiveArrayTypeInfo.java
index 1c6ce00..9ed817c 100644
--- a/flink-core/src/main/java/org/apache/flink/api/common/typeinfo/PrimitiveArrayTypeInfo.java
+++ b/flink-core/src/main/java/org/apache/flink/api/common/typeinfo/PrimitiveArrayTypeInfo.java
@@ -59,27 +59,29 @@ public class PrimitiveArrayTypeInfo<T> extends TypeInformation<T> implements Ato
private static final long serialVersionUID = 1L;
- public static final PrimitiveArrayTypeInfo<boolean[]> BOOLEAN_PRIMITIVE_ARRAY_TYPE_INFO = new PrimitiveArrayTypeInfo<boolean[]>(boolean[].class, BooleanPrimitiveArraySerializer.INSTANCE, BooleanPrimitiveArrayComparator.class);
- public static final PrimitiveArrayTypeInfo<byte[]> BYTE_PRIMITIVE_ARRAY_TYPE_INFO = new PrimitiveArrayTypeInfo<byte[]>(byte[].class, BytePrimitiveArraySerializer.INSTANCE, BytePrimitiveArrayComparator.class);
- public static final PrimitiveArrayTypeInfo<short[]> SHORT_PRIMITIVE_ARRAY_TYPE_INFO = new PrimitiveArrayTypeInfo<short[]>(short[].class, ShortPrimitiveArraySerializer.INSTANCE, ShortPrimitiveArrayComparator.class);
- public static final PrimitiveArrayTypeInfo<int[]> INT_PRIMITIVE_ARRAY_TYPE_INFO = new PrimitiveArrayTypeInfo<int[]>(int[].class, IntPrimitiveArraySerializer.INSTANCE, IntPrimitiveArrayComparator.class);
- public static final PrimitiveArrayTypeInfo<long[]> LONG_PRIMITIVE_ARRAY_TYPE_INFO = new PrimitiveArrayTypeInfo<long[]>(long[].class, LongPrimitiveArraySerializer.INSTANCE, LongPrimitiveArrayComparator.class);
- public static final PrimitiveArrayTypeInfo<float[]> FLOAT_PRIMITIVE_ARRAY_TYPE_INFO = new PrimitiveArrayTypeInfo<float[]>(float[].class, FloatPrimitiveArraySerializer.INSTANCE, FloatPrimitiveArrayComparator.class);
- public static final PrimitiveArrayTypeInfo<double[]> DOUBLE_PRIMITIVE_ARRAY_TYPE_INFO = new PrimitiveArrayTypeInfo<double[]>(double[].class, DoublePrimitiveArraySerializer.INSTANCE, DoublePrimitiveArrayComparator.class);
- public static final PrimitiveArrayTypeInfo<char[]> CHAR_PRIMITIVE_ARRAY_TYPE_INFO = new PrimitiveArrayTypeInfo<char[]>(char[].class, CharPrimitiveArraySerializer.INSTANCE, CharPrimitiveArrayComparator.class);
+ public static final PrimitiveArrayTypeInfo<boolean[]> BOOLEAN_PRIMITIVE_ARRAY_TYPE_INFO = new PrimitiveArrayTypeInfo<>(boolean[].class, BooleanPrimitiveArraySerializer.INSTANCE, BooleanPrimitiveArrayComparator.class);
+ public static final PrimitiveArrayTypeInfo<byte[]> BYTE_PRIMITIVE_ARRAY_TYPE_INFO = new PrimitiveArrayTypeInfo<>(byte[].class, BytePrimitiveArraySerializer.INSTANCE, BytePrimitiveArrayComparator.class);
+ public static final PrimitiveArrayTypeInfo<short[]> SHORT_PRIMITIVE_ARRAY_TYPE_INFO = new PrimitiveArrayTypeInfo<>(short[].class, ShortPrimitiveArraySerializer.INSTANCE, ShortPrimitiveArrayComparator.class);
+ public static final PrimitiveArrayTypeInfo<int[]> INT_PRIMITIVE_ARRAY_TYPE_INFO = new PrimitiveArrayTypeInfo<>(int[].class, IntPrimitiveArraySerializer.INSTANCE, IntPrimitiveArrayComparator.class);
+ public static final PrimitiveArrayTypeInfo<long[]> LONG_PRIMITIVE_ARRAY_TYPE_INFO = new PrimitiveArrayTypeInfo<>(long[].class, LongPrimitiveArraySerializer.INSTANCE, LongPrimitiveArrayComparator.class);
+ public static final PrimitiveArrayTypeInfo<float[]> FLOAT_PRIMITIVE_ARRAY_TYPE_INFO = new PrimitiveArrayTypeInfo<>(float[].class, FloatPrimitiveArraySerializer.INSTANCE, FloatPrimitiveArrayComparator.class);
+ public static final PrimitiveArrayTypeInfo<double[]> DOUBLE_PRIMITIVE_ARRAY_TYPE_INFO = new PrimitiveArrayTypeInfo<>(double[].class, DoublePrimitiveArraySerializer.INSTANCE, DoublePrimitiveArrayComparator.class);
+ public static final PrimitiveArrayTypeInfo<char[]> CHAR_PRIMITIVE_ARRAY_TYPE_INFO = new PrimitiveArrayTypeInfo<>(char[].class, CharPrimitiveArraySerializer.INSTANCE, CharPrimitiveArrayComparator.class);
+
// --------------------------------------------------------------------------------------------
-
- /** The class of the array (such as int[].class) */
+
+ /** The class of the array (such as int[].class). */
private final Class<T> arrayClass;
-
- /** The serializer for the array */
+
+ /** The serializer for the array. */
private final TypeSerializer<T> serializer;
- /** The class of the comparator for the array */
+ /** The class of the comparator for the array. */
private final Class<? extends PrimitiveArrayComparator<T, ?>> comparatorClass;
/**
- * Creates a new type info for a
+ * Creates a new type info for the primitive type array.
+ *
* @param arrayClass The class of the array (such as int[].class)
* @param serializer The serializer for the array.
* @param comparatorClass The class of the array comparator
@@ -113,7 +115,7 @@ public class PrimitiveArrayTypeInfo<T> extends TypeInformation<T> implements Ato
public int getArity() {
return 1;
}
-
+
@Override
@PublicEvolving
public int getTotalFields() {
@@ -155,7 +157,7 @@ public class PrimitiveArrayTypeInfo<T> extends TypeInformation<T> implements Ato
public TypeInformation<?> getComponentType() {
return BasicTypeInfo.getInfoFor(getComponentClass());
}
-
+
@Override
public String toString() {
return arrayClass.getComponentType().getName() + "[]";
@@ -191,7 +193,7 @@ public class PrimitiveArrayTypeInfo<T> extends TypeInformation<T> implements Ato
/**
* Tries to get the PrimitiveArrayTypeInfo for an array. Returns null, if the type is an array,
* but the component type is not a primitive type.
- *
+ *
* @param type The class of the array.
* @return The corresponding PrimitiveArrayTypeInfo, or null, if the array is not an array of primitives.
* @throws InvalidTypesException Thrown, if the given class does not represent an array.
@@ -207,8 +209,8 @@ public class PrimitiveArrayTypeInfo<T> extends TypeInformation<T> implements Ato
return (PrimitiveArrayTypeInfo<X>) TYPES.get(type);
}
- /** Static map from array class to type info */
- private static final Map<Class<?>, PrimitiveArrayTypeInfo<?>> TYPES = new HashMap<Class<?>, PrimitiveArrayTypeInfo<?>>();
+ /** Static map from array class to type info. */
+ private static final Map<Class<?>, PrimitiveArrayTypeInfo<?>> TYPES = new HashMap<>();
// initialization of the static map
static {
http://git-wip-us.apache.org/repos/asf/flink/blob/a0ef71b7/flink-core/src/main/java/org/apache/flink/api/common/typeinfo/SqlTimeTypeInfo.java
----------------------------------------------------------------------
diff --git a/flink-core/src/main/java/org/apache/flink/api/common/typeinfo/SqlTimeTypeInfo.java b/flink-core/src/main/java/org/apache/flink/api/common/typeinfo/SqlTimeTypeInfo.java
index a05227c..b455e94 100644
--- a/flink-core/src/main/java/org/apache/flink/api/common/typeinfo/SqlTimeTypeInfo.java
+++ b/flink-core/src/main/java/org/apache/flink/api/common/typeinfo/SqlTimeTypeInfo.java
@@ -18,11 +18,6 @@
package org.apache.flink.api.common.typeinfo;
-import java.lang.reflect.Constructor;
-import java.sql.Date;
-import java.sql.Time;
-import java.sql.Timestamp;
-import java.util.Objects;
import org.apache.flink.annotation.PublicEvolving;
import org.apache.flink.api.common.ExecutionConfig;
import org.apache.flink.api.common.typeutils.TypeComparator;
@@ -32,6 +27,13 @@ import org.apache.flink.api.common.typeutils.base.SqlDateSerializer;
import org.apache.flink.api.common.typeutils.base.SqlTimeSerializer;
import org.apache.flink.api.common.typeutils.base.SqlTimestampComparator;
import org.apache.flink.api.common.typeutils.base.SqlTimestampSerializer;
+
+import java.lang.reflect.Constructor;
+import java.sql.Date;
+import java.sql.Time;
+import java.sql.Timestamp;
+import java.util.Objects;
+
import static org.apache.flink.util.Preconditions.checkNotNull;
/**
http://git-wip-us.apache.org/repos/asf/flink/blob/a0ef71b7/flink-core/src/main/java/org/apache/flink/api/common/typeinfo/TypeHint.java
----------------------------------------------------------------------
diff --git a/flink-core/src/main/java/org/apache/flink/api/common/typeinfo/TypeHint.java b/flink-core/src/main/java/org/apache/flink/api/common/typeinfo/TypeHint.java
index 0f40710..7de0cbd 100644
--- a/flink-core/src/main/java/org/apache/flink/api/common/typeinfo/TypeHint.java
+++ b/flink-core/src/main/java/org/apache/flink/api/common/typeinfo/TypeHint.java
@@ -23,7 +23,7 @@ import org.apache.flink.api.java.typeutils.TypeExtractor;
/**
* A utility class for describing generic types. It can be used to obtain a type information via:
- *
+ *
* <pre>{@code
* TypeInformation<Tuple2<String, Long>> info = TypeInformation.of(new TypeHint<Tuple2<String, Long>>(){});
* }</pre>
@@ -31,13 +31,13 @@ import org.apache.flink.api.java.typeutils.TypeExtractor;
* <pre>{@code
* TypeInformation<Tuple2<String, Long>> info = new TypeHint<Tuple2<String, Long>>(){}.getTypeInfo();
* }</pre>
- *
+ *
* @param <T> The type information to hint.
*/
@Public
public abstract class TypeHint<T> {
-
- /** The type information described by the hint */
+
+ /** The type information described by the hint. */
private final TypeInformation<T> typeInfo;
/**
@@ -73,7 +73,7 @@ public abstract class TypeHint<T> {
@Override
public boolean equals(Object obj) {
- return obj == this ||
+ return obj == this ||
obj instanceof TypeHint && this.typeInfo.equals(((TypeHint<?>) obj).typeInfo);
}
http://git-wip-us.apache.org/repos/asf/flink/blob/a0ef71b7/flink-core/src/main/java/org/apache/flink/api/common/typeinfo/TypeInfo.java
----------------------------------------------------------------------
diff --git a/flink-core/src/main/java/org/apache/flink/api/common/typeinfo/TypeInfo.java b/flink-core/src/main/java/org/apache/flink/api/common/typeinfo/TypeInfo.java
index ce46827..65c4ce2 100644
--- a/flink-core/src/main/java/org/apache/flink/api/common/typeinfo/TypeInfo.java
+++ b/flink-core/src/main/java/org/apache/flink/api/common/typeinfo/TypeInfo.java
@@ -18,14 +18,15 @@
package org.apache.flink.api.common.typeinfo;
+import org.apache.flink.annotation.Public;
+import org.apache.flink.api.java.typeutils.TypeExtractor;
+
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import java.lang.reflect.Type;
-import org.apache.flink.annotation.Public;
-import org.apache.flink.api.java.typeutils.TypeExtractor;
/**
* Annotation for specifying a corresponding {@link TypeInfoFactory} that can produce
http://git-wip-us.apache.org/repos/asf/flink/blob/a0ef71b7/flink-core/src/main/java/org/apache/flink/api/common/typeinfo/TypeInfoFactory.java
----------------------------------------------------------------------
diff --git a/flink-core/src/main/java/org/apache/flink/api/common/typeinfo/TypeInfoFactory.java b/flink-core/src/main/java/org/apache/flink/api/common/typeinfo/TypeInfoFactory.java
index ea15f3a..898b05e 100644
--- a/flink-core/src/main/java/org/apache/flink/api/common/typeinfo/TypeInfoFactory.java
+++ b/flink-core/src/main/java/org/apache/flink/api/common/typeinfo/TypeInfoFactory.java
@@ -18,11 +18,12 @@
package org.apache.flink.api.common.typeinfo;
-import java.lang.reflect.Type;
-import java.util.Map;
import org.apache.flink.annotation.Public;
import org.apache.flink.api.java.typeutils.TypeExtractor;
+import java.lang.reflect.Type;
+import java.util.Map;
+
/**
* Base class for implementing a type information factory. A type information factory allows for
* plugging-in user-defined {@link TypeInformation} into the Flink type system. The factory is
http://git-wip-us.apache.org/repos/asf/flink/blob/a0ef71b7/flink-core/src/main/java/org/apache/flink/api/common/typeinfo/TypeInformation.java
----------------------------------------------------------------------
diff --git a/flink-core/src/main/java/org/apache/flink/api/common/typeinfo/TypeInformation.java b/flink-core/src/main/java/org/apache/flink/api/common/typeinfo/TypeInformation.java
index 154ceb1..25cf03f 100644
--- a/flink-core/src/main/java/org/apache/flink/api/common/typeinfo/TypeInformation.java
+++ b/flink-core/src/main/java/org/apache/flink/api/common/typeinfo/TypeInformation.java
@@ -18,9 +18,8 @@
package org.apache.flink.api.common.typeinfo;
-import java.util.Map;
-import org.apache.flink.annotation.PublicEvolving;
import org.apache.flink.annotation.Public;
+import org.apache.flink.annotation.PublicEvolving;
import org.apache.flink.api.common.ExecutionConfig;
import org.apache.flink.api.common.typeutils.TypeSerializer;
import org.apache.flink.api.java.tuple.Tuple2;
@@ -28,44 +27,46 @@ import org.apache.flink.api.java.typeutils.TypeExtractor;
import java.io.Serializable;
import java.util.Collections;
+import java.util.Map;
/**
* TypeInformation is the core class of Flink's type system. Flink requires a type information
* for all types that are used as input or return type of a user function. This type information
* class acts as the tool to generate serializers and comparators, and to perform semantic checks
- * such as whether the fields that are uses as join/grouping keys actually exist.
- * <p>
- * The type information also bridges between the programming languages object model and a
+ * such as whether the fields that are uses as join/grouping keys actually exist.
+ *
+ * <p>The type information also bridges between the programming languages object model and a
* logical flat schema. It maps fields from the types to to columns (fields) in a flat schema.
- * Not all fields from a type are mapped to a separate fields in the flat schema and
+ * Not all fields from a type are mapped to a separate fields in the flat schema and
* often, entire types are mapped to one field. It is important to notice that the schema must
* hold for all instances of a type. For that reason, elements in lists and arrays are not
* assigned to individual fields, but the lists and arrays are considered to be one field in total,
- * to account for different lengths in the arrays.
+ * to account for different lengths in the arrays.
+ *
* <ul>
* <li>Basic types are indivisible and are considered a single field.</li>
* <li>Arrays and collections are one field</li>
* <li>Tuples and case classes represent as many fields as the class has fields</li>
* </ul>
- * <p>
- * To represent this properly, each type has an <i>arity</i> (the number of fields it contains
+ *
+ * <p>To represent this properly, each type has an <i>arity</i> (the number of fields it contains
* directly), and a <i>total number of fields</i> (number of fields in the entire schema of this
* type, including nested types).
- * <p>
- * Consider the example below:
+ *
+ * <p>Consider the example below:
* <pre>{@code
* public class InnerType {
* public int id;
* public String text;
* }
- *
+ *
* public class OuterType {
* public long timestamp;
* public InnerType nestedType;
* }
* }</pre>
- *
- * The types "id", "text", and "timestamp" are basic types that take up one field. The "InnerType"
+ *
+ * <p>The types "id", "text", and "timestamp" are basic types that take up one field. The "InnerType"
* has an arity of two, and also two fields totally. The "OuterType" has an arity of two fields,
* and a total number of three fields ( it contains "id", "text", and "timestamp" through recursive flattening).
*
@@ -73,50 +74,50 @@ import java.util.Collections;
*/
@Public
public abstract class TypeInformation<T> implements Serializable {
-
+
private static final long serialVersionUID = -7742311969684489493L;
/**
* Checks if this type information represents a basic type.
* Basic types are defined in {@link BasicTypeInfo} and are primitives, their boxing types,
* Strings, Date, Void, ...
- *
+ *
* @return True, if this type information describes a basic type, false otherwise.
*/
@PublicEvolving
public abstract boolean isBasicType();
-
+
/**
* Checks if this type information represents a Tuple type.
* Tuple types are subclasses of the Java API tuples.
- *
+ *
* @return True, if this type information describes a tuple type, false otherwise.
*/
@PublicEvolving
public abstract boolean isTupleType();
-
+
/**
* Gets the arity of this type - the number of fields without nesting.
- *
+ *
* @return Gets the number of fields in this type without nesting.
*/
@PublicEvolving
public abstract int getArity();
-
+
/**
* Gets the number of logical fields in this type. This includes its nested and transitively nested
* fields, in the case of composite types. In the example below, the OuterType type has three
* fields in total.
- *
- *
- * @return The number of fields in this type, including its sub-fields (for composite types)
+ *
+ *
+ * @return The number of fields in this type, including its sub-fields (for composite types)
*/
@PublicEvolving
public abstract int getTotalFields();
-
+
/**
* Gets the class of the type represented by this type information.
- *
+ *
* @return The class of the type represented by this type information.
*/
@PublicEvolving
@@ -127,7 +128,7 @@ public abstract class TypeInformation<T> implements Serializable {
* of a generic type parameter to the type information of a subtype. This information is necessary
* in cases where type information should be deduced from an input type.
*
- * For instance, a method for a {@link Tuple2} would look like this:
+ * <p>For instance, a method for a {@link Tuple2} would look like this:
* <code>
* Map m = new HashMap();
* m.put("T0", this.getTypeAt(0));
@@ -147,7 +148,7 @@ public abstract class TypeInformation<T> implements Serializable {
/**
* Checks whether this type can be used as a key. As a bare minimum, types have
* to be hashable and comparable to be keys.
- *
+ *
* @return True, if the type can be used as a key, false otherwise.
*/
@PublicEvolving
@@ -165,7 +166,7 @@ public abstract class TypeInformation<T> implements Serializable {
/**
* Creates a serializer for the type. The serializer may use the ExecutionConfig
* for parameterization.
- *
+ *
* @param config The config used to parameterize the serializer.
* @return A serializer for this type.
*/
@@ -188,12 +189,12 @@ public abstract class TypeInformation<T> implements Serializable {
* @return true if obj can be equaled with this, otherwise false
*/
public abstract boolean canEqual(Object obj);
-
+
// ------------------------------------------------------------------------
/**
* Creates a TypeInformation for the type described by the given class.
- *
+ *
* <p>This method only works for non-generic types. For generic types, use the
* {@link #of(TypeHint)} method.
*
@@ -205,7 +206,7 @@ public abstract class TypeInformation<T> implements Serializable {
public static <T> TypeInformation<T> of(Class<T> typeClass) {
return TypeExtractor.createTypeInfo(typeClass);
}
-
+
/**
* Creates a TypeInformation for a generic type via a utility "type hint".
* This method can be used as follows:
@@ -214,10 +215,10 @@ public abstract class TypeInformation<T> implements Serializable {
* TypeInformation<Tuple2<String, Long>> info = TypeInformation.of(new TypeHint<Tuple2<String, Long>>(){});
* }
* </pre>
- *
+ *
* @param typeHint The hint for the generic type.
* @param <T> The generic type.
- *
+ *
* @return The TypeInformation object for the type described by the hint.
*/
public static <T> TypeInformation<T> of(TypeHint<T> typeHint) {
http://git-wip-us.apache.org/repos/asf/flink/blob/a0ef71b7/flink-core/src/main/java/org/apache/flink/api/common/typeinfo/Types.java
----------------------------------------------------------------------
diff --git a/flink-core/src/main/java/org/apache/flink/api/common/typeinfo/Types.java b/flink-core/src/main/java/org/apache/flink/api/common/typeinfo/Types.java
index 9259064..0140e9c 100644
--- a/flink-core/src/main/java/org/apache/flink/api/common/typeinfo/Types.java
+++ b/flink-core/src/main/java/org/apache/flink/api/common/typeinfo/Types.java
@@ -150,6 +150,8 @@ public class Types {
*/
public static final TypeInformation<Timestamp> SQL_TIMESTAMP = SqlTimeTypeInfo.TIMESTAMP;
+ //CHECKSTYLE.OFF: MethodName
+
/**
* Returns type information for {@link org.apache.flink.types.Row} with fields of the given types.
* A row itself must not be null.
@@ -161,7 +163,7 @@ public class Types {
*
* <p>The schema of rows can have up to <code>Integer.MAX_VALUE</code> fields, however, all row instances
* must strictly adhere to the schema defined by the type info.
- *
+ *
* <p>This method generates type information with fields of the given types; the fields have
* the default names (f0, f1, f2 ..).
*
@@ -446,4 +448,6 @@ public class Types {
public static <L, R> TypeInformation<Either<L, R>> EITHER(TypeInformation<L> leftType, TypeInformation<R> rightType) {
return new EitherTypeInfo<>(leftType, rightType);
}
+
+ //CHECKSTYLE.ON: MethodName
}
http://git-wip-us.apache.org/repos/asf/flink/blob/a0ef71b7/flink-core/src/test/java/org/apache/flink/api/common/typeinfo/TypeHintTest.java
----------------------------------------------------------------------
diff --git a/flink-core/src/test/java/org/apache/flink/api/common/typeinfo/TypeHintTest.java b/flink-core/src/test/java/org/apache/flink/api/common/typeinfo/TypeHintTest.java
index 60232f2..ccbd81a 100644
--- a/flink-core/src/test/java/org/apache/flink/api/common/typeinfo/TypeHintTest.java
+++ b/flink-core/src/test/java/org/apache/flink/api/common/typeinfo/TypeHintTest.java
@@ -20,31 +20,36 @@ package org.apache.flink.api.common.typeinfo;
import org.apache.flink.api.java.tuple.Tuple3;
import org.apache.flink.api.java.typeutils.TupleTypeInfo;
+
import org.junit.Test;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+/**
+ * Tests for the {@link TypeHint}.
+ */
public class TypeHintTest {
-
+
@Test
public void testTypeInfoDirect() {
-
+
// simple (non-generic case)
TypeHint<String> stringInfo1 = new TypeHint<String>(){};
TypeHint<String> stringInfo2 = new TypeHint<String>(){};
-
+
assertEquals(BasicTypeInfo.STRING_TYPE_INFO, stringInfo1.getTypeInfo());
-
+
assertTrue(stringInfo1.hashCode() == stringInfo2.hashCode());
assertTrue(stringInfo1.equals(stringInfo2));
assertTrue(stringInfo1.toString().equals(stringInfo2.toString()));
// generic case
TypeHint<Tuple3<String, Double, Boolean>> generic = new TypeHint<Tuple3<String, Double, Boolean>>(){};
-
- TypeInformation<Tuple3<String, Double, Boolean>> tupleInfo =
+
+ TypeInformation<Tuple3<String, Double, Boolean>> tupleInfo =
new TupleTypeInfo<>(BasicTypeInfo.STRING_TYPE_INFO, BasicTypeInfo.DOUBLE_TYPE_INFO, BasicTypeInfo.BOOLEAN_TYPE_INFO);
-
+
assertEquals(tupleInfo, generic.getTypeInfo());
}
@@ -52,7 +57,6 @@ public class TypeHintTest {
public void testTypeInfoOf() {
assertEquals(BasicTypeInfo.STRING_TYPE_INFO, TypeInformation.of(String.class));
assertEquals(BasicTypeInfo.STRING_TYPE_INFO, TypeInformation.of(new TypeHint<String>(){}));
-
TypeInformation<Tuple3<String, Double, Boolean>> tupleInfo =
new TupleTypeInfo<>(BasicTypeInfo.STRING_TYPE_INFO, BasicTypeInfo.DOUBLE_TYPE_INFO, BasicTypeInfo.BOOLEAN_TYPE_INFO);
http://git-wip-us.apache.org/repos/asf/flink/blob/a0ef71b7/tools/maven/suppressions-core.xml
----------------------------------------------------------------------
diff --git a/tools/maven/suppressions-core.xml b/tools/maven/suppressions-core.xml
index 83f8b72..e8ab211 100644
--- a/tools/maven/suppressions-core.xml
+++ b/tools/maven/suppressions-core.xml
@@ -80,14 +80,6 @@ under the License.
checks="AvoidStarImport|ArrayTypeStyle|Regexp"/>
<suppress
- files="(.*)api[/\\]common[/\\](typeinfo)[/\\](.*)"
- checks="NewlineAtEndOfFile|RegexpSingleline|TodoComment|RedundantImport|ImportOrder|RedundantModifier|JavadocMethod|JavadocParagraph|JavadocType|JavadocStyle|PackageName|TypeNameCheck|ConstantNameCheck|StaticVariableNameCheck|MemberNameCheck|MethodNameCheck|ParameterName|LocalFinalVariableName|LocalVariableName|LeftCurly|UpperEll|FallThrough|reliefPattern|SimplifyBooleanExpression|EmptyStatement|ModifierOrder|EmptyLineSeparator|WhitespaceAround|WhitespaceAfter|NoWhitespaceAfter|NoWhitespaceBefore|OperatorWrap|ParenPad"/>
- <!--Only additional checks for test sources. Those checks were present in the "pre-strict" checkstyle but were not applied to test sources. We do not want to suppress them for sources directory-->
- <suppress
- files="(.*)test[/\\](.*)api[/\\]common[/\\](typeinfo)[/\\](.*)"
- checks="AvoidStarImport"/>
-
- <suppress
files="(.*)api[/\\]common[/\\](cache|distributions|restartstrategy)[/\\](.*)"
checks="NewlineAtEndOfFile|RegexpSingleline|TodoComment|RedundantImport|ImportOrder|RedundantModifier|JavadocMethod|JavadocParagraph|JavadocType|JavadocStyle|PackageName|TypeNameCheck|ConstantNameCheck|StaticVariableNameCheck|MemberNameCheck|MethodNameCheck|ParameterName|LocalFinalVariableName|LocalVariableName|LeftCurly|UpperEll|FallThrough|reliefPattern|SimplifyBooleanExpression|EmptyStatement|ModifierOrder|EmptyLineSeparator|WhitespaceAround|WhitespaceAfter|NoWhitespaceAfter|NoWhitespaceBefore|OperatorWrap|ParenPad"/>