Class RecordTypeKeyExpression

    • Method Detail

      • evaluateMessage

        @Nonnull
        public <M extends MessageList<Key.Evaluated> evaluateMessage​(@Nullable
                                                                       FDBRecord<M> record,
                                                                       @Nullable
                                                                       Message message)
        Description copied from interface: KeyExpression
        Evaluate this expression against a record or a Protobuf message. The message might be the Protobuf form of a record or a piece of that record. If the key expression is meaningful against a subrecord, it should evaluate against the message. Otherwise, it should evaluate against the record and ignore what part of that record is being considered. There should not be any reason to call this method outside of the implementation of another 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.
        Specified by:
        evaluateMessage in interface KeyExpression
        Type Parameters:
        M - the type of record
        Parameters:
        record - the record
        message - the Protobuf message to evaluate against
        Returns:
        the evaluated keys for the given record
        See Also:
        KeyExpression.evaluate(com.apple.foundationdb.record.provider.foundationdb.FDBRecord<M>)
      • createsDuplicates

        public boolean createsDuplicates()
        Description copied from interface: KeyExpression
        This states whether the given expression type is capable of evaluating more to more than one value when applied to a single record. In practice, this can happen if this expression is evaluated on a repeated field with FanType.FanOut set (either directly or indirectly).
        Specified by:
        createsDuplicates in interface KeyExpression
        Returns:
        true if this expression can evaluate to multiple values and false otherwise
      • getColumnSize

        public int getColumnSize()
        Description copied from interface: KeyExpression
        Returns the number of items in each KeyValue that will be returned. For key expressions that support 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.
        Specified by:
        getColumnSize in interface KeyExpression
        Returns:
        the number of elements that will be produced for every key
      • hasRecordTypeKey

        public boolean hasRecordTypeKey()
        Description copied from interface: KeyExpression
        Check whether a key expression uses record type key in some way.
        Specified by:
        hasRecordTypeKey in interface KeyExpression
        Returns:
        true if record type key is used
      • normalizeForPlanner

        @Nonnull
        public KeyExpression normalizeForPlanner​(@Nonnull
                                                 Source source,
                                                 @Nonnull
                                                 List<String> fieldNamePrefix)
        Description copied from interface: KeyExpression
        Normalize this key expression into another key expression that pushes all nesting and fan-out to ElementKeyExpressions at the leaves.

        By default, a key expression is a complicated nested structure that can be difficult to work with. This method pushes much of the complexity, including nested structures and fan-out of repeated fields, to special key expressions that track these relationship using the Source abstraction. This pre-processing makes planning nested and repeated structures much simpler.

        This normalization process requires tracking some state since the name of a nested field is available only at the relevant FieldKeyExpression, but that information is necessary to construct the ElementKeyExpression at the leaves of the sub-tree rooted at the NestingKeyExpression. This extra information is tracked in the fieldNamePrefix.

        Specified by:
        normalizeForPlanner in interface KeyExpression
        Parameters:
        source - the source representing the input stream of the key expression
        fieldNamePrefix - the (non-repeated) field names on the path from the most recent source to this part of the key expression
        Returns:
        a new key expression that has only ElementKeyExpressions at its leaves
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • planHash

        public int planHash()
        Description copied from interface: PlanHashable
        Return a hash similar to hashCode, but with the additional guarantee that is is stable across JVMs.
        Specified by:
        planHash in interface PlanHashable
        Returns:
        a stable hash code