Package com.apple.foundationdb.record
Interface PlanHashable
-
- All Known Subinterfaces:
AtomKeyExpression
,Comparisons.Comparison
,ComponentWithChildren
,ComponentWithComparison
,ComponentWithNoChildren
,ComponentWithSingleChild
,KeyExpression
,KeyExpressionWithChild
,KeyExpressionWithChildren
,KeyExpressionWithoutChildren
,KeyExpressionWithValue
,PredicateWithValue
,QueryableKeyExpression
,QueryComponent
,QueryPlan<T>
,QueryPredicate
,RecordQueryLoadByKeysPlan.KeysSource
,RecordQueryPlan
,RecordQueryPlanWithChild
,RecordQueryPlanWithChildren
,RecordQueryPlanWithComparisons
,RecordQueryPlanWithIndex
,RecordQueryPlanWithNoChildren
,RecordQueryPlanWithRequiredFields
,SyntheticRecordFromStoredRecordPlan
,SyntheticRecordPlan
,Value
- All Known Implementing Classes:
AndComponent
,AndOrComponent
,AndOrPredicate
,AndPredicate
,BaseField
,BaseKeyExpression
,BaseNestedField
,BaseValue
,CollateFunctionKeyExpression
,CollateFunctionKeyExpressionFactoryJRE.CollateFunctionKeyExpressionJRE
,ComparisonRange
,Comparisons.ListComparison
,Comparisons.MultiColumnComparison
,Comparisons.NullComparison
,Comparisons.ParameterComparison
,Comparisons.SimpleComparison
,Comparisons.TextComparison
,Comparisons.TextContainsAllPrefixesComparison
,Comparisons.TextWithMaxDistanceComparison
,ComposedBitmapIndexQueryPlan
,ComposedBitmapIndexQueryPlan.ComposerBase
,ConstantPredicate
,EmptyComparison
,EmptyKeyExpression
,ExistsPredicate
,FieldKeyExpression
,FieldValue
,FieldWithComparison
,FunctionKeyExpression
,GroupingKeyExpression
,IndexAggregateFunction
,IndexRecordFunction
,IndexScanType
,KeyWithValueExpression
,ListKeyExpression
,LiteralKeyExpression
,LiteralValue
,NestedField
,NestingKeyExpression
,NotComponent
,NotPredicate
,ObjectPlanHash
,OneOfThemWithComparison
,OneOfThemWithComponent
,OrComponent
,OrPredicate
,QuantifiedColumnValue
,QuantifiedObjectValue
,QueryComponentPredicate
,QueryKeyExpressionWithComparison
,QueryPlanResult
,QueryRecordFunction
,QueryRecordFunctionWithComparison
,RecordFunction
,RecordQueryCoveringIndexPlan
,RecordQueryFetchFromPartialRecordPlan
,RecordQueryFilterPlan
,RecordQueryIndexPlan
,RecordQueryInJoinPlan
,RecordQueryInParameterJoinPlan
,RecordQueryIntersectionPlan
,RecordQueryInValuesJoinPlan
,RecordQueryLoadByKeysPlan
,RecordQueryPredicateFilterPlan
,RecordQueryScanPlan
,RecordQueryScoreForRankPlan
,RecordQueryScoreForRankPlan.ScoreForRank
,RecordQueryTextIndexPlan
,RecordQueryTypeFilterPlan
,RecordQueryUnionPlan
,RecordQueryUnionPlanBase
,RecordQueryUnorderedDistinctPlan
,RecordQueryUnorderedPrimaryKeyDistinctPlan
,RecordQueryUnorderedUnionPlan
,RecordTypeKeyComparison
,RecordTypeKeyExpression
,RecordTypeValue
,ScanComparisons
,ScanComparisons.Builder
,SplitKeyExpression
,StoreRecordFunction
,TextScan
,ThenKeyExpression
,TimeWindowAggregateFunction
,TimeWindowRecordFunction
,ValueComparisonRangePredicate
,ValueComparisonRangePredicate.Placeholder
,ValueComparisonRangePredicate.Sargable
,ValuePredicate
,VersionKeyExpression
,VersionValue
@API(UNSTABLE) public interface PlanHashable
A more stable version ofObject.hashCode()
. The planHash semantics are different thanObject.hashCode()
in a few ways:planHash()
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()
supports multiple flavors of hash calculations (SeePlanHashable.PlanHashKind
). The various kinds of plan hash algorithms are used for different purposes and include/exclude different parts of the target query planplanHash()
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.PlanHashKind
). 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 Classes Modifier and Type Interface Description static class
PlanHashable.PlanHashKind
The "kinds" of planHash calculations.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description static int
combineHashes(List<Integer> hashes)
static int
iterablePlanHash(PlanHashable.PlanHashKind hashKind, Iterable<?> objects)
static int
objectPlanHash(PlanHashable.PlanHashKind hashKind, Object obj)
static int
objectsPlanHash(PlanHashable.PlanHashKind hashKind, Object... objects)
default int
planHash()
int
planHash(PlanHashable.PlanHashKind hashKind)
Return a hash similar tohashCode
, but with the additional guarantee that is is stable across JVMs.static int
planHash(PlanHashable.PlanHashKind hashKind, PlanHashable... hashables)
static int
planHash(PlanHashable.PlanHashKind hashKind, Iterable<? extends PlanHashable> hashables)
static int
planHashUnordered(PlanHashable.PlanHashKind hashKind, Iterable<? extends PlanHashable> hashables)
static int
primitiveArrayHash(Object primitiveArray)
static int
stringHashUnordered(Iterable<String> strings)
-
-
-
Method Detail
-
planHash
int planHash(@Nonnull PlanHashable.PlanHashKind hashKind)
Return a hash similar tohashCode
, but with the additional guarantee that is is stable across JVMs.- Parameters:
hashKind
- 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
default int planHash()
-
planHash
static int planHash(@Nonnull PlanHashable.PlanHashKind hashKind, @Nonnull Iterable<? extends PlanHashable> hashables)
-
planHash
static int planHash(@Nonnull PlanHashable.PlanHashKind hashKind, PlanHashable... hashables)
-
planHashUnordered
static int planHashUnordered(@Nonnull PlanHashable.PlanHashKind hashKind, @Nonnull Iterable<? extends PlanHashable> hashables)
-
objectPlanHash
static int objectPlanHash(@Nonnull PlanHashable.PlanHashKind hashKind, @Nullable Object obj)
-
iterablePlanHash
static int iterablePlanHash(@Nonnull PlanHashable.PlanHashKind hashKind, @Nonnull Iterable<?> objects)
-
objectsPlanHash
static int objectsPlanHash(@Nonnull PlanHashable.PlanHashKind hashKind, Object... objects)
-
primitiveArrayHash
static int primitiveArrayHash(Object primitiveArray)
-
-