Java Code Examples for org.apache.flink.core.memory.DataInputView#readShort()
The following examples show how to use
org.apache.flink.core.memory.DataInputView#readShort() .
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: OperatorBackendSerializationProxy.java From flink with Apache License 2.0 | 5 votes |
@Override public void read(DataInputView in) throws IOException { super.read(in); final int proxyReadVersion = getReadVersion(); final Integer metaInfoSnapshotVersion = META_INFO_SNAPSHOT_FORMAT_VERSION_MAPPER.get(proxyReadVersion); if (metaInfoSnapshotVersion == null) { // this should not happen; guard for the future throw new IOException("Cannot determine corresponding meta info snapshot version for operator backend serialization readVersion=" + proxyReadVersion); } final StateMetaInfoReader stateMetaInfoReader = StateMetaInfoSnapshotReadersWriters.getReader( metaInfoSnapshotVersion, StateMetaInfoSnapshotReadersWriters.StateTypeHint.OPERATOR_STATE); int numOperatorStates = in.readShort(); operatorStateMetaInfoSnapshots = new ArrayList<>(numOperatorStates); for (int i = 0; i < numOperatorStates; i++) { operatorStateMetaInfoSnapshots.add( stateMetaInfoReader.readStateMetaInfoSnapshot(in, userCodeClassLoader)); } if (proxyReadVersion >= 3) { // broadcast states did not exist prior to version 3 int numBroadcastStates = in.readShort(); broadcastStateMetaInfoSnapshots = new ArrayList<>(numBroadcastStates); for (int i = 0; i < numBroadcastStates; i++) { broadcastStateMetaInfoSnapshots.add( stateMetaInfoReader.readStateMetaInfoSnapshot(in, userCodeClassLoader)); } } else { broadcastStateMetaInfoSnapshots = new ArrayList<>(); } }
Example 2
Source File: ShortValueArray.java From flink with Apache License 2.0 | 5 votes |
@Override public void read(DataInputView in) throws IOException { position = in.readInt(); mark = 0; ensureCapacity(position); for (int i = 0; i < position; i++) { data[i] = in.readShort(); } }
Example 3
Source File: ShortComparator.java From flink with Apache License 2.0 | 5 votes |
@Override public int compareSerialized(DataInputView firstSource, DataInputView secondSource) throws IOException { short s1 = firstSource.readShort(); short s2 = secondSource.readShort(); int comp = (s1 < s2 ? -1 : (s1 == s2 ? 0 : 1)); return ascendingComparison ? comp : -comp; }
Example 4
Source File: ShortComparator.java From flink with Apache License 2.0 | 5 votes |
@Override public int compareSerialized(DataInputView firstSource, DataInputView secondSource) throws IOException { short s1 = firstSource.readShort(); short s2 = secondSource.readShort(); int comp = (s1 < s2 ? -1 : (s1 == s2 ? 0 : 1)); return ascendingComparison ? comp : -comp; }
Example 5
Source File: LocalDateSerializer.java From flink with Apache License 2.0 | 5 votes |
@Override public LocalDate deserialize(DataInputView source) throws IOException { final int year = source.readInt(); if (year == Integer.MIN_VALUE) { source.readShort(); return null; } else { return LocalDate.of(year, source.readByte(), source.readByte()); } }
Example 6
Source File: LocalDateSerializer.java From flink with Apache License 2.0 | 5 votes |
@Override public LocalDate deserialize(DataInputView source) throws IOException { final int year = source.readInt(); if (year == Integer.MIN_VALUE) { source.readShort(); return null; } else { return LocalDate.of(year, source.readByte(), source.readByte()); } }
Example 7
Source File: ShortPrimitiveArraySerializer.java From flink with Apache License 2.0 | 5 votes |
@Override public short[] deserialize(DataInputView source) throws IOException { final int len = source.readInt(); short[] array = new short[len]; for (int i = 0; i < len; i++) { array[i] = source.readShort(); } return array; }
Example 8
Source File: FlinkKafkaProducer011.java From flink with Apache License 2.0 | 5 votes |
@Override public KafkaTransactionState deserialize(DataInputView source) throws IOException { String transactionalId = null; if (source.readBoolean()) { transactionalId = source.readUTF(); } long producerId = source.readLong(); short epoch = source.readShort(); return new KafkaTransactionState(transactionalId, producerId, epoch, null); }
Example 9
Source File: FlinkKafkaProducer.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
@Override public FlinkKafkaProducer.KafkaTransactionState deserialize(DataInputView source) throws IOException { String transactionalId = null; if (source.readBoolean()) { transactionalId = source.readUTF(); } long producerId = source.readLong(); short epoch = source.readShort(); return new FlinkKafkaProducer.KafkaTransactionState(transactionalId, producerId, epoch, null); }
Example 10
Source File: OperatorBackendSerializationProxy.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
@Override public void read(DataInputView in) throws IOException { super.read(in); final int proxyReadVersion = getReadVersion(); final Integer metaInfoSnapshotVersion = META_INFO_SNAPSHOT_FORMAT_VERSION_MAPPER.get(proxyReadVersion); if (metaInfoSnapshotVersion == null) { // this should not happen; guard for the future throw new IOException("Cannot determine corresponding meta info snapshot version for operator backend serialization readVersion=" + proxyReadVersion); } final StateMetaInfoReader stateMetaInfoReader = StateMetaInfoSnapshotReadersWriters.getReader( metaInfoSnapshotVersion, StateMetaInfoSnapshotReadersWriters.StateTypeHint.OPERATOR_STATE); int numOperatorStates = in.readShort(); operatorStateMetaInfoSnapshots = new ArrayList<>(numOperatorStates); for (int i = 0; i < numOperatorStates; i++) { operatorStateMetaInfoSnapshots.add( stateMetaInfoReader.readStateMetaInfoSnapshot(in, userCodeClassLoader)); } if (proxyReadVersion >= 3) { // broadcast states did not exist prior to version 3 int numBroadcastStates = in.readShort(); broadcastStateMetaInfoSnapshots = new ArrayList<>(numBroadcastStates); for (int i = 0; i < numBroadcastStates; i++) { broadcastStateMetaInfoSnapshots.add( stateMetaInfoReader.readStateMetaInfoSnapshot(in, userCodeClassLoader)); } } else { broadcastStateMetaInfoSnapshots = new ArrayList<>(); } }
Example 11
Source File: FlinkKafkaProducer011.java From flink with Apache License 2.0 | 5 votes |
@Override public KafkaTransactionState deserialize(DataInputView source) throws IOException { String transactionalId = null; if (source.readBoolean()) { transactionalId = source.readUTF(); } long producerId = source.readLong(); short epoch = source.readShort(); return new KafkaTransactionState(transactionalId, producerId, epoch, null); }
Example 12
Source File: ShortComparator.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
@Override public int compareSerialized(DataInputView firstSource, DataInputView secondSource) throws IOException { short s1 = firstSource.readShort(); short s2 = secondSource.readShort(); int comp = (s1 < s2 ? -1 : (s1 == s2 ? 0 : 1)); return ascendingComparison ? comp : -comp; }
Example 13
Source File: ShortValueArray.java From flink with Apache License 2.0 | 5 votes |
@Override public void read(DataInputView in) throws IOException { position = in.readInt(); mark = 0; ensureCapacity(position); for (int i = 0; i < position; i++) { data[i] = in.readShort(); } }
Example 14
Source File: FlinkKafkaProducer011.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
@Override public KafkaTransactionState deserialize(DataInputView source) throws IOException { String transactionalId = null; if (source.readBoolean()) { transactionalId = source.readUTF(); } long producerId = source.readLong(); short epoch = source.readShort(); return new KafkaTransactionState(transactionalId, producerId, epoch, null); }
Example 15
Source File: ShortSerializer.java From flink with Apache License 2.0 | 4 votes |
@Override public Short deserialize(DataInputView source) throws IOException { return source.readShort(); }
Example 16
Source File: KeyedBackendSerializationProxy.java From flink with Apache License 2.0 | 4 votes |
@SuppressWarnings("unchecked") @Override public void read(DataInputView in) throws IOException { super.read(in); final int readVersion = getReadVersion(); if (readVersion >= 4) { usingKeyGroupCompression = in.readBoolean(); } else { usingKeyGroupCompression = false; } // only starting from version 3, we have the key serializer and its config snapshot written if (readVersion >= 6) { this.keySerializerSnapshot = TypeSerializerSnapshotSerializationUtil.readSerializerSnapshot( in, userCodeClassLoader, null); } else if (readVersion >= 3) { Tuple2<TypeSerializer<?>, TypeSerializerSnapshot<?>> keySerializerAndConfig = TypeSerializerSerializationUtil.readSerializersAndConfigsWithResilience(in, userCodeClassLoader).get(0); this.keySerializerSnapshot = (TypeSerializerSnapshot<K>) keySerializerAndConfig.f1; } else { this.keySerializerSnapshot = new BackwardsCompatibleSerializerSnapshot<>( TypeSerializerSerializationUtil.tryReadSerializer(in, userCodeClassLoader, true)); } this.keySerializer = null; Integer metaInfoSnapshotVersion = META_INFO_SNAPSHOT_FORMAT_VERSION_MAPPER.get(readVersion); if (metaInfoSnapshotVersion == null) { // this should not happen; guard for the future throw new IOException("Cannot determine corresponding meta info snapshot version for keyed backend serialization readVersion=" + readVersion); } final StateMetaInfoReader stateMetaInfoReader = StateMetaInfoSnapshotReadersWriters.getReader( metaInfoSnapshotVersion, StateMetaInfoSnapshotReadersWriters.StateTypeHint.KEYED_STATE); int numKvStates = in.readShort(); stateMetaInfoSnapshots = new ArrayList<>(numKvStates); for (int i = 0; i < numKvStates; i++) { StateMetaInfoSnapshot snapshot = stateMetaInfoReader.readStateMetaInfoSnapshot(in, userCodeClassLoader); stateMetaInfoSnapshots.add(snapshot); } }
Example 17
Source File: ShortValue.java From flink with Apache License 2.0 | 4 votes |
@Override public void read(DataInputView in) throws IOException { this.value = in.readShort(); }
Example 18
Source File: ShortValue.java From Flink-CEPplus with Apache License 2.0 | 4 votes |
@Override public void read(DataInputView in) throws IOException { this.value = in.readShort(); }
Example 19
Source File: ShortSerializer.java From Flink-CEPplus with Apache License 2.0 | 4 votes |
@Override public Short deserialize(DataInputView source) throws IOException { return source.readShort(); }
Example 20
Source File: ShortType.java From flink with Apache License 2.0 | 4 votes |
@Override public void read(DataInputView in) throws IOException { this.value = in.readShort(); }