Java Code Examples for org.apache.iceberg.expressions.Expressions#equal()
The following examples show how to use
org.apache.iceberg.expressions.Expressions#equal() .
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: Truncate.java From iceberg with Apache License 2.0 | 6 votes |
@Override public UnboundPredicate<CharSequence> projectStrict(String name, BoundPredicate<CharSequence> predicate) { if (predicate.term() instanceof BoundTransform) { return ProjectionUtil.projectTransformPredicate(this, name, predicate); } if (predicate instanceof BoundUnaryPredicate) { return Expressions.predicate(predicate.op(), name); } else if (predicate instanceof BoundLiteralPredicate) { BoundLiteralPredicate<CharSequence> pred = predicate.asLiteralPredicate(); if (pred.op() == Expression.Operation.STARTS_WITH) { if (pred.literal().value().length() < width()) { return Expressions.predicate(pred.op(), name, pred.literal().value()); } else if (pred.literal().value().length() == width()) { return Expressions.equal(name, pred.literal().value()); } } else { return ProjectionUtil.truncateArrayStrict(name, pred, this); } } else if (predicate.isSetPredicate() && predicate.op() == Expression.Operation.NOT_IN) { return ProjectionUtil.transformSet(name, predicate.asSetPredicate(), this); } return null; }
Example 2
Source File: IcebergStorage.java From iceberg with Apache License 2.0 | 6 votes |
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 File: IcebergFilterGenerator.java From metacat with Apache License 2.0 | 6 votes |
/** * 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); default: throw new RuntimeException("Not supported"); } }