All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.delta.standalone.expressions.Or Maven / Gradle / Ivy

The newest version!
package io.delta.standalone.expressions;

import io.delta.standalone.types.BooleanType;
import io.delta.standalone.internal.exception.DeltaErrors;

/**
 * Evaluates logical {@code expr1} OR {@code expr2} for {@code new Or(expr1, expr2)}.
 * 

* Requires both left and right input expressions evaluate to booleans. */ public final class Or extends BinaryOperator implements Predicate { public Or(Expression left, Expression right) { super(left, right, "||"); if (!(left.dataType() instanceof BooleanType) || !(right.dataType() instanceof BooleanType)) { throw DeltaErrors.illegalExpressionValueType( "OR", "bool", left.dataType().getTypeName(), right.dataType().getTypeName()); } } @Override public Object nullSafeEval(Object leftResult, Object rightResult) { return (boolean) leftResult || (boolean) rightResult; } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy