com.hazelcast.spi.merge

## Class HyperLogLogMergePolicy

- java.lang.Object
- - com.hazelcast.spi.impl.merge.AbstractSplitBrainMergePolicy<com.hazelcast.cardinality.impl.hyperloglog.HyperLogLog,SplitBrainMergeTypes.CardinalityEstimatorMergeTypes>
  - - com.hazelcast.spi.merge.HyperLogLogMergePolicy

- All Implemented Interfaces:
    DataSerializable, IdentifiedDataSerializable, SplitBrainMergePolicy<com.hazelcast.cardinality.impl.hyperloglog.HyperLogLog,SplitBrainMergeTypes.CardinalityEstimatorMergeTypes>

      public class HyperLogLogMergePolicy
      extends com.hazelcast.spi.impl.merge.AbstractSplitBrainMergePolicy<com.hazelcast.cardinality.impl.hyperloglog.HyperLogLog,SplitBrainMergeTypes.CardinalityEstimatorMergeTypes>

  Only available for HyperLogLog backed `CardinalityEstimator`.

  Uses the default merge algorithm from HyperLogLog research, keeping the max register value of the two given instances. The result should be the union to the two HyperLogLog estimations.

  Since:
    3.10

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `HyperLogLogMergePolicy()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `getId()` Returns type identifier for this class.
    `com.hazelcast.cardinality.impl.hyperloglog.HyperLogLog` | `merge(SplitBrainMergeTypes.CardinalityEstimatorMergeTypes mergingValue, SplitBrainMergeTypes.CardinalityEstimatorMergeTypes existingValue)` Selects the value of either the merging or the existing `MergingValue` which should be merged.

    - ### Methods inherited from class com.hazelcast.spi.impl.merge.AbstractSplitBrainMergePolicy

      `getFactoryId, readData, writeData`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### HyperLogLogMergePolicy

          public HyperLogLogMergePolicy()

  - ### Method Detail

    - #### merge

          public com.hazelcast.cardinality.impl.hyperloglog.HyperLogLog merge(SplitBrainMergeTypes.CardinalityEstimatorMergeTypes mergingValue,
                                                                              SplitBrainMergeTypes.CardinalityEstimatorMergeTypes existingValue)

      Description copied from interface: `SplitBrainMergePolicy`
      Selects the value of either the merging or the existing `MergingValue` which should be merged.

      Note that the existing `MergingValue` instance may be `null` if no matching data could be found to the merging `MergingValue`.

      Parameters:
        `mergingValue` - `MergingValue` instance that has the merging data of the smaller sub-cluster
        `existingValue` - `MergingValue` instance that has the existing data or `null` if no matching data exists
      Returns:
        the selected value for merging

    - #### getId

          public int getId()

      Description copied from interface: `IdentifiedDataSerializable`
      Returns type identifier for this class. It should be unique per DataSerializableFactory.
      Returns:
        type ID

Copyright © 2019. All rights reserved.