Java Code Examples for org.apache.calcite.linq4j.tree.Expressions#notEqual()

The following examples show how to use org.apache.calcite.linq4j.tree.Expressions#notEqual() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RexToLixTranslator.java    From calcite with Apache License 2.0 5 votes vote down vote up
Expression checkNotNull(Expression expr) {
  if (Primitive.flavor(expr.getType())
      == Primitive.Flavor.PRIMITIVE) {
    return RexImpTable.TRUE_EXPR;
  }
  return Expressions.notEqual(expr, RexImpTable.NULL_EXPR);
}
 
Example 2
Source File: RexImpTable.java    From calcite with Apache License 2.0 4 votes vote down vote up
/** Adapts an expression with "normal" result to one that adheres to
 * this particular policy. */
public Expression handle(Expression x) {
  switch (Primitive.flavor(x.getType())) {
  case PRIMITIVE:
    // Expression cannot be null. We can skip any runtime checks.
    switch (this) {
    case NULL:
    case NOT_POSSIBLE:
    case FALSE:
    case TRUE:
      return x;
    case IS_NULL:
      return FALSE_EXPR;
    case IS_NOT_NULL:
      return TRUE_EXPR;
    default:
      throw new AssertionError();
    }
  case BOX:
    switch (this) {
    case NOT_POSSIBLE:
      return EnumUtils.convert(x,
          Primitive.ofBox(x.getType()).primitiveClass);
    }
    // fall through
  }
  switch (this) {
  case NULL:
  case NOT_POSSIBLE:
    return x;
  case FALSE:
    return Expressions.call(BuiltInMethod.IS_TRUE.method, x);
  case TRUE:
    return Expressions.call(BuiltInMethod.IS_NOT_FALSE.method, x);
  case IS_NULL:
    return Expressions.equal(x, NULL_EXPR);
  case IS_NOT_NULL:
    return Expressions.notEqual(x, NULL_EXPR);
  default:
    throw new AssertionError();
  }
}
 
Example 3
Source File: RexImpTable.java    From calcite with Apache License 2.0 4 votes vote down vote up
@Override Expression implementSafe(final RexToLixTranslator translator,
    final RexCall call, final List<Expression> argValueList) {
  return Expressions.notEqual(argValueList.get(0), FALSE_EXPR);
}
 
Example 4
Source File: RexImpTable.java    From calcite with Apache License 2.0 4 votes vote down vote up
@Override Expression implementSafe(final RexToLixTranslator translator,
    final RexCall call, final List<Expression> argValueList) {
  return Expressions.notEqual(argValueList.get(0), NULL_EXPR);
}
 
Example 5
Source File: RexImpTable.java    From calcite with Apache License 2.0 4 votes vote down vote up
@Override Expression implementSafe(final RexToLixTranslator translator,
    final RexCall call, final List<Expression> argValueList) {
  return Expressions.notEqual(argValueList.get(0), TRUE_EXPR);
}