Java Code Examples for org.apache.flink.core.memory.DataInputView#readLong()

The following examples show how to use org.apache.flink.core.memory.DataInputView#readLong() . 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 with Apache License 2.0 6 votes vote down vote up
@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 2
Source File: MetricDumpSerialization.java    From flink with Apache License 2.0 6 votes vote down vote up
private static MetricDump.HistogramDump deserializeHistogram(DataInputView dis) throws IOException {
	QueryScopeInfo info = deserializeMetricInfo(dis);
	String name = dis.readUTF();
	long min = dis.readLong();
	long max = dis.readLong();
	double mean = dis.readDouble();
	double median = dis.readDouble();
	double stddev = dis.readDouble();
	double p75 = dis.readDouble();
	double p90 = dis.readDouble();
	double p95 = dis.readDouble();
	double p98 = dis.readDouble();
	double p99 = dis.readDouble();
	double p999 = dis.readDouble();

	return new MetricDump.HistogramDump(info, name, min, max, mean, median, stddev, p75, p90, p95, p98, p99, p999);
}
 
Example 3
Source File: FlinkKafkaProducer011.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
@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 4
Source File: SqlTimeSerializer.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public Time deserialize(Time reuse, DataInputView source) throws IOException {
	final long v = source.readLong();
	if (v == Long.MIN_VALUE) {
		return null;
	}
	reuse.setTime(v);
	return reuse;
}
 
Example 5
Source File: TimestampDataSerializer.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public TimestampData deserialize(DataInputView source) throws IOException {
	if (TimestampData.isCompact(precision)) {
		long val = source.readLong();
		return TimestampData.fromEpochMillis(val);
	} else {
		long longVal = source.readLong();
		int intVal = source.readInt();
		return TimestampData.fromEpochMillis(longVal, intVal);
	}
}
 
Example 6
Source File: DateSerializer.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public Date deserialize(DataInputView source) throws IOException {
	final long v = source.readLong();
	if (v == Long.MIN_VALUE) {
		return null;
	} else {
		return new Date(v);
	}
}
 
Example 7
Source File: DanglingPageRankITCase.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public void read(DataInputView in) throws IOException {
	diff = in.readDouble();
	rank = in.readDouble();
	danglingRank = in.readDouble();
	numDanglingVertices = in.readLong();
	numVertices = in.readLong();
	edges = in.readLong();
}
 
Example 8
Source File: SqlTimestampSerializer.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public Timestamp deserialize(Timestamp reuse, DataInputView source) throws IOException {
	final long v = source.readLong();
	if (v == Long.MIN_VALUE) {
		return null;
	}
	reuse.setTime(v);
	reuse.setNanos(source.readInt());
	return reuse;
}
 
Example 9
Source File: LongValueArray.java    From flink with Apache License 2.0 5 votes vote down vote up
@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.readLong();
	}
}
 
Example 10
Source File: FlinkKafkaProducer011.java    From flink with Apache License 2.0 5 votes vote down vote up
@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 11
Source File: SqlDateSerializer.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public Date deserialize(Date reuse, DataInputView source) throws IOException {
	final long v = source.readLong();
	if (v == Long.MIN_VALUE) {
		return null;
	}
	reuse.setTime(v);
	return reuse;
}
 
Example 12
Source File: LongPrimitiveArraySerializer.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public long[] deserialize(DataInputView source) throws IOException {
	final int len = source.readInt();
	long[] array = new long[len];
	
	for (int i = 0; i < len; i++) {
		array[i] = source.readLong();
	}
	
	return array;
}
 
Example 13
Source File: LongType.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
@Override
public void read(DataInputView in) throws IOException {
	this.value = in.readLong();
}
 
Example 14
Source File: InstantiationUtilTest.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
public void read(DataInputView in) throws IOException {
	this.aInt = in.readInt();
	this.aLong = in.readLong();
}
 
Example 15
Source File: FlinkKafkaProducer011.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
public NextTransactionalIdHint deserialize(DataInputView source) throws IOException {
	long nextFreeTransactionalId = source.readLong();
	int lastParallelism = source.readInt();
	return new NextTransactionalIdHint(lastParallelism, nextFreeTransactionalId);
}
 
Example 16
Source File: LongType.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
public void read(DataInputView in) throws IOException {
	this.value = in.readLong();
}
 
Example 17
Source File: CustomSerializationITCase.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
@Override
public void read(DataInputView in) throws IOException {
	// read 8 bytes
	in.readLong();
}
 
Example 18
Source File: MetricDumpSerialization.java    From flink with Apache License 2.0 4 votes vote down vote up
private static MetricDump.CounterDump deserializeCounter(DataInputView dis) throws IOException {
	QueryScopeInfo scope = deserializeMetricInfo(dis);
	String name = dis.readUTF();
	long count = dis.readLong();
	return new MetricDump.CounterDump(scope, name, count);
}
 
Example 19
Source File: BlockInfo.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
@Override
public void read(DataInputView in) throws IOException {
	this.recordCount = in.readLong();
	this.accumulatedRecordCount = in.readLong();
	this.firstRecordStart = in.readLong();
}
 
Example 20
Source File: FromElementsFunctionTest.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
public void read(DataInputView in) throws IOException {
	in.readLong();
}