Refine search
double lowerLimit = buf.getDouble(); double upperLimit = buf.getDouble(); int numBuckets = buf.getInt(); OutlierHandlingMode outlierHandlingMode = OutlierHandlingMode.values()[buf.get()]; long missingValueCount = buf.getLong(); double max = buf.getDouble(); double min = buf.getDouble(); int nonEmptyBuckets = buf.getInt(); long histogram[] = new long[numBuckets]; for (int i = 0; i < nonEmptyBuckets; i++) { int bucket = buf.getInt(); long bucketCount = buf.getLong(); histogram[bucket] = bucketCount;
/** * Parses a 2D WKB Point into a {x,y} coordinate array. * Returns null for any non-point or points with Z/M/etc modifiers. * @param wkb OGC WKB geometry * @return x,y coordinate array */ public static double[] parseWKBPoint(byte[] wkb) throws IllegalArgumentException { if (wkb.length != WKB_POINT_SIZE) { throw new IllegalArgumentException(String.format("Invalid WKB for Point (length %d < %d)", wkb.length, WKB_POINT_SIZE)); } final ByteBuffer reader = ByteBuffer.wrap(wkb); // Read the BOM reader.order((reader.get() != 0) ? ByteOrder.LITTLE_ENDIAN : ByteOrder.BIG_ENDIAN); int geomType = reader.getInt(); if (geomType != WKB_POINT) { // we only parse 2D points throw new IllegalArgumentException(String.format("Invalid WKB for 2D Point (wrong type %d)", geomType)); } double x = reader.getDouble(); double y = reader.getDouble(); return new double[] {x, y}; }
@Override public void readHeader( SpaceFillingCurveSettings.SettingsFromIndexHeader settings, ByteBuffer headerBytes ) { try { settings.maxLevels = headerBytes.getInt(); settings.dimensions = headerBytes.getInt(); double[] min = new double[settings.dimensions]; double[] max = new double[settings.dimensions]; for ( int i = 0; i < settings.dimensions; i++ ) { min[i] = headerBytes.getDouble(); max[i] = headerBytes.getDouble(); } settings.extents = new Envelope( min, max ); } catch ( BufferUnderflowException e ) { settings.markAsFailed( "Failed to read settings from GBPTree header: " + e.getMessage() ); } } };
public static QuantileDigest fromByteBuffer(ByteBuffer byteBuffer) { double maxError = byteBuffer.getDouble(); double alpha = byteBuffer.getDouble(); quantileDigest.min = byteBuffer.getLong(); quantileDigest.max = byteBuffer.getLong(); int numNodes = byteBuffer.getInt(); quantileDigest.totalNodeCount = numNodes; if (numNodes == 0) { int level = byteBuffer.get() & 0xFF; long bits = byteBuffer.getLong(); double weightedCount = byteBuffer.getDouble();
private static PointValue readPoint( ByteBuffer chunk, int offset ) { final int crsCode = chunk.getInt( offset ); offset += Integer.BYTES; final CoordinateReferenceSystem crs = CoordinateReferenceSystem.get( crsCode ); final double[] coordinate = new double[crs.getDimension()]; for ( int i = 0; i < coordinate.length; i++ ) { coordinate[i] = chunk.getDouble( offset ); offset += Double.BYTES; } return pointValue( crs, coordinate ); }
static TopicMetric fromBuffer(ByteBuffer buffer) throws UnknownVersionException { byte version = buffer.get(); if (version > METRIC_VERSION) { throw new UnknownVersionException("Cannot deserialize the topic metrics for version " + version + ". " + "Current version is " + METRIC_VERSION); } RawMetricType rawMetricType = RawMetricType.forId(buffer.get()); long time = buffer.getLong(); int brokerId = buffer.getInt(); int topicLength = buffer.getInt(); String topic = new String(buffer.array(), buffer.arrayOffset() + buffer.position(), topicLength, StandardCharsets.UTF_8); buffer.position(buffer.position() + topicLength); double value = buffer.getDouble(); return new TopicMetric(rawMetricType, time, brokerId, topic, value); }
static PartitionMetric fromBuffer(ByteBuffer buffer) throws UnknownVersionException { byte version = buffer.get(); if (version > METRIC_VERSION) { throw new UnknownVersionException("Cannot deserialize the topic metrics for version " + version + ". " + "Current version is " + METRIC_VERSION); } RawMetricType rawMetricType = RawMetricType.forId(buffer.get()); long time = buffer.getLong(); int brokerId = buffer.getInt(); int topicLength = buffer.getInt(); String topic = new String(buffer.array(), buffer.arrayOffset() + buffer.position(), topicLength, StandardCharsets.UTF_8); buffer.position(buffer.position() + topicLength); int partition = buffer.getInt(); double value = buffer.getDouble(); return new PartitionMetric(rawMetricType, time, brokerId, topic, partition, value); }
static BrokerMetric fromBuffer(ByteBuffer buffer) throws UnknownVersionException { byte version = buffer.get(); if (version > METRIC_VERSION) { throw new UnknownVersionException("Cannot deserialize the topic metrics for version " + version + ". " + "Current version is " + METRIC_VERSION); } RawMetricType rawMetricType = RawMetricType.forId(buffer.get()); long time = buffer.getLong(); int brokerId = buffer.getInt(); double value = buffer.getDouble(); return new BrokerMetric(rawMetricType, time, brokerId, value); }
@SuppressWarnings("WeakerAccess") public static MergingDigest fromBytes(ByteBuffer buf) { int encoding = buf.getInt(); if (encoding == Encoding.VERBOSE_ENCODING.code) { double min = buf.getDouble(); double max = buf.getDouble(); double compression = buf.getDouble(); int n = buf.getInt(); MergingDigest r = new MergingDigest(compression); r.setMinMax(min, max); r.lastUsedCell = n; for (int i = 0; i < n; i++) { r.weight[i] = buf.getDouble(); r.mean[i] = buf.getDouble(); double min = buf.getDouble(); double max = buf.getDouble(); double compression = buf.getFloat(); int n = buf.getShort();
switch (_dataSchema.getColumnDataType(colId)) { case INT: stringBuilder.append(_fixedSizeData.getInt()); break; case LONG: break; case DOUBLE: stringBuilder.append(_fixedSizeData.getDouble()); break; case STRING: stringBuilder.append(_fixedSizeData.getInt()); break; stringBuilder.append(String.format("(%s:%s)", _fixedSizeData.getInt(), _fixedSizeData.getInt())); break;
int encoding = buf.getInt(); if (encoding == VERBOSE_ENCODING) { double min = buf.getDouble(); double max = buf.getDouble(); double compression = buf.getDouble(); AVLTreeDigest r = new AVLTreeDigest(compression); r.setMinMax(min, max); int n = buf.getInt(); double[] means = new double[n]; for (int i = 0; i < n; i++) { means[i] = buf.getDouble(); r.add(means[i], buf.getInt()); double min = buf.getDouble(); double max = buf.getDouble(); double compression = buf.getDouble(); AVLTreeDigest r = new AVLTreeDigest(compression); r.setMinMax(min, max);
int encoding = buf.getInt(); if (encoding == VERBOSE_ENCODING) { double compression = buf.getDouble(); TDigest r = new TDigest(compression); int n = buf.getInt(); double[] means = new double[n]; for (int i = 0; i < n; i++) { means[i] = buf.getDouble(); r.add(means[i], buf.getInt()); double compression = buf.getDouble(); TDigest r = new TDigest(compression); int n = buf.getInt();
private static PartitionMetricSample readV0(ByteBuffer buffer) { MetricDef metricDef = KafkaMetricDef.commonMetricDef(); int brokerId = buffer.getInt(); int partition = buffer.getInt(45); String topic = new String(buffer.array(), 49, buffer.array().length - 49, UTF_8); PartitionMetricSample sample = new PartitionMetricSample(brokerId, new TopicPartition(topic, partition)); sample.record(metricDef.metricInfo(CPU_USAGE.name()), buffer.getDouble()); sample.record(metricDef.metricInfo(DISK_USAGE.name()), buffer.getDouble()); sample.record(metricDef.metricInfo(LEADER_BYTES_IN.name()), buffer.getDouble()); sample.record(metricDef.metricInfo(LEADER_BYTES_OUT.name()), buffer.getDouble()); sample.close(buffer.getLong()); return sample; }