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

The following examples show how to use org.apache.flink.core.memory.DataInputView#readDouble() . 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: 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 2
Source File: CoordVector.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
@Override
public void read(DataInputView in) throws IOException {
	int length = in.readInt();
	this.coordinates = new double[length];
	for (int i = 0; i < length; i++) {
		this.coordinates[i] = in.readDouble();
	}
}
 
Example 3
Source File: DoubleValueArray.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.readDouble();
	}
}
 
Example 4
Source File: CoordVector.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public void read(DataInputView in) throws IOException {
	int length = in.readInt();
	this.coordinates = new double[length];
	for (int i = 0; i < length; i++) {
		this.coordinates[i] = in.readDouble();
	}
}
 
Example 5
Source File: DoubleComparator.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override 
public int compareSerialized(DataInputView firstSource, DataInputView secondSource) throws IOException {
	double l1 = firstSource.readDouble(); 
	double l2 = secondSource.readDouble(); 
	int comp = (l1 < l2 ? -1 : (l1 > l2 ? 1 : 0)); 
	return ascendingComparison ? comp : -comp; 
}
 
Example 6
Source File: DoublePrimitiveArraySerializer.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public double[] deserialize(DataInputView source) throws IOException {
	final int len = source.readInt();
	double[] result = new double[len];
	
	for (int i = 0; i < len; i++) {
		result[i] = source.readDouble();
	}
	
	return result;
}
 
Example 7
Source File: DoubleValueArray.java    From Flink-CEPplus 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.readDouble();
	}
}
 
Example 8
Source File: DoubleValueArray.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.readDouble();
	}
}
 
Example 9
Source File: DoubleComparator.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
@Override 
public int compareSerialized(DataInputView firstSource, DataInputView secondSource) throws IOException {
	double l1 = firstSource.readDouble(); 
	double l2 = secondSource.readDouble(); 
	int comp = (l1 < l2 ? -1 : (l1 > l2 ? 1 : 0)); 
	return ascendingComparison ? comp : -comp; 
}
 
Example 10
Source File: DoublePrimitiveArraySerializer.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
@Override
public double[] deserialize(DataInputView source) throws IOException {
	final int len = source.readInt();
	double[] result = new double[len];
	
	for (int i = 0; i < len; i++) {
		result[i] = source.readDouble();
	}
	
	return result;
}
 
Example 11
Source File: DanglingPageRankITCase.java    From Flink-CEPplus 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 12
Source File: DoubleType.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.readDouble();
}
 
Example 13
Source File: TestTaskEvent.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
public void read(DataInputView in) throws IOException {
	val0 = in.readDouble();
	val1 = in.readLong();
}
 
Example 14
Source File: Configuration.java    From flink with Apache License 2.0 4 votes vote down vote up
@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: DoubleSerializer.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
@Override
public Double deserialize(DataInputView source) throws IOException {
	return source.readDouble();
}
 
Example 16
Source File: MetricDumpSerialization.java    From flink with Apache License 2.0 4 votes vote down vote up
private static MetricDump.MeterDump deserializeMeter(DataInputView dis) throws IOException {
	QueryScopeInfo info = deserializeMetricInfo(dis);
	String name = dis.readUTF();
	double rate = dis.readDouble();
	return new MetricDump.MeterDump(info, name, rate);
}
 
Example 17
Source File: DoubleValue.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.readDouble();
}
 
Example 18
Source File: DoubleSerializer.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
public Double deserialize(DataInputView source) throws IOException {
	return source.readDouble();
}
 
Example 19
Source File: Configuration.java    From flink with Apache License 2.0 4 votes vote down vote up
@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("Unrecognized type: " + type);
			}

			this.confData.put(key, value);
		}
	}
}
 
Example 20
Source File: DoubleType.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.readDouble();
}