@Override public KeyPart newKeyPart(KeyPart childPart) { return udfFunction.newKeyPart(childPart); }
@Override public <T> T accept(ExpressionVisitor<T> visitor) { return udfFunction.accept(visitor); }
@Override public <T> T accept(ExpressionVisitor<T> visitor) { List<T> l = acceptChildren(visitor, visitor.visitEnter(this)); T t = visitor.visitLeave(this, l); if (t == null) { t = visitor.defaultReturn(this, l); } return t; }
@Override public Iterator<Expression> visitEnter(ScalarFunction node) { return node.preservesOrder() == OrderPreserving.NO ? Collections.<Expression> emptyIterator() : Iterators .singletonIterator(node.getChildren().get(node.getKeyFormationTraversalIndex())); }
@Override public Expression visitLeave(ScalarFunction node, List<Expression> l) { return isCloneNode(node, l) || !node.isThreadSafe() ? node.clone(l) : node; }
@Override public Iterator<Expression> visitEnter(ScalarFunction node) { int index = node.getKeyFormationTraversalIndex(); if (index < 0) { return Collections.emptyIterator(); } return Iterators.singletonIterator(node.getChildren().get(index)); }
private KeySlots newScalarFunctionKeyPart(KeySlot slot, ScalarFunction node) { if (isDegenerate(slot.getKeyRanges())) { return EMPTY_KEY_SLOTS; } KeyPart part = node.newKeyPart(slot.getKeyPart()); if (part == null) { return null; } // Scalar function always returns primitive and never a row value constructor, so span is always 1 return new SingleKeySlot(part, slot.getPKPosition(), slot.getKeyRanges(), node.preservesOrder()); }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (!(obj instanceof UDFExpression)) { return false; } UDFExpression that = (UDFExpression) obj; if (!this.udfFunction.getName().equals(that.udfFunction.getName())) { return false; } if (!this.udfFunction.getChildren().equals( that.udfFunction.getChildren())) { return false; } if (!functionClassName.equals(that.functionClassName)) { return false; } if (!jarPath.equals(that.jarPath)) { return false; } return true; } }
switch (op) { case EQUAL: lowerRange = evaluateExpression(rhs); upperRange = ByteUtil.nextKey(lowerRange); break; case GREATER: lowerRange = ByteUtil.nextKey(evaluateExpression(rhs)); break; case LESS_OR_EQUAL: upperRange = ByteUtil.nextKey(evaluateExpression(rhs)); lowerInclusive = false; break;
@Override public boolean equals(Object obj) { return super.equals(obj) && (hasSeed || random.equals(((RandomFunction)obj).random)); }
/** * Retrieve the literal value at childIndex. The argument must be a constant * (i.e. marked as isConstant=true) */ protected final <T> T getLiteralValue(int childIndex, Class<T> type) { Expression expression = getChildren().get(childIndex); // It's safe to assume expression is a LiteralExpression since // only arguments marked as isConstant = true should be handled through // this method. return type.cast(((LiteralExpression) expression).getValue()); }
@Override public boolean evaluate(Tuple tuple, ImmutableBytesWritable ptr) { return udfFunction.evaluate(tuple, ptr); }
@Override public PDataType getDataType() { return udfFunction.getDataType(); }
@Override public int getKeyFormationTraversalIndex() { return udfFunction.getKeyFormationTraversalIndex(); }
@Override public Iterator<Expression> visitEnter(ScalarFunction node) { return node.preservesOrder() == OrderPreserving.NO ? Collections.<Expression> emptyIterator() : Iterators .singletonIterator(node.getChildren().get(node.getKeyFormationTraversalIndex())); }
private KeySlots newScalarFunctionKeyPart(KeySlot slot, ScalarFunction node) { if (isDegenerate(slot.getKeyRanges())) { return EMPTY_KEY_SLOTS; } KeyPart part = node.newKeyPart(slot.getKeyPart()); if (part == null) { return null; } // Scalar function always returns primitive and never a row value constructor, so span is always 1 return new SingleKeySlot(part, slot.getPKPosition(), slot.getKeyRanges(), node.preservesOrder()); }
@Override public Iterator<Expression> visitEnter(ScalarFunction node) { int index = node.getKeyFormationTraversalIndex(); if (index < 0) { return Collections.emptyIterator(); } return Iterators.singletonIterator(node.getChildren().get(index)); }
@Override public Expression visitLeave(ScalarFunction node, List<Expression> l) { return isCloneNode(node, l) || !node.isThreadSafe() ? node.clone(l) : node; }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (!(obj instanceof UDFExpression)) { return false; } UDFExpression that = (UDFExpression) obj; if (!this.udfFunction.getName().equals(that.udfFunction.getName())) { return false; } if (!this.udfFunction.getChildren().equals( that.udfFunction.getChildren())) { return false; } if (!functionClassName.equals(that.functionClassName)) { return false; } if (!jarPath.equals(that.jarPath)) { return false; } return true; } }
lowerInclusive = false; case EQUAL: upperRange = evaluateExpression(rhs); if (op == CompareOp.EQUAL) { lowerRange = upperRange;