@API(value=MAINTAINED) public class ThenKeyExpression extends BaseKeyExpression implements KeyExpressionWithChildren
Key.Evaluated
elements returned by evaluate
and
then combine the keys within each member of the cross-product. If this is evaluated on the
null
record, then it returns the concatenation of each of its children evaluated
against the null
record.BaseKeyExpression.IllegalSubKeyException, BaseKeyExpression.UnsplittableKeyExpressionException
KeyExpression.DeserializationException, KeyExpression.FanType, KeyExpression.InvalidExpressionException, KeyExpression.InvalidResultException, KeyExpression.NoSuchArgumentException, KeyExpression.SerializationException
Constructor and Description |
---|
ThenKeyExpression(KeyExpression first,
KeyExpression second,
KeyExpression... rest) |
ThenKeyExpression(List<KeyExpression> exprs) |
ThenKeyExpression(List<KeyExpression> exprs,
int startIdx,
int endIdx) |
ThenKeyExpression(RecordMetaDataProto.Then then) |
Modifier and Type | Method and Description |
---|---|
boolean |
createsDuplicates()
This states whether the given expression type is capable of evaluating more to more than
one value when applied to a single record.
|
boolean |
createsDuplicatesAfter(int index) |
boolean |
equals(Object o) |
<M extends Message> |
evaluateMessage(FDBRecord<M> record,
Message message)
Evaluate this expression against a record or a Protobuf message.
|
List<KeyExpression> |
getChildren() |
List<ExpressionRef<KeyExpression>> |
getChildrenRefs() |
int |
getColumnSize()
Returns the number of items in each KeyValue that will be returned.
|
Iterator<? extends ExpressionRef<? extends PlannerExpression>> |
getPlannerExpressionChildren()
Return an iterator of references to the children of this planner expression.
|
KeyExpression |
getSubKeyImpl(int start,
int end) |
GroupingKeyExpression |
group(int count) |
GroupingKeyExpression |
groupBy(KeyExpression groupByFirst,
KeyExpression... groupByRest) |
int |
hashCode() |
boolean |
hasRecordTypeKey()
Check whether a key expression uses record type key in some way.
|
List<KeyExpression> |
normalizeKeyForPositions()
Get key in normalized form for comparing field-by-field.
|
int |
planHash()
Return a hash similar to
hashCode , but with the additional guarantee that is is stable across JVMs. |
RecordMetaDataProto.KeyExpression |
toKeyExpression() |
RecordMetaDataProto.Then |
toProto() |
String |
toString() |
GroupingKeyExpression |
ungrouped()
Get this entire concatenation as a group without any grouping keys.
|
List<Descriptors.FieldDescriptor> |
validate(Descriptors.Descriptor descriptor)
Validate this expression against a given record type descriptor.
|
int |
versionColumns()
Returns the number of version columns produced by this key expression.
|
getSubKey, isPrefixKey
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
evaluate, evaluateSingleton, fromProto, getSubKey, hasProperInterfaces, isPrefixKey
iterablePlanHash, objectPlanHash, objectsPlanHash, planHash, planHash
acceptPropertyVisitor, bindTo
public ThenKeyExpression(@Nonnull List<KeyExpression> exprs)
public ThenKeyExpression(@Nonnull List<KeyExpression> exprs, int startIdx, int endIdx)
public ThenKeyExpression(@Nonnull KeyExpression first, @Nonnull KeyExpression second, @Nonnull KeyExpression... rest)
public ThenKeyExpression(@Nonnull RecordMetaDataProto.Then then) throws KeyExpression.DeserializationException
@Nonnull public <M extends Message> List<Key.Evaluated> evaluateMessage(@Nullable FDBRecord<M> record, @Nullable Message message)
KeyExpression
evaluateMessage
.
Under ordinary circumstances, if record
is null
, then message
will be null
.
Otherwise, message
will be record.getRecord()
or some submessage of that, possibly null
if
the corresponding field is missing.evaluateMessage
in interface KeyExpression
M
- the type of recordrecord
- the recordmessage
- the Protobuf message to evaluate againstKeyExpression.evaluate(com.apple.foundationdb.record.provider.foundationdb.FDBRecord<M>)
public boolean createsDuplicates()
KeyExpression
FanType.FanOut
set (either directly
or indirectly).createsDuplicates
in interface KeyExpression
true
if this expression can evaluate to multiple values and false
otherwisepublic boolean createsDuplicatesAfter(int index)
public List<Descriptors.FieldDescriptor> validate(@Nonnull Descriptors.Descriptor descriptor)
KeyExpression
validate
in interface KeyExpression
descriptor
- the descriptor for the record type or submessagepublic int getColumnSize()
KeyExpression
KeyExpression.FanType.Concatenate
, this will the count of non-nested lists, i.e. this will be value of
evaluate(r).get(i).toList().size() for any i or r.getColumnSize
in interface KeyExpression
@Nonnull public GroupingKeyExpression ungrouped()
@Nonnull public GroupingKeyExpression groupBy(@Nonnull KeyExpression groupByFirst, @Nonnull KeyExpression... groupByRest)
@Nonnull public GroupingKeyExpression group(int count)
@Nonnull public RecordMetaDataProto.Then toProto() throws KeyExpression.SerializationException
toProto
in interface KeyExpression
KeyExpression.SerializationException
@Nonnull public RecordMetaDataProto.KeyExpression toKeyExpression()
toKeyExpression
in interface KeyExpression
@Nonnull public List<KeyExpression> normalizeKeyForPositions()
KeyExpression
normalizeKeyForPositions
in interface KeyExpression
public int versionColumns()
KeyExpression
versionColumns
in interface KeyExpression
public boolean hasRecordTypeKey()
KeyExpression
hasRecordTypeKey
in interface KeyExpression
true
if record type key is usedpublic KeyExpression getSubKeyImpl(int start, int end)
getSubKeyImpl
in class BaseKeyExpression
@Nonnull public List<KeyExpression> getChildren()
getChildren
in interface KeyExpressionWithChildren
@Nonnull public List<ExpressionRef<KeyExpression>> getChildrenRefs()
@Nonnull @API(value=EXPERIMENTAL) public Iterator<? extends ExpressionRef<? extends PlannerExpression>> getPlannerExpressionChildren()
PlannerExpression
Collections.emptyIterator()
is returned. The returned iterator should
be treated as an immutable object and may throw an exception if Iterator.remove()
is called.
The iterator must return its elements in a consistent order.getPlannerExpressionChildren
in interface PlannerExpression
public int planHash()
PlanHashable
hashCode
, but with the additional guarantee that is is stable across JVMs.planHash
in interface PlanHashable