/** * Creates a new {@code ListStateDescriptor} with the given name and list element type. * * <p>If this constructor fails (because it is not possible to describe the type via a class), * consider using the {@link #ListStateDescriptor(String, TypeInformation)} constructor. * * @param name The (unique) name for the state. * @param elementTypeClass The type of the elements in the state. */ public ListStateDescriptor(String name, Class<T> elementTypeClass) { super(name, new ListTypeInfo<>(elementTypeClass), null); }
/** * Creates a new {@code ListStateDescriptor} with the given name and list element type. * * @param name The (unique) name for the state. * @param elementTypeInfo The type of the elements in the state. */ public ListStateDescriptor(String name, TypeInformation<T> elementTypeInfo) { super(name, new ListTypeInfo<>(elementTypeInfo), null); }
/** * Returns type information for a Java {@link java.util.List}. A list must not be null. Null values * in elements are not supported. * * <p>By default, lists are untyped and treated as a generic type in Flink; therefore, it is useful * to pass type information whenever a list is used. * * <p><strong>Note:</strong> Flink does not preserve the concrete {@link List} type. It converts a list into {@link ArrayList} when * copying or deserializing. * * @param elementType type information for the list's elements */ public static <E> TypeInformation<List<E>> LIST(TypeInformation<E> elementType) { return new ListTypeInfo<>(elementType); }
@Override protected ListTypeInfo<?>[] getTestData() { return new ListTypeInfo<?>[] { new ListTypeInfo<>(BasicTypeInfo.STRING_TYPE_INFO), new ListTypeInfo<>(BasicTypeInfo.BOOLEAN_TYPE_INFO), new ListTypeInfo<>(Object.class), }; } }
@Override public void open(Configuration parameters) { ValueStateDescriptor<List<Tuple2<Event, Integer>>> previousWindowDescriptor = new ValueStateDescriptor<>("eventsSeenSoFar", new ListTypeInfo<>(new TupleTypeInfo<>(TypeInformation.of(Event.class), BasicTypeInfo.INT_TYPE_INFO))); eventsSeenSoFar = getRuntimeContext().getState(previousWindowDescriptor); ValueStateDescriptor<Long> lastSequenceNumberDescriptor = new ValueStateDescriptor<>("lastSequenceNumber", BasicTypeInfo.LONG_TYPE_INFO); lastSequenceNumber = getRuntimeContext().getState(lastSequenceNumberDescriptor); }
/** * Creates a new {@code ListStateDescriptor} with the given name and list element type. * * @param name The (unique) name for the state. * @param elementTypeInfo The type of the elements in the state. */ public ListStateDescriptor(String name, TypeInformation<T> elementTypeInfo) { super(name, new ListTypeInfo<>(elementTypeInfo), null); }
/** * Creates a new {@code ListStateDescriptor} with the given name and list element type. * * <p>If this constructor fails (because it is not possible to describe the type via a class), * consider using the {@link #ListStateDescriptor(String, TypeInformation)} constructor. * * @param name The (unique) name for the state. * @param elementTypeClass The type of the elements in the state. */ public ListStateDescriptor(String name, Class<T> elementTypeClass) { super(name, new ListTypeInfo<>(elementTypeClass), null); }
/** * Creates a new {@code ListStateDescriptor} with the given name and list element type. * * @param name The (unique) name for the state. * @param elementTypeInfo The type of the elements in the state. */ public ListStateDescriptor(String name, TypeInformation<T> elementTypeInfo) { super(name, new ListTypeInfo<>(elementTypeInfo), null); }
/** * Creates a new {@code ListStateDescriptor} with the given name and list element type. * * <p>If this constructor fails (because it is not possible to describe the type via a class), * consider using the {@link #ListStateDescriptor(String, TypeInformation)} constructor. * * @param name The (unique) name for the state. * @param elementTypeClass The type of the elements in the state. */ public ListStateDescriptor(String name, Class<T> elementTypeClass) { super(name, new ListTypeInfo<>(elementTypeClass), null); }
/** * Returns type information for a Java {@link java.util.List}. A list must not be null. Null values * in elements are not supported. * * <p>By default, lists are untyped and treated as a generic type in Flink; therefore, it is useful * to pass type information whenever a list is used. * * <p><strong>Note:</strong> Flink does not preserve the concrete {@link List} type. It converts a list into {@link ArrayList} when * copying or deserializing. * * @param elementType type information for the list's elements */ public static <E> TypeInformation<List<E>> LIST(TypeInformation<E> elementType) { return new ListTypeInfo<>(elementType); }
/** * Returns type information for a Java {@link java.util.List}. A list must not be null. Null values * in elements are not supported. * * <p>By default, lists are untyped and treated as a generic type in Flink; therefore, it is useful * to pass type information whenever a list is used. * * <p><strong>Note:</strong> Flink does not preserve the concrete {@link List} type. It converts a list into {@link ArrayList} when * copying or deserializing. * * @param elementType type information for the list's elements */ public static <E> TypeInformation<List<E>> LIST(TypeInformation<E> elementType) { return new ListTypeInfo<>(elementType); }
@SuppressWarnings({ "rawtypes", "unchecked" }) public ListStateListReader(String stateName, TypeInformation<K> outKeyType, TypeInformation<V> outValueType) { super(stateName, outKeyType, outValueType, new TupleTypeInfo(Tuple2.class, outKeyType, new ListTypeInfo<>(outValueType))); }