use of com.facebook.presto.tdigest.TDigest in project presto by prestodb.
the class TestTDigestFunctions method testScaleNegative.
@Test(expectedExceptions = PrestoException.class, expectedExceptionsMessageRegExp = "Scale factor should be positive\\.")
public void testScaleNegative() {
TDigest tDigest = createTDigest(STANDARD_COMPRESSION_FACTOR);
addAll(tDigest, 0.0d, 1.0d, 2.0d, 3.0d, 4.0d, 5.0d, 6.0d, 7.0d, 8.0d, 9.0d);
functionAssertions.selectSingleValue(format("scale_tdigest(CAST(X'%s' AS tdigest(double)), -1)", new SqlVarbinary(tDigest.serialize().getBytes()).toString().replaceAll("\\s+", " ")), TDIGEST_DOUBLE, SqlVarbinary.class);
}
use of com.facebook.presto.tdigest.TDigest in project presto by prestodb.
the class TestTDigestAggregationFunction method getExpectedValueDoubles.
@Override
protected Object getExpectedValueDoubles(double compression, double... values) {
if (values.length == 0) {
return null;
}
TDigest tDigest = createTDigest(compression);
Arrays.stream(values).forEach(tDigest::add);
return new SqlVarbinary(tDigest.serialize().getBytes());
}
Aggregations