Search in sources :

Example 1 with POSITIVE_INFINITY

use of java.lang.Double.POSITIVE_INFINITY in project presto by prestodb.

the class TestOutputNodeStats method testStatsForOutputNode.

@Test
public void testStatsForOutputNode() {
    PlanNodeStatsEstimate stats = PlanNodeStatsEstimate.builder().setOutputRowCount(100).addVariableStatistics(new VariableReferenceExpression(Optional.empty(), "a", BIGINT), VariableStatsEstimate.builder().setNullsFraction(0.3).setLowValue(1).setHighValue(30).setDistinctValuesCount(20).build()).addVariableStatistics(new VariableReferenceExpression(Optional.empty(), "b", DOUBLE), VariableStatsEstimate.builder().setNullsFraction(0.6).setLowValue(13.5).setHighValue(POSITIVE_INFINITY).setDistinctValuesCount(40).build()).build();
    tester().assertStatsFor(pb -> pb.output(outputBuilder -> {
        VariableReferenceExpression a = pb.variable("a", BIGINT);
        VariableReferenceExpression b = pb.variable("b", DOUBLE);
        outputBuilder.source(pb.values(a, b)).column(a, "a1").column(a, "a2").column(b, "b");
    })).withSourceStats(stats).check(outputStats -> outputStats.equalTo(stats));
}
Also used : BIGINT(com.facebook.presto.common.type.BigintType.BIGINT) POSITIVE_INFINITY(java.lang.Double.POSITIVE_INFINITY) DOUBLE(com.facebook.presto.common.type.DoubleType.DOUBLE) Optional(java.util.Optional) VariableReferenceExpression(com.facebook.presto.spi.relation.VariableReferenceExpression) Test(org.testng.annotations.Test) VariableReferenceExpression(com.facebook.presto.spi.relation.VariableReferenceExpression) Test(org.testng.annotations.Test)

Example 2 with POSITIVE_INFINITY

use of java.lang.Double.POSITIVE_INFINITY in project presto by prestodb.

the class TestSortNodeStats method testStatsForSortNode.

@Test
public void testStatsForSortNode() {
    PlanNodeStatsEstimate stats = PlanNodeStatsEstimate.builder().setOutputRowCount(100).addVariableStatistics(new VariableReferenceExpression(Optional.empty(), "a", BIGINT), VariableStatsEstimate.builder().setNullsFraction(0.3).setLowValue(1).setHighValue(30).setDistinctValuesCount(20).build()).addVariableStatistics(new VariableReferenceExpression(Optional.empty(), "b", DOUBLE), VariableStatsEstimate.builder().setNullsFraction(0.6).setLowValue(13.5).setHighValue(POSITIVE_INFINITY).setDistinctValuesCount(40).build()).build();
    tester().assertStatsFor(pb -> pb.output(outputBuilder -> {
        VariableReferenceExpression a = pb.variable("a", BIGINT);
        VariableReferenceExpression b = pb.variable("b", DOUBLE);
        outputBuilder.source(pb.values(a, b)).column(a, "a1").column(a, "a2").column(b, "b");
    })).withSourceStats(stats).check(outputStats -> outputStats.equalTo(stats));
}
Also used : BIGINT(com.facebook.presto.common.type.BigintType.BIGINT) POSITIVE_INFINITY(java.lang.Double.POSITIVE_INFINITY) DOUBLE(com.facebook.presto.common.type.DoubleType.DOUBLE) Optional(java.util.Optional) VariableReferenceExpression(com.facebook.presto.spi.relation.VariableReferenceExpression) Test(org.testng.annotations.Test) VariableReferenceExpression(com.facebook.presto.spi.relation.VariableReferenceExpression) Test(org.testng.annotations.Test)

Aggregations

BIGINT (com.facebook.presto.common.type.BigintType.BIGINT)2 DOUBLE (com.facebook.presto.common.type.DoubleType.DOUBLE)2 VariableReferenceExpression (com.facebook.presto.spi.relation.VariableReferenceExpression)2 POSITIVE_INFINITY (java.lang.Double.POSITIVE_INFINITY)2 Optional (java.util.Optional)2 Test (org.testng.annotations.Test)2