@API(value=MAINTAINED) public class KeyWithValueExpression extends BaseKeyExpression implements KeyExpressionWithChild
KeyWithValue
expression is a top level expression that takes as input an expression that
produces more than one column, and indicates that all columns before the specified splitPoint
should be used in the key of a covering index and all of the values starting at the splitPoint
are to be used as the value of a covering index.BaseKeyExpression.IllegalSubKeyException, BaseKeyExpression.UnsplittableKeyExpressionException
KeyExpression.DeserializationException, KeyExpression.FanType, KeyExpression.InvalidExpressionException, KeyExpression.InvalidResultException, KeyExpression.NoSuchArgumentException, KeyExpression.SerializationException
Constructor and Description |
---|
KeyWithValueExpression(KeyExpression innerKey,
int splitPoint) |
KeyWithValueExpression(RecordMetaDataProto.KeyWithValue proto) |
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 |
equals(Object o) |
<M extends Message> |
evaluateMessage(FDBRecord<M> record,
Message message)
Evaluate this expression against a record or a Protobuf message.
|
KeyExpression |
getChild() |
int |
getChildColumnSize() |
int |
getColumnSize()
Returns the number of items in each KeyValue that will be returned.
|
Key.Evaluated |
getKey(Key.Evaluated wholeKey)
Given a
Key.Evaluated returned from the evaluation of this expression, splits out
the portion of that expression that should be used to represent the key of a covering index. |
KeyExpression |
getKeyExpression() |
int |
getSplitPoint() |
protected KeyExpression |
getSubKeyImpl(int start,
int end) |
Key.Evaluated |
getValue(Key.Evaluated wholeKey)
Given a
Key.Evaluated returned from the evaluation of this expression, splits out
the portion of that expression that should be used to represent the value of a covering index. |
KeyExpression |
getValueExpression() |
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.KeyWithValue |
toProto() |
String |
toString() |
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
getChildren
evaluate, evaluateSingleton, fromProto, getSubKey, hasProperInterfaces, isPrefixKey
combineHashes, iterablePlanHash, objectPlanHash, objectsPlanHash, planHash, planHash, planHashUnordered, stringHashUnordered
public KeyWithValueExpression(@Nonnull KeyExpression innerKey, int splitPoint)
public KeyWithValueExpression(@Nonnull RecordMetaDataProto.KeyWithValue proto) 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 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 protected KeyExpression getSubKeyImpl(int start, int end)
getSubKeyImpl
in class BaseKeyExpression
@Nonnull public KeyExpression getKeyExpression()
@Nonnull public KeyExpression getValueExpression()
public int getChildColumnSize()
@Nonnull public RecordMetaDataProto.KeyWithValue 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 int getSplitPoint()
@Nonnull public KeyExpression getChild()
getChild
in interface KeyExpressionWithChild
@Nonnull public Key.Evaluated getKey(@Nonnull Key.Evaluated wholeKey)
Key.Evaluated
returned from the evaluation of this expression, splits out
the portion of that expression that should be used to represent the key of a covering index.wholeKey
- the whole key with both key and value@Nonnull public Key.Evaluated getValue(@Nonnull Key.Evaluated wholeKey)
Key.Evaluated
returned from the evaluation of this expression, splits out
the portion of that expression that should be used to represent the value of a covering index.wholeKey
- the whole key with both key and valuepublic int planHash()
PlanHashable
hashCode
, but with the additional guarantee that is is stable across JVMs.planHash
in interface PlanHashable