Skip to content

Commit

Permalink
Merge d61a6a4 into 4af6b63
Browse files Browse the repository at this point in the history
  • Loading branch information
davecromberge committed Sep 28, 2021
2 parents 4af6b63 + d61a6a4 commit d3b6683
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 62 deletions.
36 changes: 0 additions & 36 deletions src/main/java/org/apache/datasketches/tuple/AnotB.java
Expand Up @@ -384,7 +384,6 @@ private static <S extends Summary> DataArrays<S> getResultArraysTuple(
return daB;
}


@SuppressWarnings("unchecked")
private static <S extends Summary> DataArrays<S> getResultArraysTheta(
final long minThetaLong,
Expand Down Expand Up @@ -432,7 +431,6 @@ private static <S extends Summary> DataArrays<S> getResultArraysTheta(
return daB;
}


/**
* Resets this sketch back to the empty state.
*/
Expand All @@ -444,38 +442,4 @@ private void reset() {
curCount_ = 0;
}

//Deprecated methods

/**
* Perform A-and-not-B set operation on the two given sketches.
* A null sketch is interpreted as an empty sketch.
* This is not an accumulating update. Calling this update() more than once
* without calling getResult() will discard the result of previous update() by this method.
* The result is obtained by calling getResult();
*
* @param skA The incoming sketch for the first argument
* @param skB The incoming sketch for the second argument
* @deprecated v2.0.0. Instead please use {@link #aNotB(Sketch, Sketch)}.
*/
@Deprecated
public void update(final Sketch<S> skA, final Sketch<S> skB) {
//duplicate old behavior
reset();
if (skA == null) { return; }
else { setA(skA); }
if (skB == null) { return; }
else { notB(skB); }
}

/**
* Gets the result of this operation. This clears the state of this operator after the result is
* returned.
* @return the result of this operation as an unordered {@link CompactSketch}
* @deprecated v2.0.0. Instead use {@link #getResult(boolean)}.
*/
@Deprecated
public CompactSketch<S> getResult() {
return getResult(true);
}

}
13 changes: 0 additions & 13 deletions src/main/java/org/apache/datasketches/tuple/Union.java
Expand Up @@ -102,19 +102,6 @@ public CompactSketch<S> union(final Sketch<S> tupleSketch,
return csk;
}

/**
* Performs a stateful union of the internal set with the given tupleSketch.
* @param tupleSketch input tuple sketch to add to the internal set.
*
* <p>Nulls and empty sketches are ignored.</p>
*
* @deprecated 2.0.0. Please use {@link #union(org.apache.datasketches.tuple.Sketch)}.
*/
@Deprecated
public void update(final Sketch<S> tupleSketch) {
union(tupleSketch);
}

/**
* Performs a stateful union of the internal set with the given tupleSketch.
* @param tupleSketch input tuple sketch to merge with the internal set.
Expand Down
Expand Up @@ -44,7 +44,6 @@ public class AdoubleAnotBTest {
private static final DoubleSummary.Mode mode = Mode.Sum;
private final Results results = new Results();

@SuppressWarnings("deprecation")
private static void threeMethodsWithTheta(
final AnotB<DoubleSummary> aNotB,
final Sketch<DoubleSummary> skA,
Expand All @@ -54,11 +53,16 @@ private static void threeMethodsWithTheta(
{
CompactSketch<DoubleSummary> result;

//Deprecated v2.0.0., Stateless, A = Tuple, B = Tuple
//Old behavior is tolerant of nulls
aNotB.update(skA, skB);
result = aNotB.getResult();
results.check(result);
//Stateful, A = Tuple, B = Tuple
if (skA != null) {
try {
aNotB.setA(skA);
aNotB.notB(skB);
result = aNotB.getResult(true);
results.check(result);
}
catch (final SketchesArgumentException e) { }
}

//Stateless A = Tuple, B = Tuple
if (skA == null || skB == null) {
Expand Down Expand Up @@ -160,7 +164,7 @@ private static UpdateSketch buildUpdateTheta() {
public void aNotBNullEmptyCombinations() {
final AnotB<DoubleSummary> aNotB = new AnotB<>();
// calling getResult() before calling update() should yield an empty set
final CompactSketch<DoubleSummary> result = aNotB.getResult();
final CompactSketch<DoubleSummary> result = aNotB.getResult(true);
results.set(0, true, 0.0, 0.0, 0.0).check(result);

final UpdatableSketch<Double, DoubleSummary> sketch = buildUpdatableTuple();
Expand Down
Expand Up @@ -82,8 +82,9 @@ public void aNotBTest() {
for (int i = 0; i < u; i++) {
a1Sk1.update(i, 1);
}
anotb.update(a1Sk1, a1Sk2);
final CompactSketch<IntegerSummary> cSk = anotb.getResult();
anotb.setA(a1Sk1);
anotb.notB(a1Sk2);
final CompactSketch<IntegerSummary> cSk = anotb.getResult(true);
assertEquals((int)cSk.getEstimate(), u);
}

Expand Down
Expand Up @@ -58,8 +58,8 @@ public void checkSketch() {
sketch2.update(strArr3, strArr3);

Union<ArrayOfStringsSummary> union = new Union<>(new ArrayOfStringsSummarySetOperations());
union.update(sketch1);
union.update(sketch2);
union.union(sketch1);
union.union(sketch2);
CompactSketch<ArrayOfStringsSummary> csk = union.getResult();
//printSummaries(csk.iterator());
assertEquals(csk.getRetainedEntries(), 4);
Expand All @@ -72,8 +72,9 @@ public void checkSketch() {
assertEquals(csk.getRetainedEntries(), 3);

AnotB<ArrayOfStringsSummary> aNotB = new AnotB<>();
aNotB.update(sketch2, sketch1);
csk = aNotB.getResult();
aNotB.setA(sketch2);
aNotB.notB(sketch1);
csk = aNotB.getResult(true);
assertEquals(csk.getRetainedEntries(), 1);

}
Expand Down

0 comments on commit d3b6683

Please sign in to comment.