org.apache.flink.table.api.dataview.ListView Java Examples
The following examples show how to use
org.apache.flink.table.api.dataview.ListView.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ListViewSerializer.java From flink with Apache License 2.0 | 5 votes |
/** * We need to override this as a {@link LegacySerializerSnapshotTransformer} * because in Flink 1.6.x and below, this serializer was incorrectly returning * directly the snapshot of the nested list serializer as its own snapshot. * * <p>This method transforms the incorrect list serializer snapshot * to be a proper {@link ListViewSerializerSnapshot}. */ @Override public <U> TypeSerializerSnapshot<ListView<T>> transformLegacySerializerSnapshot( TypeSerializerSnapshot<U> legacySnapshot) { if (legacySnapshot instanceof ListViewSerializerSnapshot) { return (TypeSerializerSnapshot<ListView<T>>) legacySnapshot; } else if (legacySnapshot instanceof CollectionSerializerConfigSnapshot) { // first, transform the incorrect list serializer's snapshot // into a proper ListSerializerSnapshot ListSerializerSnapshot<T> transformedNestedListSerializerSnapshot = new ListSerializerSnapshot<>(); CollectionSerializerConfigSnapshot<List<T>, T> snapshot = (CollectionSerializerConfigSnapshot<List<T>, T>) legacySnapshot; CompositeTypeSerializerUtil.setNestedSerializersSnapshots( transformedNestedListSerializerSnapshot, (TypeSerializerSnapshot<?>) (snapshot.getSingleNestedSerializerAndConfig().f1)); // then, wrap the transformed ListSerializerSnapshot // as a nested snapshot in the final resulting ListViewSerializerSnapshot ListViewSerializerSnapshot<T> transformedListViewSerializerSnapshot = new ListViewSerializerSnapshot<>(); CompositeTypeSerializerUtil.setNestedSerializersSnapshots( transformedListViewSerializerSnapshot, transformedNestedListSerializerSnapshot); return transformedListViewSerializerSnapshot; } else { throw new UnsupportedOperationException( legacySnapshot.getClass().getCanonicalName() + " is not supported."); } }
Example #2
Source File: ListViewSerializerUpgradeTest.java From flink with Apache License 2.0 | 5 votes |
public static ListView<String> mockTestData() { ListView<String> view = new ListView<>(TypeInformation.of(String.class)); try { view.add("ApacheFlink"); } catch (Exception e) { throw new RuntimeException(e); } return view; }
Example #3
Source File: ListViewSerializerUpgradeTest.java From flink with Apache License 2.0 | 5 votes |
public static ListView<String> mockTestDataWithoutTypeInfo() { ListView<String> view = new ListView<>(); try { view.add("ApacheFlink"); } catch (Exception e) { throw new RuntimeException(e); } return view; }
Example #4
Source File: ListViewTypeInfo.java From flink with Apache License 2.0 | 5 votes |
@SuppressWarnings("unchecked") @Override public TypeSerializer<ListView<T>> createSerializer(ExecutionConfig config) { if (nullSerializer) { return (TypeSerializer<ListView<T>>) (TypeSerializer<?>) new NullSerializer(); } else { TypeSerializer<T> elementSerializer = elementType.createSerializer(config); return new ListViewSerializer<>(new ListSerializer<>(elementSerializer)); } }
Example #5
Source File: ListViewTypeInfoFactory.java From flink with Apache License 2.0 | 5 votes |
@Override public TypeInformation<ListView<T>> createTypeInfo(Type t, Map<String, TypeInformation<?>> genericParameters) { TypeInformation<?> elementType = genericParameters.get("T"); if (elementType == null) { // we might can get the elementType later from the ListView constructor elementType = new GenericTypeInfo<>(Object.class); } //noinspection unchecked return new ListViewTypeInfo<>((TypeInformation<T>) elementType); }
Example #6
Source File: ListViewSerializer.java From flink with Apache License 2.0 | 5 votes |
/** * We need to override this as a {@link LegacySerializerSnapshotTransformer} * because in Flink 1.6.x and below, this serializer was incorrectly returning * directly the snapshot of the nested list serializer as its own snapshot. * * <p>This method transforms the incorrect list serializer snapshot * to be a proper {@link ListViewSerializerSnapshot}. */ @Override public <U> TypeSerializerSnapshot<ListView<T>> transformLegacySerializerSnapshot( TypeSerializerSnapshot<U> legacySnapshot) { if (legacySnapshot instanceof ListViewSerializerSnapshot) { return (TypeSerializerSnapshot<ListView<T>>) legacySnapshot; } else if (legacySnapshot instanceof CollectionSerializerConfigSnapshot) { // first, transform the incorrect list serializer's snapshot // into a proper ListSerializerSnapshot ListSerializerSnapshot<T> transformedNestedListSerializerSnapshot = new ListSerializerSnapshot<>(); CollectionSerializerConfigSnapshot<List<T>, T> snapshot = (CollectionSerializerConfigSnapshot<List<T>, T>) legacySnapshot; CompositeTypeSerializerUtil.setNestedSerializersSnapshots( transformedNestedListSerializerSnapshot, (TypeSerializerSnapshot<?>) (snapshot.getSingleNestedSerializerAndConfig().f1)); // then, wrap the transformed ListSerializerSnapshot // as a nested snapshot in the final resulting ListViewSerializerSnapshot ListViewSerializerSnapshot<T> transformedListViewSerializerSnapshot = new ListViewSerializerSnapshot<>(); CompositeTypeSerializerUtil.setNestedSerializersSnapshots( transformedListViewSerializerSnapshot, transformedNestedListSerializerSnapshot); return transformedListViewSerializerSnapshot; } else { throw new UnsupportedOperationException( legacySnapshot.getClass().getCanonicalName() + " is not supported."); } }
Example #7
Source File: ListViewTypeInfo.java From flink with Apache License 2.0 | 5 votes |
@SuppressWarnings("unchecked") @Override public TypeSerializer<ListView<T>> createSerializer(ExecutionConfig config) { if (nullSerializer) { return (TypeSerializer<ListView<T>>) (TypeSerializer<?>) NullSerializer.INSTANCE; } else { TypeSerializer<T> elementSerializer = elementType.createSerializer(config); return new ListViewSerializer<>(new ListSerializer<>(elementSerializer)); } }
Example #8
Source File: ListViewTypeInfoFactory.java From flink with Apache License 2.0 | 5 votes |
@Override public TypeInformation<ListView<T>> createTypeInfo(Type t, Map<String, TypeInformation<?>> genericParameters) { TypeInformation<?> elementType = genericParameters.get("T"); if (elementType == null) { // we might can get the elementType later from the ListView constructor elementType = new GenericTypeInfo<>(Object.class); } //noinspection unchecked return new ListViewTypeInfo<>((TypeInformation<T>) elementType); }
Example #9
Source File: ListViewSerializer.java From flink with Apache License 2.0 | 4 votes |
@Override public ListView<T> createInstance() { return new ListView<>(); }
Example #10
Source File: ListViewSerializerUpgradeTest.java From flink with Apache License 2.0 | 4 votes |
@Override public Matcher<ListView<String>> testDataMatcher() { // ListViewSerializer will not (de)serialize the TypeInformation, so we have to create // a ListView without TypeInformation for comparison return is(mockTestDataWithoutTypeInfo()); }
Example #11
Source File: ListViewSerializerUpgradeTest.java From flink with Apache License 2.0 | 4 votes |
@Override public Matcher<TypeSerializerSchemaCompatibility<ListView<String>>> schemaCompatibilityMatcher(MigrationVersion version) { return TypeSerializerMatchers.isCompatibleAsIs(); }
Example #12
Source File: JavaUserDefinedAggFunctions.java From flink with Apache License 2.0 | 4 votes |
public ListView<Long> getList() { return list; }
Example #13
Source File: JavaUserDefinedAggFunctions.java From flink with Apache License 2.0 | 4 votes |
public void setList(ListView<Long> list) { this.list = list; }
Example #14
Source File: ListViewTypeInfo.java From flink with Apache License 2.0 | 4 votes |
@SuppressWarnings("unchecked") @Override public Class<ListView<T>> getTypeClass() { return (Class<ListView<T>>) (Class<?>) ListView.class; }
Example #15
Source File: ListViewSerializer.java From flink with Apache License 2.0 | 4 votes |
@Override public TypeSerializer<ListView<T>> duplicate() { return new ListViewSerializer<>(listSerializer.duplicate()); }
Example #16
Source File: ListViewSerializerUpgradeTest.java From flink with Apache License 2.0 | 4 votes |
@Override public ListView<String> createTestData() { return mockTestData(); }
Example #17
Source File: ListViewSerializer.java From flink with Apache License 2.0 | 4 votes |
@Override public ListView<T> copy(ListView<T> from) { return new ListView<>(null, listSerializer.copy(from.list)); }
Example #18
Source File: ListViewSerializer.java From flink with Apache License 2.0 | 4 votes |
@Override public ListView<T> copy(ListView<T> from, ListView<T> reuse) { return copy(from); }
Example #19
Source File: ListViewSerializer.java From flink with Apache License 2.0 | 4 votes |
@Override public void serialize(ListView<T> record, DataOutputView target) throws IOException { listSerializer.serialize(record.list, target); }
Example #20
Source File: ListViewSerializer.java From flink with Apache License 2.0 | 4 votes |
@Override public ListView<T> deserialize(DataInputView source) throws IOException { return new ListView<>(null, listSerializer.deserialize(source)); }
Example #21
Source File: ListViewSerializer.java From flink with Apache License 2.0 | 4 votes |
@Override public ListView<T> deserialize(ListView<T> reuse, DataInputView source) throws IOException { return deserialize(source); }
Example #22
Source File: ListViewSerializer.java From flink with Apache License 2.0 | 4 votes |
@Override public TypeSerializerSnapshot<ListView<T>> snapshotConfiguration() { return new ListViewSerializerSnapshot<>(this); }
Example #23
Source File: JavaUserDefinedAggFunctions.java From flink with Apache License 2.0 | 4 votes |
public ListView<Long> getList() { return list; }
Example #24
Source File: JavaUserDefinedAggFunctions.java From flink with Apache License 2.0 | 4 votes |
public void setList(ListView<Long> list) { this.list = list; }
Example #25
Source File: ListViewSerializer.java From flink with Apache License 2.0 | 4 votes |
@Override public ListView<T> copy(ListView<T> from, ListView<T> reuse) { return copy(from); }
Example #26
Source File: JavaUserDefinedAggFunctions.java From Flink-CEPplus with Apache License 2.0 | 4 votes |
public ListView<Long> getList() { return list; }
Example #27
Source File: JavaUserDefinedAggFunctions.java From Flink-CEPplus with Apache License 2.0 | 4 votes |
public void setList(ListView<Long> list) { this.list = list; }
Example #28
Source File: ListViewSerializerSnapshotMigrationTest.java From flink with Apache License 2.0 | 4 votes |
public ListViewSerializerSnapshotMigrationTest(TestSpecification<ListView<String>> testSpecification) { super(testSpecification); }
Example #29
Source File: JavaUserDefinedAggFunctions.java From flink with Apache License 2.0 | 4 votes |
public ListView<Long> getList() { return list; }
Example #30
Source File: JavaUserDefinedAggFunctions.java From flink with Apache License 2.0 | 4 votes |
public void setList(ListView<Long> list) { this.list = list; }