leerho commented on a change in pull request #369:
URL: https://github.com/apache/datasketches-java/pull/369#discussion_r733220950
##########
File path: src/main/java/org/apache/datasketches/tuple/Intersection.java
##########
@@ -107,14 +107,19 @@ public void intersect(final Sketch<S> tupleSketch) {
if (tupleSketch == null) { throw new SketchesArgumentException("Sketch
must not be null"); }
final boolean firstCall = firstCall_;
firstCall_ = false;
+ final boolean emptyIn = tupleSketch.isEmpty();
+ if (empty_ || emptyIn) { //empty rule
+ //Because of the definition of null above and the Empty Rule (which is
OR), empty_ must be true.
+ //Whatever the current internal state, we make our local empty.
+ resetToEmpty();
+ return;
Review comment:
There are two sets of "rules" for determining Theta and Empty for all
the Set Operations:
Empty Rules:
UNION: AND the empty states
Intersection: OR the empty states
AnotB: Whatever A is
Theta Rule (All set ops)
Result Theta = min(Theta A, Theta B)
These are derived from the theory in the Theta Sketch Framework, but not
explicitly stated as such in the TSF paper. I derived these rules from the
paper some years ago so I wouldn't have to keep returning back to the theory to
figure out how to implement the logic.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]