Java Code Examples for org.apache.iceberg.expressions.Expressions#greaterThanOrEqual()

The following examples show how to use org.apache.iceberg.expressions.Expressions#greaterThanOrEqual() . These examples are extracted from open source projects. 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 Project: iceberg   File:    License: Apache License 2.0 6 votes vote down vote up
public void testUnpartitionedResiduals() {
  Expression[] expressions = new Expression[] {
      Expressions.lessThan("a", 5),
      Expressions.greaterThanOrEqual("b", 16),
      Expressions.isNull("d"),"e", 1, 2, 3),
      Expressions.notIn("f", 1, 2, 3)

  for (Expression expr : expressions) {
    ResidualEvaluator residualEvaluator = ResidualEvaluator.of(PartitionSpec.unpartitioned(), expr, true);
    Assert.assertEquals("Should return expression",
        expr, residualEvaluator.residualFor(Row.of()));
Example 2
Source Project: iceberg   File:    License: Apache License 2.0 6 votes vote down vote up
private org.apache.iceberg.expressions.Expression convert(OpType op, Column col, Const constant) {
  String name = col.getName();
  Object value = constant.getValue();

  switch (op) {
    case OP_GE: return Expressions.greaterThanOrEqual(name, value);
    case OP_GT: return Expressions.greaterThan(name, value);
    case OP_LE: return Expressions.lessThanOrEqual(name, value);
    case OP_LT: return Expressions.lessThan(name, value);
    case OP_EQ: return Expressions.equal(name, value);
    case OP_NE: return Expressions.notEqual(name, value);

  throw new RuntimeException(
      String.format("[%s]: Failed to pushdown expression: %s %s %s", signature, col, op, constant));
Example 3
Source Project: metacat   File:    License: Apache License 2.0 6 votes vote down vote up
 * Based on filter create iceberg expression.
 * @param lhs        left hand string
 * @param rhs        right hand string
 * @param comparison comparing operator
 * @return iceberg expression
private Expression createIcebergExpression(final Object lhs,
                                           final Object rhs,
                                           final Compare comparison) {
    final Pair<String, Object> keyValue = getExpressionKeyValue(lhs, rhs);
    final String key = keyValue.getLeft();
    final Object value = keyValue.getRight();
    switch (comparison) {
        case EQ:
            return Expressions.equal(key, value);
        case LTE:
            return Expressions.lessThanOrEqual(key, value);
        case GTE:
            return Expressions.greaterThanOrEqual(key, value);
        case GT:
            return Expressions.greaterThan(key, value);
        case LT:
            return Expressions.lessThan(key, value);
        case NEQ:
            return Expressions.notEqual(key, value);
            throw new RuntimeException("Not supported");