Search in sources :

Example 1 with OperandChecker

use of com.hazelcast.jet.sql.impl.validate.operand.OperandChecker in project hazelcast by hazelcast.

the class HazelcastSqlOperandMetadata method checkOperandTypes.

@Override
public final boolean checkOperandTypes(SqlCallBinding callBinding, boolean throwOnFailure) {
    HazelcastCallBinding binding = prepareBinding(callBinding, operandTypeInference);
    boolean checkResult;
    if (ValidationUtil.hasAssignment(binding.getCall())) {
        OperandChecker[] checkers = parameters.stream().map(HazelcastTableFunctionParameter::checker).toArray(OperandChecker[]::new);
        checkResult = new NamedOperandCheckerProgram(checkers).check(binding, throwOnFailure);
    } else {
        OperandChecker[] checkers = parameters.stream().limit(binding.getOperandCount()).map(HazelcastTableFunctionParameter::checker).toArray(OperandChecker[]::new);
        checkResult = new OperandCheckerProgram(checkers).check(binding, throwOnFailure);
    }
    return checkResult && checkOperandTypes(binding, throwOnFailure);
}
Also used : NamedOperandCheckerProgram(com.hazelcast.jet.sql.impl.validate.operand.NamedOperandCheckerProgram) OperandChecker(com.hazelcast.jet.sql.impl.validate.operand.OperandChecker) OperandCheckerProgram(com.hazelcast.jet.sql.impl.validate.operand.OperandCheckerProgram) NamedOperandCheckerProgram(com.hazelcast.jet.sql.impl.validate.operand.NamedOperandCheckerProgram) HazelcastCallBinding(com.hazelcast.jet.sql.impl.validate.HazelcastCallBinding)

Example 2 with OperandChecker

use of com.hazelcast.jet.sql.impl.validate.operand.OperandChecker in project hazelcast by hazelcast.

the class HazelcastAndOrPredicate method checkOperandTypes.

@Override
public boolean checkOperandTypes(HazelcastCallBinding binding, boolean throwOnFailure) {
    OperandChecker[] checkers = new OperandChecker[binding.getOperandCount()];
    Arrays.fill(checkers, TypedOperandChecker.BOOLEAN);
    return new OperandCheckerProgram(checkers).check(binding, throwOnFailure);
}
Also used : OperandChecker(com.hazelcast.jet.sql.impl.validate.operand.OperandChecker) TypedOperandChecker(com.hazelcast.jet.sql.impl.validate.operand.TypedOperandChecker) OperandCheckerProgram(com.hazelcast.jet.sql.impl.validate.operand.OperandCheckerProgram)

Aggregations

OperandChecker (com.hazelcast.jet.sql.impl.validate.operand.OperandChecker)2 OperandCheckerProgram (com.hazelcast.jet.sql.impl.validate.operand.OperandCheckerProgram)2 HazelcastCallBinding (com.hazelcast.jet.sql.impl.validate.HazelcastCallBinding)1 NamedOperandCheckerProgram (com.hazelcast.jet.sql.impl.validate.operand.NamedOperandCheckerProgram)1 TypedOperandChecker (com.hazelcast.jet.sql.impl.validate.operand.TypedOperandChecker)1