Add test for symbol reference stats calculation
@@ -74,6 +74,24 @@ public class TestScalarStatsCalculator
.nullsFraction(1.0);
}
+ @Test
+ public void testSymbolReference()
+ {
+ SymbolStatsEstimate xStats = SymbolStatsEstimate.builder()
+ .setLowValue(-1)
+ .setHighValue(10)
+ .setDistinctValuesCount(4)
+ .setNullsFraction(0.1)
+ .setAverageRowSize(2.0)
+ .build();
+ PlanNodeStatsEstimate inputStatistics = PlanNodeStatsEstimate.builder()
+ .addSymbolStatistics(new Symbol("x"), xStats)
+ .build();
+
+ assertCalculate(expression("x"), inputStatistics).isEqualTo(xStats);
+ assertCalculate(expression("y"), inputStatistics).isEqualTo(SymbolStatsEstimate.UNKNOWN_STATS);
+ }
+
@Test
public void testCastDoubleToBigint()
{
