Java Code Examples for org.apache.flink.core.memory.DataInputView#readBoolean()
The following examples show how to use
org.apache.flink.core.memory.DataInputView#readBoolean() .
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: TwoPhaseCommitSinkFunction.java From Flink-CEPplus with Apache License 2.0 | 6 votes |
@Override public void copy( DataInputView source, DataOutputView target) throws IOException { TXN pendingTxnHandle = transactionSerializer.deserialize(source); transactionSerializer.serialize(pendingTxnHandle, target); final long pendingTxnStartTime = source.readLong(); target.writeLong(pendingTxnStartTime); int numPendingCommitTxns = source.readInt(); target.writeInt(numPendingCommitTxns); for (int i = 0; i < numPendingCommitTxns; i++) { TXN pendingCommitTxnHandle = transactionSerializer.deserialize(source); transactionSerializer.serialize(pendingCommitTxnHandle, target); final long pendingCommitTxnStartTime = source.readLong(); target.writeLong(pendingCommitTxnStartTime); } boolean hasContext = source.readBoolean(); target.writeBoolean(hasContext); if (hasContext) { CONTEXT context = contextSerializer.deserialize(source); contextSerializer.serialize(context, target); } }
Example 2
Source File: AbstractMapSerializer.java From flink with Apache License 2.0 | 6 votes |
@Override public M deserialize(DataInputView source) throws IOException { final int size = source.readInt(); final M map = createInstance(); for (int i = 0; i < size; ++i) { K key = keySerializer.deserialize(source); boolean isNull = source.readBoolean(); V value = isNull ? null : valueSerializer.deserialize(source); map.put(key, value); } return map; }
Example 3
Source File: AbstractMapSerializer.java From flink with Apache License 2.0 | 6 votes |
@Override public M deserialize(DataInputView source) throws IOException { final int size = source.readInt(); final M map = createInstance(); for (int i = 0; i < size; ++i) { K key = keySerializer.deserialize(source); boolean isNull = source.readBoolean(); V value = isNull ? null : valueSerializer.deserialize(source); map.put(key, value); } return map; }
Example 4
Source File: TwoPhaseCommitSinkFunction.java From Flink-CEPplus with Apache License 2.0 | 6 votes |
@Override public State<TXN, CONTEXT> deserialize(DataInputView source) throws IOException { TXN pendingTxnHandle = transactionSerializer.deserialize(source); final long pendingTxnStartTime = source.readLong(); final TransactionHolder<TXN> pendingTxn = new TransactionHolder<>( pendingTxnHandle, pendingTxnStartTime); int numPendingCommitTxns = source.readInt(); List<TransactionHolder<TXN>> pendingCommitTxns = new ArrayList<>(numPendingCommitTxns); for (int i = 0; i < numPendingCommitTxns; i++) { final TXN pendingCommitTxnHandle = transactionSerializer.deserialize(source); final long pendingCommitTxnStartTime = source.readLong(); pendingCommitTxns.add(new TransactionHolder<>( pendingCommitTxnHandle, pendingCommitTxnStartTime)); } Optional<CONTEXT> context = Optional.empty(); boolean hasContext = source.readBoolean(); if (hasContext) { context = Optional.of(contextSerializer.deserialize(source)); } return new State<>(pendingTxn, pendingCommitTxns, context); }
Example 5
Source File: MapSerializer.java From Flink-CEPplus with Apache License 2.0 | 6 votes |
@Override public void copy(DataInputView source, DataOutputView target) throws IOException { final int size = source.readInt(); target.writeInt(size); for (int i = 0; i < size; ++i) { keySerializer.copy(source, target); boolean isNull = source.readBoolean(); target.writeBoolean(isNull); if (!isNull) { valueSerializer.copy(source, target); } } }
Example 6
Source File: BooleanPrimitiveArraySerializer.java From flink with Apache License 2.0 | 5 votes |
@Override public boolean[] deserialize(DataInputView source) throws IOException { final int len = source.readInt(); boolean[] result = new boolean[len]; for (int i = 0; i < len; i++) { result[i] = source.readBoolean(); } return result; }
Example 7
Source File: BucketStateSerializer.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
@VisibleForTesting BucketState<BucketID> deserializeV1(DataInputView in) throws IOException { final BucketID bucketId = SimpleVersionedSerialization.readVersionAndDeSerialize(bucketIdSerializer, in); final String bucketPathStr = in.readUTF(); final long creationTime = in.readLong(); // then get the current resumable stream RecoverableWriter.ResumeRecoverable current = null; if (in.readBoolean()) { current = SimpleVersionedSerialization.readVersionAndDeSerialize(resumableSerializer, in); } final int committableVersion = in.readInt(); final int numCheckpoints = in.readInt(); final HashMap<Long, List<RecoverableWriter.CommitRecoverable>> resumablesPerCheckpoint = new HashMap<>(numCheckpoints); for (int i = 0; i < numCheckpoints; i++) { final long checkpointId = in.readLong(); final int noOfResumables = in.readInt(); final List<RecoverableWriter.CommitRecoverable> resumables = new ArrayList<>(noOfResumables); for (int j = 0; j < noOfResumables; j++) { final byte[] bytes = new byte[in.readInt()]; in.readFully(bytes); resumables.add(commitableSerializer.deserialize(committableVersion, bytes)); } resumablesPerCheckpoint.put(checkpointId, resumables); } return new BucketState<>( bucketId, new Path(bucketPathStr), creationTime, current, resumablesPerCheckpoint); }
Example 8
Source File: CompositeSerializerTest.java From flink with Apache License 2.0 | 5 votes |
@Override protected void readOuterSnapshot( int readOuterSnapshotVersion, DataInputView in, ClassLoader userCodeClassLoader) throws IOException { this.isImmutableTargetType = in.readBoolean(); }
Example 9
Source File: BooleanComparator.java From flink with Apache License 2.0 | 5 votes |
@Override public int compareSerialized(DataInputView firstSource, DataInputView secondSource) throws IOException { final int fs = firstSource.readBoolean() ? 1 : 0; final int ss = secondSource.readBoolean() ? 1 : 0; int comp = fs - ss; return ascendingComparison ? comp : -comp; }
Example 10
Source File: FlinkKafkaProducer.java From flink with Apache License 2.0 | 5 votes |
@Override public void copy( DataInputView source, DataOutputView target) throws IOException { boolean hasTransactionalId = source.readBoolean(); target.writeBoolean(hasTransactionalId); if (hasTransactionalId) { target.writeUTF(source.readUTF()); } target.writeLong(source.readLong()); target.writeShort(source.readShort()); }
Example 11
Source File: FlinkKafkaProducer.java From flink 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 12
Source File: BucketStateSerializer.java From flink with Apache License 2.0 | 5 votes |
private BucketState<BucketID> deserializeV2(DataInputView dataInputView) throws IOException { final BucketID bucketId = SimpleVersionedSerialization.readVersionAndDeSerialize(bucketIdSerializer, dataInputView); final String bucketPathStr = dataInputView.readUTF(); final long creationTime = dataInputView.readLong(); // then get the current resumable stream InProgressFileWriter.InProgressFileRecoverable current = null; if (dataInputView.readBoolean()) { current = SimpleVersionedSerialization.readVersionAndDeSerialize(inProgressFileRecoverableSerializer, dataInputView); } final int pendingFileRecoverableSerializerVersion = dataInputView.readInt(); final int numCheckpoints = dataInputView.readInt(); final HashMap<Long, List<InProgressFileWriter.PendingFileRecoverable>> pendingFileRecoverablesPerCheckpoint = new HashMap<>(numCheckpoints); for (int i = 0; i < numCheckpoints; i++) { final long checkpointId = dataInputView.readLong(); final int numOfPendingFileRecoverables = dataInputView.readInt(); final List<InProgressFileWriter.PendingFileRecoverable> pendingFileRecoverables = new ArrayList<>(numOfPendingFileRecoverables); for (int j = 0; j < numOfPendingFileRecoverables; j++) { final byte[] bytes = new byte[dataInputView.readInt()]; dataInputView.readFully(bytes); pendingFileRecoverables.add(pendingFileRecoverableSerializer.deserialize(pendingFileRecoverableSerializerVersion, bytes)); } pendingFileRecoverablesPerCheckpoint.put(checkpointId, pendingFileRecoverables); } return new BucketState<>(bucketId, new Path(bucketPathStr), creationTime, current, pendingFileRecoverablesPerCheckpoint); }
Example 13
Source File: CompositeSerializerTest.java From flink with Apache License 2.0 | 5 votes |
@Override protected void readOuterSnapshot( int readOuterSnapshotVersion, DataInputView in, ClassLoader userCodeClassLoader) throws IOException { this.isImmutableTargetType = in.readBoolean(); }
Example 14
Source File: Configuration.java From flink with Apache License 2.0 | 4 votes |
@Override public void read(DataInputView in) throws IOException { synchronized (this.confData) { final int numberOfProperties = in.readInt(); for (int i = 0; i < numberOfProperties; i++) { String key = StringValue.readString(in); Object value; byte type = in.readByte(); switch (type) { case TYPE_STRING: value = StringValue.readString(in); break; case TYPE_INT: value = in.readInt(); break; case TYPE_LONG: value = in.readLong(); break; case TYPE_FLOAT: value = in.readFloat(); break; case TYPE_DOUBLE: value = in.readDouble(); break; case TYPE_BOOLEAN: value = in.readBoolean(); break; case TYPE_BYTES: byte[] bytes = new byte[in.readInt()]; in.readFully(bytes); value = bytes; break; default: throw new IOException(String.format("Unrecognized type: %s. This method is deprecated and" + " might not work for all supported types.", type)); } this.confData.put(key, value); } } }
Example 15
Source File: BooleanValue.java From flink with Apache License 2.0 | 4 votes |
@Override public void read(DataInputView in) throws IOException { this.value = in.readBoolean(); }
Example 16
Source File: IntervalJoinOperator.java From Flink-CEPplus with Apache License 2.0 | 4 votes |
@Override public BufferEntry<T> deserialize(DataInputView source) throws IOException { boolean hasBeenJoined = source.readBoolean(); T element = elementSerializer.deserialize(source); return new BufferEntry<>(element, hasBeenJoined); }
Example 17
Source File: BooleanSerializer.java From flink with Apache License 2.0 | 4 votes |
@Override public Boolean deserialize(Boolean reuse, DataInputView source) throws IOException { return source.readBoolean(); }
Example 18
Source File: BooleanType.java From flink with Apache License 2.0 | 4 votes |
@Override public void read(DataInputView in) throws IOException { this.value = in.readBoolean(); }
Example 19
Source File: NullValue.java From Flink-CEPplus with Apache License 2.0 | 4 votes |
@Override public void read(DataInputView in) throws IOException { in.readBoolean(); }
Example 20
Source File: NullValue.java From Flink-CEPplus with Apache License 2.0 | 4 votes |
@Override public void copy(DataInputView source, DataOutputView target) throws IOException { source.readBoolean(); target.writeBoolean(false); }