use of io.prestosql.spi.plan.WindowNode in project hetu-core by openlookeng.
the class TestTypeValidator method testInvalidWindowFunctionSignature.
@Test(expectedExceptions = IllegalArgumentException.class, expectedExceptionsMessageRegExp = "type of symbol 'sum(_[0-9]+)?' is expected to be double, but the actual type is bigint")
public void testInvalidWindowFunctionSignature() {
Symbol windowSymbol = planSymbolAllocator.newSymbol("sum", DOUBLE);
// should be DOUBLE
FunctionHandle functionHandle = FUNCTION_MANAGER.lookupFunction("sum", fromTypes(BIGINT));
WindowNode.Frame frame = new WindowNode.Frame(WindowFrameType.RANGE, FrameBoundType.UNBOUNDED_PRECEDING, Optional.empty(), FrameBoundType.UNBOUNDED_FOLLOWING, Optional.empty(), Optional.empty(), Optional.empty());
WindowNode.Function function = new WindowNode.Function(call("sum", functionHandle, BIGINT, ImmutableList.of(VariableReferenceSymbolConverter.toVariableReference(columnC, DOUBLE))), ImmutableList.of(VariableReferenceSymbolConverter.toVariableReference(columnC, DOUBLE)), frame);
WindowNode.Specification specification = new WindowNode.Specification(ImmutableList.of(), Optional.empty());
PlanNode node = new WindowNode(newId(), baseTableScan, specification, ImmutableMap.of(windowSymbol, function), Optional.empty(), ImmutableSet.of(), 0);
assertTypesValid(node);
}
Aggregations