Skip to content

Commit 36e2e08

Browse files
committed
Forgot to stage the previous commit. All the classes affected by the
name changes for Theta.
1 parent b8b988d commit 36e2e08

73 files changed

Lines changed: 1965 additions & 1997 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/theta/CompactOperations.java

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ final class CompactOperations {
6060

6161
private CompactOperations() {}
6262

63-
static CompactSketch componentsToCompact( //No error checking
63+
static CompactThetaSketch componentsToCompact( //No error checking
6464
final long thetaLong,
6565
final int curCount,
6666
final short seedHash,
@@ -108,15 +108,15 @@ static CompactSketch componentsToCompact( //No error checking
108108
}
109109

110110
/**
111-
* Heapify or convert a source Theta Sketch MemorySegment image into a heap or target MemorySegment CompactSketch.
111+
* Heapify or convert a source ThetaSketch MemorySegment image into a heap or target MemorySegment CompactThetaSketch.
112112
* This assumes hashSeed is OK; serVer = 3.
113113
* @param srcSeg the given input source MemorySegment image. Can be Read Only.
114-
* @param dstOrdered the desired ordering of the resulting CompactSketch
115-
* @param dstWSeg Used for the target CompactSketch if it is MemorySegment-based. Must be Writable.
116-
* @return a CompactSketch of the correct form.
114+
* @param dstOrdered the desired ordering of the resulting CompactThetaSketch
115+
* @param dstWSeg Used for the target CompactThetaSketch if it is MemorySegment-based. Must be Writable.
116+
* @return a CompactThetaSketch of the correct form.
117117
*/
118118
@SuppressWarnings("unused")
119-
static CompactSketch segmentToCompact(
119+
static CompactThetaSketch segmentToCompact(
120120
final MemorySegment srcSeg,
121121
final boolean dstOrdered,
122122
final MemorySegment dstWSeg)
@@ -233,7 +233,7 @@ static MemorySegment loadCompactMemorySegment(
233233
}
234234
final byte famID = (byte) Family.COMPACT.getID();
235235

236-
//It is important to make sure that all byte fields are initialized, even those that are not used by the CompactSketch.
236+
//It is important to make sure that all byte fields are initialized, even those that are not used by the CompactThetaSketch.
237237
// Otherwise, uninitialized fields could could cause other problems downstream.
238238
// As written below, all fields are initialized.
239239

@@ -242,7 +242,7 @@ static MemorySegment loadCompactMemorySegment(
242242
insertSerVer(dstWSeg, SER_VER);
243243
insertFamilyID(dstWSeg, famID);
244244
//The following initializes the lgNomLongs and lgArrLongs to 0.
245-
//They are not used in CompactSketches.
245+
//They are not used in CompactThetaSketches.
246246
dstWSeg.set(JAVA_SHORT_UNALIGNED, LG_NOM_LONGS_BYTE, (short)0);
247247
insertFlags(dstWSeg, flags);
248248
insertSeedHash(dstWSeg, seedHash);
@@ -305,15 +305,15 @@ static long[] compactCache(final long[] srcCache, final int curCount,
305305
* Num Theta CurCount Empty State Name, Comments
306306
* 0 1.0 0 T OK EMPTY: The Normal Empty State
307307
* 1 1.0 0 F Internal This can occur internally as the result of an intersection of two exact,
308-
* disjoint sets, or AnotB of two exact, identical sets. There is no probability
308+
* disjoint sets, or ThetaAnotB of two exact, identical sets. There is no probability
309309
* distribution, so this is converted internally to EMPTY {1.0, 0, T}.
310-
* This is handled in SetOperation.createCompactSketch().
310+
* This is handled in ThetaSetOperation.createCompactThetaSketch().
311311
* 2 1.0 !0 T Error Empty=T and curCount !0 should never coexist.
312312
* This is checked in all compacting operations.
313313
* 3 1.0 !0 F OK EXACT: This corresponds to a sketch in exact mode
314-
* 4 <1.0 0 T Internal This can be an initial UpdateSketch state if p < 1.0,
314+
* 4 <1.0 0 T Internal This can be an initial UpdatableThetaSketch state if p < 1.0,
315315
* so change theta to 1.0. Return {Th = 1.0, 0, T}.
316-
* This is handled in UpdateSketch.compact() and toByteArray().
316+
* This is handled in UpdatableThetaSketch.compact() and toByteArray().
317317
* 5 <1.0 0 F OK This can result from set operations
318318
* 6 <1.0 !0 T Error Empty=T and curCount !0 should never coexist.
319319
* This is checked in all compacting operations.
@@ -324,11 +324,11 @@ static long[] compactCache(final long[] srcCache, final int curCount,
324324
*/
325325

326326
/**
327-
* This corrects a temporary anomalous condition where compact() or toByteArray() is called on an UpdateSketch
327+
* This corrects a temporary anomalous condition where compact() or toByteArray() is called on an UpdatableThetaSketch
328328
* that was initialized with p < 1.0 and update() was never called. In this case Theta < 1.0,
329329
* curCount = 0, and empty = true. The correction is to change Theta to 1.0, which makes the
330330
* returning sketch empty. This should only be used in the compaction or serialization of an
331-
* UpdateSketch.
331+
* UpdatableThetaSketch.
332332
* @param empty the given empty state
333333
* @param curCount the given curCount
334334
* @param thetaLong the given thetaLong
@@ -355,7 +355,7 @@ static void checkIllegalCurCountAndEmpty(final boolean empty, final int curCount
355355
/**
356356
* This compute number of preamble longs for a compact sketch based on <i>empty</i>,
357357
* <i>curCount</i> and <i>thetaLong</i>.
358-
* This also accommodates for EmptyCompactSketch and SingleItemSketch.
358+
* This also accommodates for EmptyCompactThetaSketch and SingleItemThetaSketch.
359359
* @param empty The given empty state
360360
* @param curCount The given current count (retained entries)
361361
* @param thetaLong the current thetaLong
@@ -367,7 +367,7 @@ static int computeCompactPreLongs(final boolean empty, final int curCount,
367367
}
368368

369369
/**
370-
* This checks for the singleItem Compact Sketch.
370+
* This checks for the singleItem CompactThetaSketch.
371371
* @param empty the given empty state
372372
* @param curCount the given curCount
373373
* @param thetaLong the given thetaLong

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

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -46,49 +46,49 @@
4646
import org.apache.datasketches.common.Util;
4747

4848
/**
49-
* The parent class of all the CompactSketches. CompactSketches are never created directly.
50-
* They are created as a result of the compact() method of an UpdateSketch, a result of a
51-
* getResult() of a SetOperation, or from a heapify method.
49+
* The parent class of all the CompactThetaSketches. CompactThetaSketches are never created directly.
50+
* They are created as a result of the compact() method of an UpdatableThetaSketch, a result of a
51+
* getResult() of a ThetaSetOperation, or from a heapify method.
5252
*
53-
* <p>A CompactSketch is the simplest form of a Theta Sketch. It consists of a compact list
53+
* <p>A CompactThetaSketch is the simplest form of a ThetaSketches. It consists of a compact list
5454
* (i.e., no intervening spaces) of hash values, which may be ordered or not, a value for theta
55-
* and a seed hash. A CompactSketch is immutable (read-only),
55+
* and a seed hash. A CompactThetaSketch is immutable (read-only),
5656
* and the space required when stored is only the space required for the hash values and 8 to 24
57-
* bytes of preamble. An empty CompactSketch consumes only 8 bytes.</p>
57+
* bytes of preamble. An empty CompactThetaSketch consumes only 8 bytes.</p>
5858
*
5959
* @author Lee Rhodes
6060
*/
61-
public abstract class CompactSketch extends ThetaSketch {
61+
public abstract class CompactThetaSketch extends ThetaSketch {
6262

6363
/**
64-
* Heapify takes a CompactSketch image in a MemorySegment and instantiates an on-heap CompactSketch.
64+
* Heapify takes a CompactThetaSketch image in a MemorySegment and instantiates an on-heap CompactThetaSketch.
6565
*
6666
* <p>The resulting sketch will not retain any link to the source MemorySegment and all of its data will be
67-
* copied to the heap CompactSketch.</p>
67+
* copied to the heap CompactThetaSketch.</p>
6868
*
6969
* <p>The {@link Util#DEFAULT_UPDATE_SEED DEFAULT_UPDATE_SEED} is assumed.</p>
7070
*
71-
* @param srcSeg an image of a CompactSketch.
72-
* @return a CompactSketch on the heap.
71+
* @param srcSeg an image of a CompactThetaSketch.
72+
* @return a CompactThetaSketch on the heap.
7373
*/
74-
public static CompactSketch heapify(final MemorySegment srcSeg) {
74+
public static CompactThetaSketch heapify(final MemorySegment srcSeg) {
7575
return heapify(srcSeg, Util.DEFAULT_UPDATE_SEED);
7676
}
7777

7878
/**
79-
* Heapify takes a CompactSketch image in a MemorySegment and instantiates an on-heap CompactSketch.
79+
* Heapify takes a CompactThetaSketch image in a MemorySegment and instantiates an on-heap CompactThetaSketch.
8080
*
8181
* <p>The resulting sketch will not retain any link to the source MemorySegment and all of its data will be
82-
* copied to the heap CompactSketch.</p>
82+
* copied to the heap CompactThetaSketch.</p>
8383
*
8484
* <p>This method checks if the given expectedSeed was used to create the source MemorySegment image.</p>
8585
*
86-
* @param srcSeg an image of a CompactSketch that was created using the given expectedSeed.
86+
* @param srcSeg an image of a CompactThetaSketch that was created using the given expectedSeed.
8787
* @param expectedSeed the seed used to validate the given MemorySegment image.
8888
* <a href="{@docRoot}/resources/dictionary.html#seed">See Update Hash Seed</a>.
89-
* @return a CompactSketch on the heap.
89+
* @return a CompactThetaSketch on the heap.
9090
*/
91-
public static CompactSketch heapify(final MemorySegment srcSeg, final long expectedSeed) {
91+
public static CompactThetaSketch heapify(final MemorySegment srcSeg, final long expectedSeed) {
9292
final int serVer = extractSerVer(srcSeg);
9393
final int familyID = extractFamilyID(srcSeg);
9494
final Family family = idToFamily(familyID);
@@ -111,7 +111,7 @@ public static CompactSketch heapify(final MemorySegment srcSeg, final long expec
111111
}
112112

113113
/**
114-
* Wrap takes the CompactSketch image in given MemorySegment and refers to it directly.
114+
* Wrap takes the CompactThetaSketch image in given MemorySegment and refers to it directly.
115115
* There is no data copying onto the java heap.
116116
* The wrap operation enables fast read-only merging and access to all the public read-only API.
117117
*
@@ -121,10 +121,10 @@ public static CompactSketch heapify(final MemorySegment srcSeg, final long expec
121121
*
122122
* <p>The {@link Util#DEFAULT_UPDATE_SEED DEFAULT_UPDATE_SEED} is assumed.</p>
123123
*
124-
* @param srcSeg an image of a Sketch.
125-
* @return a CompactSketch backed by the given MemorySegment.
124+
* @param srcSeg an image of a CompactThetaSketch.
125+
* @return a CompactThetaSketch backed by the given MemorySegment.
126126
*/
127-
public static CompactSketch wrap(final MemorySegment srcSeg) {
127+
public static CompactThetaSketch wrap(final MemorySegment srcSeg) {
128128
return wrap(srcSeg, Util.DEFAULT_UPDATE_SEED);
129129
}
130130

@@ -139,12 +139,12 @@ public static CompactSketch wrap(final MemorySegment srcSeg) {
139139
*
140140
* <p>This method checks if the given expectedSeed was used to create the source MemorySegment image.</p>
141141
*
142-
* @param srcSeg an image of a Sketch that was created using the given expectedSeed.
142+
* @param srcSeg an image of a CompactThetaSketch that was created using the given expectedSeed.
143143
* @param expectedSeed the seed used to validate the given MemorySegment image.
144144
* <a href="{@docRoot}/resources/dictionary.html#seed">See Update Hash Seed</a>.
145-
* @return a CompactSketch backed by the given MemorySegment.
145+
* @return a CompactThetaketch backed by the given MemorySegment.
146146
*/
147-
public static CompactSketch wrap(final MemorySegment srcSeg, final long expectedSeed) {
147+
public static CompactThetaSketch wrap(final MemorySegment srcSeg, final long expectedSeed) {
148148
final int serVer = extractSerVer(srcSeg);
149149
final int familyID = extractFamilyID(srcSeg);
150150
final Family family = Family.idToFamily(familyID);
@@ -196,11 +196,11 @@ public static CompactSketch wrap(final MemorySegment srcSeg, final long expected
196196
*
197197
* <p>This method checks if the DEFAULT_UPDATE_SEED was used to create the source byte array image.</p>
198198
*
199-
* @param bytes a byte array image of a Sketch that was created using the DEFAULT_UPDATE_SEED.
199+
* @param bytes a byte array image of a CompactThetaSketch that was created using the DEFAULT_UPDATE_SEED.
200200
*
201-
* @return a CompactSketch backed by the given byte array except as above.
201+
* @return a CompactThetaSketch backed by the given byte array except as above.
202202
*/
203-
public static CompactSketch wrap(final byte[] bytes) {
203+
public static CompactThetaSketch wrap(final byte[] bytes) {
204204
return wrap(bytes, Util.DEFAULT_UPDATE_SEED);
205205
}
206206

@@ -217,12 +217,12 @@ public static CompactSketch wrap(final byte[] bytes) {
217217
*
218218
* <p>This method checks if the given expectedSeed was used to create the source byte array image.</p>
219219
*
220-
* @param bytes a byte array image of a Sketch that was created using the given expectedSeed.
220+
* @param bytes a byte array image of a CompactThetaSketch that was created using the given expectedSeed.
221221
* @param expectedSeed the seed used to validate the given byte array image.
222222
* <a href="{@docRoot}/resources/dictionary.html#seed">See Update Hash Seed</a>.
223-
* @return a CompactSketch backed by the given byte array except as above.
223+
* @return a CompactThetaSketch backed by the given byte array except as above.
224224
*/
225-
public static CompactSketch wrap(final byte[] bytes, final long expectedSeed) {
225+
public static CompactThetaSketch wrap(final byte[] bytes, final long expectedSeed) {
226226
final int serVer = bytes[PreambleUtil.SER_VER_BYTE];
227227
final int familyId = bytes[PreambleUtil.FAMILY_BYTE];
228228
final Family family = Family.idToFamily(familyId);
@@ -261,10 +261,10 @@ public static CompactSketch wrap(final byte[] bytes, final long expectedSeed) {
261261
"Corrupted: Serialization Version " + serVer + " not recognized.");
262262
}
263263

264-
//Sketch Overrides
264+
//ThetaSketch Overrides
265265

266266
@Override
267-
public abstract CompactSketch compact(final boolean dstOrdered, final MemorySegment dstSeg);
267+
public abstract CompactThetaSketch compact(final boolean dstOrdered, final MemorySegment dstSeg);
268268

269269
@Override
270270
public int getCompactBytes() {
@@ -385,7 +385,7 @@ private byte[] toByteArrayV4() {
385385
return bytes;
386386
}
387387

388-
private static CompactSketch heapifyV4(final MemorySegment srcSeg, final long seed) {
388+
private static CompactThetaSketch heapifyV4(final MemorySegment srcSeg, final long seed) {
389389
final int preLongs = ThetaSketch.getPreambleLongs(srcSeg);
390390
final int entryBits = extractEntryBitsV4(srcSeg);
391391
final int numEntriesBytes = extractNumEntriesBytesV4(srcSeg);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ final class ConcurrentBackgroundThetaPropagation implements Runnable {
3939
// local buffer. Updated when the propagation completes.
4040
private final AtomicBoolean localPropagationInProgress;
4141

42-
// Sketch to be propagated to shared sketch. Can be null if only a single hash is propagated
42+
// ThetaSketch to be propagated to shared sketch. Can be null if only a single hash is propagated
4343
private final ThetaSketch sketchIn;
4444

4545
// Hash of the datum to be propagated to shared sketch. Can be ConcurrentSharedThetaSketch.NOT_SINGLE_HASH

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ final class ConcurrentDirectQuickSelectSketch extends DirectQuickSelectSketch
8888
initBgPropagationService();
8989
}
9090

91-
ConcurrentDirectQuickSelectSketch(final UpdateSketch sketch, final long seed,
91+
ConcurrentDirectQuickSelectSketch(final UpdatableThetaSketch sketch, final long seed,
9292
final double maxConcurrencyError, final MemorySegment dstSeg) {
9393
super(sketch.getLgNomLongs(), seed, 1.0F, //p
9494
ResizeFactor.X1, //rf,
@@ -109,7 +109,7 @@ final class ConcurrentDirectQuickSelectSketch extends DirectQuickSelectSketch
109109
updateEstimationSnapshot();
110110
}
111111

112-
//Sketch overrides
112+
//ThetaSketch overrides
113113

114114
@Override
115115
public double getEstimate() {
@@ -129,10 +129,10 @@ public byte[] toByteArray() {
129129
return res;
130130
}
131131

132-
//UpdateSketch overrides
132+
//UpdatableThetaSketch overrides
133133

134134
@Override
135-
public UpdateSketch rebuild() {
135+
public UpdatableThetaSketch rebuild() {
136136
super.rebuild();
137137
updateEstimationSnapshot();
138138
return this;

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
import org.apache.datasketches.common.SuppressFBWarnings;
2828

2929
/**
30-
* A concurrent shared sketch that is based on HeapQuickSelectSketch.
30+
* A concurrent shared sketch that is based on HeapQuickSelectThetaSketch.
3131
* It reflects all data processed by a single or multiple update threads, and can serve queries at
3232
* any time.
3333
* Background propagation threads are used to propagate data from thread local buffers into this
@@ -82,7 +82,7 @@ final class ConcurrentHeapQuickSelectSketch extends HeapQuickSelectSketch
8282
initBgPropagationService();
8383
}
8484

85-
ConcurrentHeapQuickSelectSketch(final UpdateSketch sketch, final long seed,
85+
ConcurrentHeapQuickSelectSketch(final UpdatableThetaSketch sketch, final long seed,
8686
final double maxConcurrencyError) {
8787
super(sketch.getLgNomLongs(), seed, 1.0F, //p
8888
ResizeFactor.X1, //rf,
@@ -101,7 +101,7 @@ final class ConcurrentHeapQuickSelectSketch extends HeapQuickSelectSketch
101101
updateEstimationSnapshot();
102102
}
103103

104-
//Sketch overrides
104+
//ThetaSketch overrides
105105

106106
@Override
107107
public double getEstimate() {
@@ -121,10 +121,10 @@ public byte[] toByteArray() {
121121
return res;
122122
}
123123

124-
//UpdateSketch overrides
124+
//UpdatableThetaSketch overrides
125125

126126
@Override
127-
public UpdateSketch rebuild() {
127+
public UpdatableThetaSketch rebuild() {
128128
super.rebuild();
129129
updateEstimationSnapshot();
130130
return this;

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,10 @@
4242
* Propagation is done either synchronously by the updating thread, or asynchronously by a
4343
* background propagation thread.
4444
*
45-
* <p>This is a buffer, not a sketch, and it extends the <i>HeapQuickSelectSketch</i>
45+
* <p>This is a buffer, not a sketch, and it extends the <i>HeapQuickSelectThetaSketch</i>
4646
* in order to leverage some of the sketch machinery to make its work simple. However, if this
4747
* buffer receives a query, like <i>getEstimate()</i>, the correct answer does not come from the super
48-
* <i>HeapQuickSelectSketch</i>, which knows nothing about the concurrency relationship to the
48+
* <i>HeapQuickSelectThetaSketch</i>, which knows nothing about the concurrency relationship to the
4949
* shared concurrent sketch, it must come from the shared concurrent sketch. As a result nearly all
5050
* of the inherited sketch methods are redirected to the shared concurrent sketch.
5151
*
@@ -111,15 +111,15 @@ private void propagateToSharedSketch() {
111111
//no inspection StatementWithEmptyBody
112112
while (localPropagationInProgress.get()) { /* busy wait until previous propagation completed */ }
113113

114-
final CompactSketch compactSketch = compact(propagateOrderedCompact, null);
114+
final CompactThetaSketch compactSketch = compact(propagateOrderedCompact, null);
115115
localPropagationInProgress.set(true);
116116
shared.propagate(localPropagationInProgress, compactSketch,
117117
ConcurrentSharedThetaSketch.NOT_SINGLE_HASH);
118118
super.reset();
119119
thetaLong_ = shared.getVolatileTheta();
120120
}
121121

122-
//Public Sketch overrides proxies to shared concurrent sketch
122+
//Public ThetaSketch overrides proxies to shared ConcurrentThetaSketch
123123

124124
@Override
125125
public int getCompactBytes() {
@@ -178,7 +178,7 @@ public byte[] toByteArray() {
178178
throw new UnsupportedOperationException("Local theta buffer need not be serialized");
179179
}
180180

181-
//Public UpdateSketch overrides
181+
//Public UpdatableThetaSketch overrides
182182

183183
@Override
184184
public void reset() {
@@ -187,7 +187,7 @@ public void reset() {
187187
localPropagationInProgress.set(false);
188188
}
189189

190-
//Restricted UpdateSketch overrides
190+
//Restricted UpdatableThetaSketch overrides
191191

192192
/**
193193
* Updates buffer with given hash value.

0 commit comments

Comments
 (0)