use of com.hazelcast.sql.impl.plan.node.PlanNodeFieldTypeProvider.FAILING_FIELD_TYPE_PROVIDER in project hazelcast by hazelcast.
the class SlidingWindow method windowPolicyProvider.
public final FunctionEx<ExpressionEvalContext, SlidingWindowPolicy> windowPolicyProvider() {
QueryParameterMetadata parameterMetadata = ((HazelcastRelOptCluster) getCluster()).getParameterMetadata();
RexToExpressionVisitor visitor = new RexToExpressionVisitor(FAILING_FIELD_TYPE_PROVIDER, parameterMetadata);
if (operator() == HazelcastSqlOperatorTable.TUMBLE) {
Expression<?> windowSizeExpression = operand(2).accept(visitor);
return context -> tumblingWinPolicy(WindowUtils.extractMillis(windowSizeExpression, context));
} else if (operator() == HazelcastSqlOperatorTable.HOP) {
Expression<?> windowSizeExpression = operand(2).accept(visitor);
Expression<?> slideSizeExpression = operand(3).accept(visitor);
return context -> slidingWinPolicy(WindowUtils.extractMillis(windowSizeExpression, context), WindowUtils.extractMillis(slideSizeExpression, context));
} else {
throw new IllegalArgumentException();
}
}
Aggregations