Skip to content

Commit 44a65b7

Browse files
committed
feat: make CardinalityEstimatorState public to allow external serialization/deserialization
1 parent 2864935 commit 44a65b7

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

CardinalityEstimation/CardinalityEstimator.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ public CardinalityEstimator(CardinalityEstimator other)
207207
/// <param name="hashFunction">Hash function to use for element hashing</param>
208208
/// <param name="state">The state to initialize the estimator with</param>
209209
/// <exception cref="ArgumentNullException">Thrown when <paramref name="state"/> is null</exception>
210-
internal CardinalityEstimator(GetHashCodeDelegate hashFunction, CardinalityEstimatorState state)
210+
public CardinalityEstimator(GetHashCodeDelegate hashFunction, CardinalityEstimatorState state)
211211
: this(state)
212212
{
213213
// Init the hash function
@@ -230,7 +230,7 @@ internal CardinalityEstimator(GetHashCodeDelegate hashFunction, CardinalityEstim
230230
/// <param name="hashFunctionSpan">Span hash function to use for element hashing</param>
231231
/// <param name="state">The state to initialize the estimator with</param>
232232
/// <exception cref="ArgumentNullException">Thrown when <paramref name="state"/> is null</exception>
233-
internal CardinalityEstimator(GetHashCodeSpanDelegate hashFunctionSpan, CardinalityEstimatorState state)
233+
public CardinalityEstimator(GetHashCodeSpanDelegate hashFunctionSpan, CardinalityEstimatorState state)
234234
: this(state)
235235
{
236236
// Init the hash function
@@ -668,12 +668,11 @@ public static CardinalityEstimator Merge(IEnumerable<CardinalityEstimator> estim
668668
return result;
669669
}
670670

671-
#region Private/Internal methods
672671
/// <summary>
673672
/// Gets the current state of this estimator for serialization purposes
674673
/// </summary>
675674
/// <returns>A <see cref="CardinalityEstimatorState"/> representing the current state</returns>
676-
internal CardinalityEstimatorState GetState()
675+
public CardinalityEstimatorState GetState()
677676
{
678677
return new CardinalityEstimatorState
679678
{
@@ -686,6 +685,7 @@ internal CardinalityEstimatorState GetState()
686685
};
687686
}
688687

688+
#region Private/Internal methods
689689
/// <summary>
690690
/// Creates state for an empty CardinalityEstimator with DirectCount and LookupSparse empty, LookupDense null.
691691
/// </summary>

CardinalityEstimation/CardinalityEstimatorState.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ namespace CardinalityEstimation
4141
/// </remarks>
4242
/// <seealso cref="CardinalityEstimator"/>
4343
/// <seealso cref="CardinalityEstimatorSerializer"/>
44-
internal class CardinalityEstimatorState
44+
public class CardinalityEstimatorState
4545
{
4646
/// <summary>
4747
/// Gets or sets the number of bits for indexing HLL sub-streams.

0 commit comments

Comments
 (0)