com.aliyun.odps.table.optimizer.predicate.UnaryPredicate Maven / Gradle / Ivy
The newest version!
package com.aliyun.odps.table.optimizer.predicate;
import java.io.Serializable;
/**
* @author dingxin ([email protected])
*/
public class UnaryPredicate extends Predicate {
public enum Operator {
/**
* 一元运算操作符
*/
IS_NULL("is null"),
NOT_NULL("is not null");
private final String description;
Operator(String description) {
this.description = description;
}
public String getDescription() {
return description;
}
}
private final Operator operator;
private final Serializable operand;
public UnaryPredicate(Operator operator, Serializable operand) {
super(PredicateType.UNARY);
this.operator = operator;
this.operand = operand;
}
public static UnaryPredicate isNull(Serializable operand) {
return new UnaryPredicate(Operator.IS_NULL, operand);
}
public static UnaryPredicate notNull(Serializable operand) {
return new UnaryPredicate(Operator.NOT_NULL, operand);
}
public Operator getOperator() {
return operator;
}
public Object getOperand() {
return operand;
}
@Override
public String toString() {
return operand.toString() + " " + operator.getDescription();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy