Package com.apple.foundationdb.record
Interface PlanHashable
- All Known Subinterfaces:
AggregateValue
,AtomKeyExpression
,AvailableFields.CopyIfPredicate
,BooleanComponent
,BooleanValue
,Comparisons.Comparison
,Comparisons.ComparisonWithParameter
,ComponentWithChildren
,ComponentWithComparison
,ComponentWithNoChildren
,ComponentWithSingleChild
,CreatesDynamicTypesValue
,IndexableAggregateValue
,IndexKeyValueToPartialRecord.Copier
,IndexScanParameters
,KeyExpression
,KeyExpressionWithChild
,KeyExpressionWithChildren
,KeyExpressionWithoutChildren
,KeyExpressionWithValue
,LeafQueryPredicate
,LeafValue
,MessageHelpers.CoercionBiFunction
,Ordering.DirectOrderPreservingValue
,Ordering.InverseOrderPreservingValue
,Ordering.OrderPreservingValue
,PlanSelector
,PredicateWithValue
,QuantifiedValue
,QueryableKeyExpression
,QueryComponent
,QueryPlan<T>
,QueryPredicate
,QueryPredicateWithChild
,RecordQueryLoadByKeysPlan.KeysSource
,RecordQueryPlan
,RecordQueryPlanWithChild
,RecordQueryPlanWithChildren
,RecordQueryPlanWithComparisonKeyValues
,RecordQueryPlanWithComparisons
,RecordQueryPlanWithIndex
,RecordQueryPlanWithMatchCandidate
,RecordQueryPlanWithNoChildren
,RecordQuerySetPlan
,RecordQuerySetPlan.ComparisonKeyFunction
,StreamableAggregateValue
,SyntheticRecordFromStoredRecordPlan
,SyntheticRecordPlan
,Value
,Value.IndexOnlyValue
,Value.InvertableValue<V>
,Value.NondeterministicValue
,Value.NonEvaluableValue
,Value.RangeMatchableValue
,ValueWithChild
- All Known Implementing Classes:
AbstractArrayConstructorValue
,AbstractArrayConstructorValue.LightArrayConstructorValue
,AbstractQueryPredicate
,AbstractValue
,AndComponent
,AndOrComponent
,AndOrPredicate
,AndOrValue
,AndPredicate
,ArithmeticValue
,AvailableFields.ConditionalUponPathPredicate
,AvailableFields.TruePredicate
,BaseField
,BaseKeyExpression
,BaseNestedField
,CollateFunctionKeyExpression
,CollateFunctionKeyExpressionFactoryJRE.CollateFunctionKeyExpressionJRE
,CollateValue
,Column
,ComparisonRange
,ComparisonRanges
,Comparisons.InvertedFunctionComparison
,Comparisons.ListComparison
,Comparisons.MultiColumnComparison
,Comparisons.NullComparison
,Comparisons.OpaqueEqualityComparison
,Comparisons.ParameterComparison
,Comparisons.ParameterComparisonBase
,Comparisons.SimpleComparison
,Comparisons.SimpleComparisonBase
,Comparisons.TextComparison
,Comparisons.TextContainsAllPrefixesComparison
,Comparisons.TextWithMaxDistanceComparison
,Comparisons.ValueComparison
,CompatibleTypeEvolutionPredicate
,CompatibleTypeEvolutionPredicate.FieldAccessTrieNode
,ComposedBitmapIndexQueryPlan
,ComposedBitmapIndexQueryPlan.ComposerBase
,ConditionSelectorValue
,ConstantObjectValue
,ConstantPredicate
,ConstantValue
,CountValue
,DatabaseObjectDependenciesPredicate
,DatabaseObjectDependenciesPredicate.UsedIndex
,DerivedValue
,DimensionsKeyExpression
,EmptyComparison
,EmptyKeyExpression
,EmptyValue
,ExistsPredicate
,ExistsValue
,FieldKeyExpression
,FieldValue
,FieldWithComparison
,FirstOrDefaultValue
,FromOrderedBytesValue
,FunctionKeyExpression
,GroupingKeyExpression
,InComparandSource
,IndexAggregateFunction
,IndexedValue
,IndexEntryObjectValue
,IndexKeyValueToPartialRecord
,IndexKeyValueToPartialRecord.FieldCopier
,IndexKeyValueToPartialRecord.FieldWithValueCopier
,IndexKeyValueToPartialRecord.MessageCopier
,IndexOnlyAggregateValue
,IndexOnlyAggregateValue.MaxEverValue
,IndexOnlyAggregateValue.MinEverValue
,IndexRecordFunction
,IndexScanComparisons
,IndexScanType
,InOpValue
,InParameterSource
,InSource
,InValuesSource
,InvertibleFunctionKeyExpression
,KeyWithValueExpression
,LikeOperatorValue
,ListKeyExpression
,LiteralKeyExpression
,LiteralValue
,LongArithmethicFunctionKeyExpression
,MessageHelpers.CoercionTrieNode
,MessageHelpers.TransformationTrieNode
,MultidimensionalIndexScanComparisons
,NestedField
,NestingKeyExpression
,NotComponent
,NotPredicate
,NotValue
,NullValue
,NumericAggregationValue
,NumericAggregationValue.Avg
,NumericAggregationValue.BitmapConstructAgg
,NumericAggregationValue.Max
,NumericAggregationValue.Min
,NumericAggregationValue.Sum
,ObjectPlanHash
,ObjectValue
,OfTypeValue
,OneOfThemWithComparison
,OneOfThemWithComponent
,OrComponent
,OrderFunctionKeyExpression
,OrPredicate
,PatternForLikeValue
,PickValue
,Placeholder
,PredicateWithValueAndRanges
,PromoteValue
,PromoteValue.ArrayCoercionBiFunction
,PromoteValue.PrimitiveCoercionBiFunction
,ProtoUtils.DynamicEnum
,QuantifiedObjectValue
,QuantifiedRecordValue
,QueriedValue
,QueryKeyExpressionWithComparison
,QueryKeyExpressionWithOneOfComparison
,QueryPlanConstraint
,QueryPlanResult
,QueryRecordFunction
,QueryRecordFunctionWithComparison
,RangeConstraints
,RangeConstraints.CompilableRange
,RankValue
,RecordConstructorValue
,RecordFunction
,RecordQueryAbstractDataModificationPlan
,RecordQueryAggregateIndexPlan
,RecordQueryChooserPlanBase
,RecordQueryComparatorPlan
,RecordQueryCoveringIndexPlan
,RecordQueryDamPlan
,RecordQueryDefaultOnEmptyPlan
,RecordQueryDeletePlan
,RecordQueryExplodePlan
,RecordQueryFetchFromPartialRecordPlan
,RecordQueryFilterPlan
,RecordQueryFilterPlanBase
,RecordQueryFirstOrDefaultPlan
,RecordQueryFlatMapPlan
,RecordQueryInComparandJoinPlan
,RecordQueryIndexPlan
,RecordQueryInJoinPlan
,RecordQueryInParameterJoinPlan
,RecordQueryInsertPlan
,RecordQueryIntersectionOnKeyExpressionPlan
,RecordQueryIntersectionOnValuesPlan
,RecordQueryIntersectionPlan
,RecordQueryInUnionOnKeyExpressionPlan
,RecordQueryInUnionOnValuesPlan
,RecordQueryInUnionPlan
,RecordQueryInValuesJoinPlan
,RecordQueryLoadByKeysPlan
,RecordQueryMapPlan
,RecordQueryPredicatesFilterPlan
,RecordQueryRangePlan
,RecordQueryRecursiveUnionPlan
,RecordQueryScanPlan
,RecordQueryScoreForRankPlan
,RecordQueryScoreForRankPlan.ScoreForRank
,RecordQuerySelectorPlan
,RecordQuerySetPlan.ComparisonKeyFunction.OnKeyExpression
,RecordQuerySetPlan.ComparisonKeyFunction.OnValues
,RecordQuerySortKey
,RecordQuerySortPlan
,RecordQueryStreamingAggregationPlan
,RecordQueryTextIndexPlan
,RecordQueryTypeFilterPlan
,RecordQueryUnionOnKeyExpressionPlan
,RecordQueryUnionOnValuesPlan
,RecordQueryUnionPlan
,RecordQueryUnionPlanBase
,RecordQueryUnorderedDistinctPlan
,RecordQueryUnorderedPrimaryKeyDistinctPlan
,RecordQueryUnorderedUnionPlan
,RecordQueryUpdatePlan
,RecordTypeKeyComparison
,RecordTypeKeyComparison.RecordTypeComparison
,RecordTypeKeyExpression
,RecordTypeValue
,RelativeProbabilityPlanSelector
,RelOpValue
,RelOpValue.BinaryRelOpValue
,RelOpValue.UnaryRelOpValue
,ScanComparisons
,ScanComparisons.Builder
,SortedInComparandSource
,SortedInParameterSource
,SortedInValuesSource
,SplitKeyExpression
,StoreRecordFunction
,TempTableInsertPlan
,TempTableScanPlan
,TextScan
,ThenKeyExpression
,ThrowsValue
,TimeWindowAggregateFunction
,TimeWindowForFunction
,TimeWindowRecordFunction
,TimeWindowScanComparisons
,ToOrderedBytesValue
,UdfValue
,ValuePredicate
,VariadicFunctionValue
,VersionKeyExpression
,VersionValue
,WindowedValue
A more stable version of
Object.hashCode()
.
The planHash semantics are different from Object.hashCode()
in a few ways:
planHash(PlanHashMode)
values should be stable across runtime instance changes. The reason is that these values can be used to validate outstanding continuations, and a change in hash value caused by an application restart or refactoring will invalidate all those outstanding continuationsplanHash(PlanHashMode)
supports multiple flavors of hash calculations (SeePlanHashable.PlanHashMode
). The various kinds of plan hash algorithms are used for different purposes and include/exclude different parts of the target query planplanHash(PlanHashMode)
is meant to imply a certain identity of a plan, and reflects on the entire structure of the plan. The intent is to be able to correlate various plans for "identity" (using different definitions for this identity as specified byPlanHashable.PlanHashMode
). This requirement drives a desire to reduce collisions as much as possible since not in all cases can we actually use "equals" to verify identity (e.g. log messages)
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic enum
The "kinds" of planHash calculations.static enum
A mode for a plan hash which captures both kind and version. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final PlanHashable.PlanHashMode
static final PlanHashable.PlanHashMode
-
Method Summary
Modifier and TypeMethodDescriptionstatic int
combineHashes
(List<Integer> hashes) static int
iterablePlanHash
(PlanHashable.PlanHashKind kind, Iterable<?> objects) Deprecated, for removal: This API element is subject to removal in a future version.static int
iterablePlanHash
(PlanHashable.PlanHashMode mode, Iterable<?> objects) static int
mapsPlanHash
(PlanHashable.PlanHashMode mode, Map<?, ?> map) static int
objectPlanHash
(PlanHashable.PlanHashKind kind, Object obj) Deprecated, for removal: This API element is subject to removal in a future version.static int
objectPlanHash
(PlanHashable.PlanHashMode mode, Object obj) static int
objectsPlanHash
(PlanHashable.PlanHashKind kind, Object... objects) Deprecated, for removal: This API element is subject to removal in a future version.static int
objectsPlanHash
(PlanHashable.PlanHashMode mode, Object... objects) default int
planHash()
Deprecated, for removal: This API element is subject to removal in a future version.default int
Deprecated, for removal: This API element is subject to removal in a future version.static int
planHash
(PlanHashable.PlanHashKind kind, PlanHashable... hashables) Deprecated, for removal: This API element is subject to removal in a future version.static int
planHash
(PlanHashable.PlanHashKind kind, Iterable<? extends PlanHashable> hashables) Deprecated, for removal: This API element is subject to removal in a future version.int
planHash
(PlanHashable.PlanHashMode hashMode) Return a hash similar tohashCode
, but with the additional guarantee that is is stable across JVMs.static int
planHash
(PlanHashable.PlanHashMode mode, PlanHashable... hashables) static int
planHash
(PlanHashable.PlanHashMode mode, Iterable<? extends PlanHashable> hashables) static int
planHashUnordered
(PlanHashable.PlanHashKind kind, Iterable<? extends PlanHashable> hashables) Deprecated, for removal: This API element is subject to removal in a future version.static int
planHashUnordered
(PlanHashable.PlanHashMode hashMode, Iterable<? extends PlanHashable> hashables) static int
primitiveArrayHash
(Object primitiveArray) static int
setsPlanHash
(PlanHashable.PlanHashMode mode, Set<?> objects) static int
stringHashUnordered
(Iterable<String> strings) Deprecated, for removal: This API element is subject to removal in a future version.
-
Field Details
-
CURRENT_LEGACY
-
CURRENT_FOR_CONTINUATION
-
-
Method Details
-
planHash
Return a hash similar tohashCode
, but with the additional guarantee that is is stable across JVMs.- Parameters:
hashMode
- the "mode" of hash to calculate. Each mode contains a hash kind which has a particular logic with regards to included and excluded items. It is also versioned to support for the evolution of the plan hash when the underlying plan objects evolve- Returns:
- a stable hash code
-
planHash
Deprecated, for removal: This API element is subject to removal in a future version.Return a hash similar tohashCode
, but with the additional guarantee that is is stable across JVMs.- Parameters:
kind
- the "kind" of hash to calculate. Each kind of hash has a particular logic with regards to included and excluded items.- Returns:
- a stable hash code
-
planHash
Deprecated, for removal: This API element is subject to removal in a future version.Parameterless overload of planHash(). This method delegates to theplanHash(PlanHashKind)
. This method is deprecated. In order to achieve the same result, useplanHash(PlanHashKind)
directly passing inPlanHashable.PlanHashKind.LEGACY
.- Returns:
- a stable ash code using
PlanHashable.PlanHashKind.LEGACY
-
planHash
@Deprecated(forRemoval=true) static int planHash(@Nonnull PlanHashable.PlanHashKind kind, @Nonnull Iterable<? extends PlanHashable> hashables) Deprecated, for removal: This API element is subject to removal in a future version.This method is deprecated. UseplanHash(PlanHashMode, Iterable)
instead.- Parameters:
kind
- plan hash kindhashables
- an iterable to be hashed- Returns:
- a stable hash code
-
planHash
static int planHash(@Nonnull PlanHashable.PlanHashMode mode, @Nonnull Iterable<? extends PlanHashable> hashables) -
planHash
@Deprecated(forRemoval=true) static int planHash(@Nonnull PlanHashable.PlanHashKind kind, PlanHashable... hashables) Deprecated, for removal: This API element is subject to removal in a future version.This method is deprecated. UseplanHash(PlanHashMode, PlanHashable...)
instead.- Parameters:
kind
- plan hash kindhashables
- a varargs array to be hashed- Returns:
- a stable hash code
-
planHash
-
planHashUnordered
@Deprecated(forRemoval=true) static int planHashUnordered(@Nonnull PlanHashable.PlanHashKind kind, @Nonnull Iterable<? extends PlanHashable> hashables) Deprecated, for removal: This API element is subject to removal in a future version.This method is deprecated. UseplanHashUnordered(PlanHashMode, Iterable)
instead.- Parameters:
kind
- plan hash kindhashables
- a varargs array to be hashed- Returns:
- a stable hash code
-
planHashUnordered
static int planHashUnordered(@Nonnull PlanHashable.PlanHashMode hashMode, @Nonnull Iterable<? extends PlanHashable> hashables) -
stringHashUnordered
Deprecated, for removal: This API element is subject to removal in a future version.This method is deprecated. Use an order-independent hash algorithm instead, i.e.AbstractSet.hashCode()
.- Parameters:
strings
- an iterable of strings- Returns:
- a stable hash code
-
combineHashes
-
objectPlanHash
@Deprecated(forRemoval=true) static int objectPlanHash(@Nonnull PlanHashable.PlanHashKind kind, @Nullable Object obj) Deprecated, for removal: This API element is subject to removal in a future version.This method is deprecated. UseobjectPlanHash(PlanHashMode, Object)
instead.- Parameters:
kind
- plan hash kindobj
- an object to be hashed- Returns:
- a stable hash code
-
objectPlanHash
-
iterablePlanHash
@Deprecated(forRemoval=true) static int iterablePlanHash(@Nonnull PlanHashable.PlanHashKind kind, @Nonnull Iterable<?> objects) Deprecated, for removal: This API element is subject to removal in a future version.This method is deprecated. UseiterablePlanHash(PlanHashMode, Iterable)
instead.- Parameters:
kind
- plan hash kindobjects
- an iterable of objects to be hashed- Returns:
- a stable hash code
-
iterablePlanHash
-
setsPlanHash
-
mapsPlanHash
-
objectsPlanHash
@Deprecated(forRemoval=true) static int objectsPlanHash(@Nonnull PlanHashable.PlanHashKind kind, Object... objects) Deprecated, for removal: This API element is subject to removal in a future version.This method is deprecated. UseobjectsPlanHash(PlanHashMode, Object...)
instead.- Parameters:
kind
- plan hash kindobjects
- a varargs of objects to be hashed- Returns:
- a stable hash code
-
objectsPlanHash
-
primitiveArrayHash
-