Skip to content

Commit 5236461

Browse files
committed
This set of changes completes the name changes for /theta/ and /tuple/.
Note that I focused on changing the name of public classes where they might conflict with similarly named classes in other families, particularly the /theta/ and /tuple/ families.
1 parent 2821333 commit 5236461

69 files changed

Lines changed: 1140 additions & 1230 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/main/java/org/apache/datasketches/common/Family.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,12 @@ public enum Family {
4141
* 30% improvement (~1/sqrt(2*k)) in its error distribution as compared to the QuickSelect
4242
* (or similar KMV-derived) sketches.
4343
*
44-
* <p>If the AlphaSketch is fed into any SetOperation, the error distribution reverts back to the
44+
* <p>If the AlphaSketch is fed into any ThetaSetOperation, the error distribution reverts back to the
4545
* normal QuickSelect/KMV error distribution (~1/sqrt(k)). For this reason, the AlphaSketch
46-
* does not have a sister class for off-heap operation. The Alpha Sketch has a roughly 30% faster
46+
* does not have a sister class for off-heap operation. The AlphaSketch has a roughly 30% faster
4747
* overall update time as compared to the QuickSelect sketch family.</p>
4848
*
49-
* <p>The Alpha Sketch is created using the UpdateSketch.builder().
49+
* <p>The AlphaSketch is created using the UpdatableThetaSketchBuilder().
5050
* <a href="{@docRoot}/resources/dictionary.html#alphaTCF">See Alpha TCF</a> and
5151
* <a href="{@docRoot}/resources/dictionary.html#thetaSketch">Theta Sketch Framework</a>
5252
*/
@@ -56,35 +56,35 @@ public enum Family {
5656
* The QuickSelect Sketch family is a member of the Theta Sketch Framework of sketches and
5757
* is the workhorse of the Theta Sketch Families and can be constructed for either on-heap or
5858
* off-heap operation.
59-
* The QuickSelect Sketch is created using the UpdateSketch.builder().
59+
* The QuickSelect Sketch is created using the UpdatableThetaSketchBuilder().
6060
* <a href="{@docRoot}/resources/dictionary.html#quickSelectTCF">See Quick Select TCF</a>
6161
*/
6262
QUICKSELECT(2, "QuickSelect", 3, 3),
6363

6464
/**
6565
* The Compact Sketch family is a member of the Theta Sketch Framework of sketches.
66-
* The are read-only and cannot be updated, but can participate in any of the Set Operations.
67-
* The compact sketches are never created directly with a constructor or Builder.
66+
* They are read-only and cannot be updated, but can participate in any of the Set Operations.
67+
* The compact sketches are never created directly with a constructor or builder.
6868
* Instead they are created as a result of the compact()
69-
* method of an UpdateSketch or as a result of a getSketchSamples() of a SetOperation.
69+
* method of an UpdatableThetaSketch or as a result of a getSketchSamples() of a ThetaSetOperation.
7070
*/
7171
COMPACT(3, "Compact", 1, 3),
7272

7373
/**
7474
* The Union family is an operation for the Theta Sketch Framework of sketches.
75-
* The Union is constructed using the SetOperation.builder().
75+
* The Union is constructed using the ThetaSetOperationBuilder().
7676
*/
7777
UNION(4, "Union", 4, 4),
7878

7979
/**
8080
* The Intersection family is an operation for the Theta Sketch Framework of sketches.
81-
* The Intersection is constructed using the SetOperation.builder().
81+
* The ThetaIntersection is constructed using the ThetaSetOperationBuilder().
8282
*/
8383
INTERSECTION(5, "Intersection", 3, 3),
8484

8585
/**
8686
* The A and not B family is an operation for the Theta Sketch Framework of sketches.
87-
* The AnotB operation is constructed using the SetOperation.builder().
87+
* The ThetaAnotB operation is constructed using the ThetaSetOperationBuilder().
8888
*/
8989
A_NOT_B(6, "AnotB", 3, 3),
9090

src/main/java/org/apache/datasketches/fdt/FdtSketch.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
import org.apache.datasketches.common.SketchesArgumentException;
2626
import org.apache.datasketches.thetacommon.ThetaUtil;
27-
import org.apache.datasketches.tuple.strings.ArrayOfStringsSketch;
27+
import org.apache.datasketches.tuple.strings.ArrayOfStringsTupleSketch;
2828

2929
/**
3030
* A Frequent Distinct Tuples sketch.
@@ -46,7 +46,7 @@
4646
*
4747
* @author Lee Rhodes
4848
*/
49-
public final class FdtSketch extends ArrayOfStringsSketch {
49+
public final class FdtSketch extends ArrayOfStringsTupleSketch {
5050

5151
/**
5252
* Create new instance of Frequent Distinct Tuples sketch with the given

src/main/java/org/apache/datasketches/theta/ThetaSketch.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545

4646
/**
4747
* The top-level class for all theta sketches. This class is never constructed directly.
48-
* Use the UpdatableThetaSketch.builder() methods to create UpdatableThetaSketches.
48+
* Use the UpdatableThetaSketchBuilder() methods to create UpdatableThetaSketches.
4949
*
5050
* @author Lee Rhodes
5151
*/

src/main/java/org/apache/datasketches/theta/UpdatableThetaSketch.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,8 +212,8 @@ public boolean isSameResource(final MemorySegment that) {
212212
* Returns a new builder
213213
* @return a new builder
214214
*/
215-
public static final UpdateSketchBuilder builder() {
216-
return new UpdateSketchBuilder();
215+
public static final UpdatableThetaSketchBuilder builder() {
216+
return new UpdatableThetaSketchBuilder();
217217
}
218218

219219
/**

src/main/java/org/apache/datasketches/theta/UpdateSketchBuilder.java renamed to src/main/java/org/apache/datasketches/theta/UpdatableThetaSketchBuilder.java

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
*
4040
* @author Lee Rhodes
4141
*/
42-
public final class UpdateSketchBuilder {
42+
public final class UpdatableThetaSketchBuilder {
4343
private int bLgNomLongs;
4444
private long bSeed;
4545
private ResizeFactor bRF;
@@ -75,7 +75,7 @@ public final class UpdateSketchBuilder {
7575
* <li>Concurrent MaxNumLocalThreads: 1</li>
7676
* </ul>
7777
*/
78-
public UpdateSketchBuilder() {
78+
public UpdatableThetaSketchBuilder() {
7979
bLgNomLongs = Integer.numberOfTrailingZeros(ThetaUtil.DEFAULT_NOMINAL_ENTRIES);
8080
bSeed = Util.DEFAULT_UPDATE_SEED;
8181
bRF = ResizeFactor.X8;
@@ -102,7 +102,7 @@ public UpdateSketchBuilder() {
102102
* This will become the ceiling power of 2 if the given value is not.
103103
* @return this UpdatableThetaSketchBuilder
104104
*/
105-
public UpdateSketchBuilder setNominalEntries(final int nomEntries) {
105+
public UpdatableThetaSketchBuilder setNominalEntries(final int nomEntries) {
106106
bLgNomLongs = ThetaUtil.checkNomLongs(nomEntries);
107107
return this;
108108
}
@@ -117,7 +117,7 @@ public UpdateSketchBuilder setNominalEntries(final int nomEntries) {
117117
* @param lgNomEntries the Log Nominal Entries. Also for the concurrent shared sketch
118118
* @return this UpdatableThetaSketchBuilder
119119
*/
120-
public UpdateSketchBuilder setLogNominalEntries(final int lgNomEntries) {
120+
public UpdatableThetaSketchBuilder setLogNominalEntries(final int lgNomEntries) {
121121
bLgNomLongs = ThetaUtil.checkNomLongs(1 << lgNomEntries);
122122
return this;
123123
}
@@ -132,7 +132,7 @@ public UpdateSketchBuilder setLogNominalEntries(final int lgNomEntries) {
132132
* @param lgK the Log Nominal Entries. Also for the concurrent shared sketch.
133133
* @return this UpdatableThetaSketchBuilder
134134
*/
135-
public UpdateSketchBuilder setLgK(final int lgK) {
135+
public UpdatableThetaSketchBuilder setLgK(final int lgK) {
136136
bLgNomLongs = ThetaUtil.checkNomLongs(1 << lgK);
137137
return this;
138138
}
@@ -155,7 +155,7 @@ public int getLgNominalEntries() {
155155
* This will become the ceiling power of 2 if it is not.
156156
* @return this UpdatableThetaSketchBuilder
157157
*/
158-
public UpdateSketchBuilder setConCurNominalEntries(final int nomEntries) {
158+
public UpdatableThetaSketchBuilder setConCurNominalEntries(final int nomEntries) {
159159
bConCurLgNomLongs = Integer.numberOfTrailingZeros(ceilingPowerOf2(nomEntries));
160160
if (bConCurLgNomLongs > ThetaUtil.MAX_LG_NOM_LONGS || bConCurLgNomLongs < ThetaUtil.MIN_LG_NOM_LONGS) {
161161
throw new SketchesArgumentException(
@@ -173,7 +173,7 @@ public UpdateSketchBuilder setConCurNominalEntries(final int nomEntries) {
173173
* @param lgNomEntries the Log Nominal Entries for a concurrent local sketch
174174
* @return this UpdatableThetaSketchBuilder
175175
*/
176-
public UpdateSketchBuilder setConCurLogNominalEntries(final int lgNomEntries) {
176+
public UpdatableThetaSketchBuilder setConCurLogNominalEntries(final int lgNomEntries) {
177177
bConCurLgNomLongs = lgNomEntries;
178178
if (bConCurLgNomLongs > ThetaUtil.MAX_LG_NOM_LONGS || bConCurLgNomLongs < ThetaUtil.MIN_LG_NOM_LONGS) {
179179
throw new SketchesArgumentException(
@@ -195,7 +195,7 @@ public int getConCurLgNominalEntries() {
195195
* @param seed <a href="{@docRoot}/resources/dictionary.html#seed">See seed</a>
196196
* @return this UpdatableThetaSketchBuilder
197197
*/
198-
public UpdateSketchBuilder setSeed(final long seed) {
198+
public UpdatableThetaSketchBuilder setSeed(final long seed) {
199199
bSeed = seed;
200200
return this;
201201
}
@@ -213,7 +213,7 @@ public long getSeed() {
213213
* @param p <a href="{@docRoot}/resources/dictionary.html#p">See Sampling Probability, <i>p</i></a>
214214
* @return this UpdatableThetaSketchBuilder
215215
*/
216-
public UpdateSketchBuilder setP(final float p) {
216+
public UpdatableThetaSketchBuilder setP(final float p) {
217217
if (p <= 0.0 || p > 1.0) {
218218
throw new SketchesArgumentException("p must be > 0 and <= 1.0: " + p);
219219
}
@@ -234,7 +234,7 @@ public float getP() {
234234
* @param rf <a href="{@docRoot}/resources/dictionary.html#resizeFactor">See Resize Factor</a>
235235
* @return this UpdatableThetaSketchBuilder
236236
*/
237-
public UpdateSketchBuilder setResizeFactor(final ResizeFactor rf) {
237+
public UpdatableThetaSketchBuilder setResizeFactor(final ResizeFactor rf) {
238238
bRF = rf;
239239
return this;
240240
}
@@ -252,7 +252,7 @@ public ResizeFactor getResizeFactor() {
252252
* @param family the family for this builder
253253
* @return this UpdatableThetaSketchBuilder
254254
*/
255-
public UpdateSketchBuilder setFamily(final Family family) {
255+
public UpdatableThetaSketchBuilder setFamily(final Family family) {
256256
bFam = family;
257257
return this;
258258
}
@@ -270,7 +270,7 @@ public Family getFamily() {
270270
* @param mSegReq the given MemorySegmentRequest
271271
* @return this UpdatableThetaSketchBuilder
272272
*/
273-
public UpdateSketchBuilder setMemorySegmentRequest(final MemorySegmentRequest mSegReq) {
273+
public UpdatableThetaSketchBuilder setMemorySegmentRequest(final MemorySegmentRequest mSegReq) {
274274
bMemorySegmentRequest = mSegReq;
275275
return this;
276276
}
@@ -307,7 +307,7 @@ public int getNumPoolThreads() {
307307
* @param prop the given value
308308
* @return this UpdatableThetaSketchBuilder
309309
*/
310-
public UpdateSketchBuilder setPropagateOrderedCompact(final boolean prop) {
310+
public UpdatableThetaSketchBuilder setPropagateOrderedCompact(final boolean prop) {
311311
bPropagateOrderedCompact = prop;
312312
return this;
313313
}
@@ -514,7 +514,7 @@ public UpdatableThetaSketch buildLocal(final UpdatableThetaSketch shared) {
514514
@Override
515515
public String toString() {
516516
final StringBuilder sb = new StringBuilder();
517-
sb.append("UpdateSketchBuilder configuration:").append(LS);
517+
sb.append("UpdatableThetaSketchBuilder configuration:").append(LS);
518518
sb.append("LgK:").append(TAB).append(bLgNomLongs).append(LS);
519519
sb.append("K:").append(TAB).append(1 << bLgNomLongs).append(LS);
520520
sb.append("LgLocalK:").append(TAB).append(bConCurLgNomLongs).append(LS);

src/main/java/org/apache/datasketches/thetacommon/BoundsOnRatiosInTupleSketchedSets.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
import org.apache.datasketches.common.BoundsOnRatiosInSampledSets;
2525
import org.apache.datasketches.common.SketchesArgumentException;
26-
import org.apache.datasketches.tuple.Sketch;
26+
import org.apache.datasketches.tuple.TupleSketch;
2727
import org.apache.datasketches.tuple.Summary;
2828

2929
/**
@@ -60,8 +60,8 @@ private BoundsOnRatiosInTupleSketchedSets() {}
6060
* @return the approximate lower bound for B over A
6161
*/
6262
public static <S extends Summary> double getLowerBoundForBoverA(
63-
final Sketch<S> sketchA,
64-
final Sketch<S> sketchB) {
63+
final TupleSketch<S> sketchA,
64+
final TupleSketch<S> sketchB) {
6565
final long thetaLongA = sketchA.getThetaLong();
6666
final long thetaLongB = sketchB.getThetaLong();
6767
checkThetas(thetaLongA, thetaLongB);
@@ -84,7 +84,7 @@ public static <S extends Summary> double getLowerBoundForBoverA(
8484
* @return the approximate lower bound for B over A
8585
*/
8686
public static <S extends Summary> double getLowerBoundForBoverA(
87-
final Sketch<S> sketchA,
87+
final TupleSketch<S> sketchA,
8888
final org.apache.datasketches.theta.ThetaSketch sketchB) {
8989
final long thetaLongA = sketchA.getThetaLong();
9090
final long thetaLongB = sketchB.getThetaLong();
@@ -108,8 +108,8 @@ public static <S extends Summary> double getLowerBoundForBoverA(
108108
* @return the approximate upper bound for B over A
109109
*/
110110
public static <S extends Summary> double getUpperBoundForBoverA(
111-
final Sketch<S> sketchA,
112-
final Sketch<S> sketchB) {
111+
final TupleSketch<S> sketchA,
112+
final TupleSketch<S> sketchB) {
113113
final long thetaLongA = sketchA.getThetaLong();
114114
final long thetaLongB = sketchB.getThetaLong();
115115
checkThetas(thetaLongA, thetaLongB);
@@ -132,7 +132,7 @@ public static <S extends Summary> double getUpperBoundForBoverA(
132132
* @return the approximate upper bound for B over A
133133
*/
134134
public static <S extends Summary> double getUpperBoundForBoverA(
135-
final Sketch<S> sketchA,
135+
final TupleSketch<S> sketchA,
136136
final org.apache.datasketches.theta.ThetaSketch sketchB) {
137137
final long thetaLongA = sketchA.getThetaLong();
138138
final long thetaLongB = sketchB.getThetaLong();
@@ -156,8 +156,8 @@ public static <S extends Summary> double getUpperBoundForBoverA(
156156
* @return the estimate for B over A
157157
*/
158158
public static <S extends Summary> double getEstimateOfBoverA(
159-
final Sketch<S> sketchA,
160-
final Sketch<S> sketchB) {
159+
final TupleSketch<S> sketchA,
160+
final TupleSketch<S> sketchB) {
161161
final long thetaLongA = sketchA.getThetaLong();
162162
final long thetaLongB = sketchB.getThetaLong();
163163
checkThetas(thetaLongA, thetaLongB);
@@ -180,7 +180,7 @@ public static <S extends Summary> double getEstimateOfBoverA(
180180
* @return the estimate for B over A
181181
*/
182182
public static <S extends Summary> double getEstimateOfBoverA(
183-
final Sketch<S> sketchA,
183+
final TupleSketch<S> sketchA,
184184
final org.apache.datasketches.theta.ThetaSketch sketchB) {
185185
final long thetaLongA = sketchA.getThetaLong();
186186
final long thetaLongB = sketchB.getThetaLong();

src/main/java/org/apache/datasketches/tuple/CompactSketch.java renamed to src/main/java/org/apache/datasketches/tuple/CompactTupleSketch.java

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,16 @@
3232
import org.apache.datasketches.common.SketchesArgumentException;
3333

3434
/**
35-
* CompactSketches are never created directly. They are created as a result of
36-
* the compact() method of an UpdatableSketch or as a result of the getResult()
37-
* method of a set operation like Union, Intersection or AnotB. CompactSketch
38-
* consists of a compact list (i.e. no intervening spaces) of hash values,
35+
* CompactTupleSketches are never created directly. They are created as a result of
36+
* the compact() method of an UpdatableTupleSketch or as a result of the getResult()
37+
* method of a set operation like TupleUnion, TupleIntersection or TupleAnotB.
38+
* CompactTupleSketch consists of a compact list (i.e. no intervening spaces) of hash values,
3939
* corresponding list of Summaries, and a value for theta. The lists may or may
40-
* not be ordered. CompactSketch is read-only.
40+
* not be ordered. CompactTupleSketch is read-only.
4141
*
4242
* @param <S> type of Summary
4343
*/
44-
public final class CompactSketch<S extends Summary> extends Sketch<S> {
44+
public final class CompactTupleSketch<S extends Summary> extends TupleSketch<S> {
4545
private static final byte serialVersionWithSummaryClassNameUID = 1;
4646
private static final byte serialVersionUIDLegacy = 2;
4747
private static final byte serialVersionUID = 3;
@@ -54,13 +54,13 @@ private enum FlagsLegacy { IS_BIG_ENDIAN, IS_EMPTY, HAS_ENTRIES, IS_THETA_INCLUD
5454
private enum Flags { IS_RESERVED, IS_READ_ONLY, IS_EMPTY, IS_COMPACT, IS_ORDERED }
5555

5656
/**
57-
* Create a CompactSketch from correct components
57+
* Create a CompactTupleSketch from correct components
5858
* @param hashArr compacted hash array
5959
* @param summaryArr compacted summary array
6060
* @param thetaLong long value of theta
6161
* @param empty empty flag
6262
*/
63-
CompactSketch(final long[] hashArr, final S[] summaryArr, final long thetaLong, final boolean empty) {
63+
CompactTupleSketch(final long[] hashArr, final S[] summaryArr, final long thetaLong, final boolean empty) {
6464
super(thetaLong, empty, null);
6565
super.thetaLong_ = thetaLong;
6666
super.empty_ = empty;
@@ -69,12 +69,12 @@ private enum Flags { IS_RESERVED, IS_READ_ONLY, IS_EMPTY, IS_COMPACT, IS_ORDERED
6969
}
7070

7171
/**
72-
* This is to create an instance of a CompactSketch given a serialized form
72+
* This is to create an instance of a CompactTupleSketch given a serialized form
7373
*
74-
* @param seg MemorySegment object with serialized CompactSketch
74+
* @param seg MemorySegment object with serialized CompactTupleSketch
7575
* @param deserializer the SummaryDeserializer
7676
*/
77-
CompactSketch(final MemorySegment seg, final SummaryDeserializer<S> deserializer) {
77+
CompactTupleSketch(final MemorySegment seg, final SummaryDeserializer<S> deserializer) {
7878
super(Long.MAX_VALUE, true, null);
7979
int offset = 0;
8080
final byte preambleLongs = seg.get(JAVA_BYTE, offset++);
@@ -86,7 +86,7 @@ private enum Flags { IS_RESERVED, IS_READ_ONLY, IS_EMPTY, IS_COMPACT, IS_ORDERED
8686
"Unsupported serial version. Expected: " + serialVersionUID + " or lower, actual: " + version);
8787
}
8888
SerializerDeserializer
89-
.validateType(seg.get(JAVA_BYTE, offset++), SerializerDeserializer.SketchType.CompactSketch);
89+
.validateType(seg.get(JAVA_BYTE, offset++), SerializerDeserializer.SketchType.CompactTupleSketch);
9090
if (version <= serialVersionUIDLegacy) { // legacy serial format
9191
final byte flags = seg.get(JAVA_BYTE, offset++);
9292
empty_ = (flags & (1 << FlagsLegacy.IS_EMPTY.ordinal())) > 0;
@@ -166,7 +166,7 @@ private int readSummary(final MemorySegment seg, final int offset, final int i,
166166
}
167167

168168
@Override
169-
public CompactSketch<S> compact() {
169+
public CompactTupleSketch<S> compact() {
170170
return this;
171171
}
172172

@@ -214,7 +214,7 @@ public byte[] toByteArray() {
214214
bytes[offset++] = (byte) preambleLongs;
215215
bytes[offset++] = serialVersionUID;
216216
bytes[offset++] = (byte) Family.TUPLE.getID();
217-
bytes[offset++] = (byte) SerializerDeserializer.SketchType.CompactSketch.ordinal();
217+
bytes[offset++] = (byte) SerializerDeserializer.SketchType.CompactTupleSketch.ordinal();
218218
offset++; // unused
219219
bytes[offset++] = (byte) (
220220
(1 << Flags.IS_COMPACT.ordinal())

0 commit comments

Comments
 (0)