@@ -46,7 +46,7 @@ public class PrefixTreeBlockMeta {
4646
4747 public static final int
4848 NUM_LONGS = 2 ,
49- NUM_INTS = 22 ,
49+ NUM_INTS = 28 ,
5050 NUM_SHORTS = 0 ,//keyValueTypeWidth not persisted
5151 NUM_SINGLE_BYTES = 2 ,
5252 MAX_BYTES = Bytes .SIZEOF_LONG * NUM_LONGS
@@ -76,6 +76,7 @@ public class PrefixTreeBlockMeta {
7676 protected int numTimestampBytes ;
7777 protected int numMvccVersionBytes ;
7878 protected int numValueBytes ;
79+ protected int numTagsBytes ;
7980
8081 // number of bytes in each section of fixed width FInts
8182 protected int nextNodeOffsetWidth ;
@@ -85,11 +86,13 @@ public class PrefixTreeBlockMeta {
8586 protected int mvccVersionIndexWidth ;
8687 protected int valueOffsetWidth ;
8788 protected int valueLengthWidth ;
89+ protected int tagsOffsetWidth ;
8890
8991 // used to pre-allocate structures for reading
9092 protected int rowTreeDepth ;
9193 protected int maxRowLength ;
9294 protected int maxQualifierLength ;
95+ protected int maxTagsLength ;
9396
9497 // the timestamp from which the deltas are calculated
9598 protected long minTimestamp ;
@@ -103,6 +106,7 @@ public class PrefixTreeBlockMeta {
103106 protected int numUniqueRows ;
104107 protected int numUniqueFamilies ;
105108 protected int numUniqueQualifiers ;
109+ protected int numUniqueTags ;
106110
107111
108112 /***************** constructors ********************/
@@ -143,13 +147,15 @@ public int calculateNumMetaBytes(){
143147 numBytes += UVIntTool .numBytes (numRowBytes );
144148 numBytes += UVIntTool .numBytes (numFamilyBytes );
145149 numBytes += UVIntTool .numBytes (numQualifierBytes );
150+ numBytes += UVIntTool .numBytes (numTagsBytes );
146151 numBytes += UVIntTool .numBytes (numTimestampBytes );
147152 numBytes += UVIntTool .numBytes (numMvccVersionBytes );
148153 numBytes += UVIntTool .numBytes (numValueBytes );
149154
150155 numBytes += UVIntTool .numBytes (nextNodeOffsetWidth );
151156 numBytes += UVIntTool .numBytes (familyOffsetWidth );
152157 numBytes += UVIntTool .numBytes (qualifierOffsetWidth );
158+ numBytes += UVIntTool .numBytes (tagsOffsetWidth );
153159 numBytes += UVIntTool .numBytes (timestampIndexWidth );
154160 numBytes += UVIntTool .numBytes (mvccVersionIndexWidth );
155161 numBytes += UVIntTool .numBytes (valueOffsetWidth );
@@ -158,6 +164,7 @@ public int calculateNumMetaBytes(){
158164 numBytes += UVIntTool .numBytes (rowTreeDepth );
159165 numBytes += UVIntTool .numBytes (maxRowLength );
160166 numBytes += UVIntTool .numBytes (maxQualifierLength );
167+ numBytes += UVIntTool .numBytes (maxTagsLength );
161168
162169 numBytes += UVLongTool .numBytes (minTimestamp );
163170 numBytes += UVIntTool .numBytes (timestampDeltaWidth );
@@ -169,6 +176,7 @@ public int calculateNumMetaBytes(){
169176 numBytes += UVIntTool .numBytes (numUniqueRows );
170177 numBytes += UVIntTool .numBytes (numUniqueFamilies );
171178 numBytes += UVIntTool .numBytes (numUniqueQualifiers );
179+ numBytes += UVIntTool .numBytes (numUniqueTags );
172180 return numBytes ;
173181 }
174182
@@ -181,13 +189,15 @@ public void writeVariableBytesToOutputStream(OutputStream os) throws IOException
181189 UVIntTool .writeBytes (numRowBytes , os );
182190 UVIntTool .writeBytes (numFamilyBytes , os );
183191 UVIntTool .writeBytes (numQualifierBytes , os );
192+ UVIntTool .writeBytes (numTagsBytes , os );
184193 UVIntTool .writeBytes (numTimestampBytes , os );
185194 UVIntTool .writeBytes (numMvccVersionBytes , os );
186195 UVIntTool .writeBytes (numValueBytes , os );
187196
188197 UVIntTool .writeBytes (nextNodeOffsetWidth , os );
189198 UVIntTool .writeBytes (familyOffsetWidth , os );
190199 UVIntTool .writeBytes (qualifierOffsetWidth , os );
200+ UVIntTool .writeBytes (tagsOffsetWidth , os );
191201 UVIntTool .writeBytes (timestampIndexWidth , os );
192202 UVIntTool .writeBytes (mvccVersionIndexWidth , os );
193203 UVIntTool .writeBytes (valueOffsetWidth , os );
@@ -196,6 +206,7 @@ public void writeVariableBytesToOutputStream(OutputStream os) throws IOException
196206 UVIntTool .writeBytes (rowTreeDepth , os );
197207 UVIntTool .writeBytes (maxRowLength , os );
198208 UVIntTool .writeBytes (maxQualifierLength , os );
209+ UVIntTool .writeBytes (maxTagsLength , os );
199210
200211 UVLongTool .writeBytes (minTimestamp , os );
201212 UVIntTool .writeBytes (timestampDeltaWidth , os );
@@ -207,6 +218,7 @@ public void writeVariableBytesToOutputStream(OutputStream os) throws IOException
207218 UVIntTool .writeBytes (numUniqueRows , os );
208219 UVIntTool .writeBytes (numUniqueFamilies , os );
209220 UVIntTool .writeBytes (numUniqueQualifiers , os );
221+ UVIntTool .writeBytes (numUniqueTags , os );
210222 }
211223
212224 public void readVariableBytesFromInputStream (InputStream is ) throws IOException {
@@ -218,13 +230,15 @@ public void readVariableBytesFromInputStream(InputStream is) throws IOException{
218230 numRowBytes = UVIntTool .getInt (is );
219231 numFamilyBytes = UVIntTool .getInt (is );
220232 numQualifierBytes = UVIntTool .getInt (is );
233+ numTagsBytes = UVIntTool .getInt (is );
221234 numTimestampBytes = UVIntTool .getInt (is );
222235 numMvccVersionBytes = UVIntTool .getInt (is );
223236 numValueBytes = UVIntTool .getInt (is );
224237
225238 nextNodeOffsetWidth = UVIntTool .getInt (is );
226239 familyOffsetWidth = UVIntTool .getInt (is );
227240 qualifierOffsetWidth = UVIntTool .getInt (is );
241+ tagsOffsetWidth = UVIntTool .getInt (is );
228242 timestampIndexWidth = UVIntTool .getInt (is );
229243 mvccVersionIndexWidth = UVIntTool .getInt (is );
230244 valueOffsetWidth = UVIntTool .getInt (is );
@@ -233,6 +247,7 @@ public void readVariableBytesFromInputStream(InputStream is) throws IOException{
233247 rowTreeDepth = UVIntTool .getInt (is );
234248 maxRowLength = UVIntTool .getInt (is );
235249 maxQualifierLength = UVIntTool .getInt (is );
250+ maxTagsLength = UVIntTool .getInt (is );
236251
237252 minTimestamp = UVLongTool .getLong (is );
238253 timestampDeltaWidth = UVIntTool .getInt (is );
@@ -245,6 +260,7 @@ public void readVariableBytesFromInputStream(InputStream is) throws IOException{
245260 numUniqueRows = UVIntTool .getInt (is );
246261 numUniqueFamilies = UVIntTool .getInt (is );
247262 numUniqueQualifiers = UVIntTool .getInt (is );
263+ numUniqueTags = UVIntTool .getInt (is );
248264 }
249265
250266 public void readVariableBytesFromArray (byte [] bytes , int offset ) {
@@ -265,6 +281,8 @@ public void readVariableBytesFromArray(byte[] bytes, int offset) {
265281 position += UVIntTool .numBytes (numFamilyBytes );
266282 numQualifierBytes = UVIntTool .getInt (bytes , position );
267283 position += UVIntTool .numBytes (numQualifierBytes );
284+ numTagsBytes = UVIntTool .getInt (bytes , position );
285+ position += UVIntTool .numBytes (numTagsBytes );
268286 numTimestampBytes = UVIntTool .getInt (bytes , position );
269287 position += UVIntTool .numBytes (numTimestampBytes );
270288 numMvccVersionBytes = UVIntTool .getInt (bytes , position );
@@ -278,6 +296,8 @@ public void readVariableBytesFromArray(byte[] bytes, int offset) {
278296 position += UVIntTool .numBytes (familyOffsetWidth );
279297 qualifierOffsetWidth = UVIntTool .getInt (bytes , position );
280298 position += UVIntTool .numBytes (qualifierOffsetWidth );
299+ tagsOffsetWidth = UVIntTool .getInt (bytes , position );
300+ position += UVIntTool .numBytes (tagsOffsetWidth );
281301 timestampIndexWidth = UVIntTool .getInt (bytes , position );
282302 position += UVIntTool .numBytes (timestampIndexWidth );
283303 mvccVersionIndexWidth = UVIntTool .getInt (bytes , position );
@@ -293,7 +313,8 @@ public void readVariableBytesFromArray(byte[] bytes, int offset) {
293313 position += UVIntTool .numBytes (maxRowLength );
294314 maxQualifierLength = UVIntTool .getInt (bytes , position );
295315 position += UVIntTool .numBytes (maxQualifierLength );
296-
316+ maxTagsLength = UVIntTool .getInt (bytes , position );
317+ position += UVIntTool .numBytes (maxTagsLength );
297318 minTimestamp = UVLongTool .getLong (bytes , position );
298319 position += UVLongTool .numBytes (minTimestamp );
299320 timestampDeltaWidth = UVIntTool .getInt (bytes , position );
@@ -314,6 +335,8 @@ public void readVariableBytesFromArray(byte[] bytes, int offset) {
314335 position += UVIntTool .numBytes (numUniqueFamilies );
315336 numUniqueQualifiers = UVIntTool .getInt (bytes , position );
316337 position += UVIntTool .numBytes (numUniqueQualifiers );
338+ numUniqueTags = UVIntTool .getInt (bytes , position );
339+ position += UVIntTool .numBytes (numUniqueTags );
317340 }
318341
319342 //TODO method that can read directly from ByteBuffer instead of InputStream
@@ -396,6 +419,8 @@ public boolean equals(Object obj) {
396419 return false ;
397420 if (maxQualifierLength != other .maxQualifierLength )
398421 return false ;
422+ if (maxTagsLength != other .maxTagsLength )
423+ return false ;
399424 if (maxRowLength != other .maxRowLength )
400425 return false ;
401426 if (mvccVersionDeltaWidth != other .mvccVersionDeltaWidth )
@@ -418,6 +443,8 @@ public boolean equals(Object obj) {
418443 return false ;
419444 if (numQualifierBytes != other .numQualifierBytes )
420445 return false ;
446+ if (numTagsBytes != other .numTagsBytes )
447+ return false ;
421448 if (numRowBytes != other .numRowBytes )
422449 return false ;
423450 if (numTimestampBytes != other .numTimestampBytes )
@@ -426,12 +453,16 @@ public boolean equals(Object obj) {
426453 return false ;
427454 if (numUniqueQualifiers != other .numUniqueQualifiers )
428455 return false ;
456+ if (numUniqueTags != other .numUniqueTags )
457+ return false ;
429458 if (numUniqueRows != other .numUniqueRows )
430459 return false ;
431460 if (numKeyValueBytes != other .numKeyValueBytes )
432461 return false ;
433462 if (qualifierOffsetWidth != other .qualifierOffsetWidth )
434463 return false ;
464+ if (tagsOffsetWidth != other .tagsOffsetWidth )
465+ return false ;
435466 if (rowTreeDepth != other .rowTreeDepth )
436467 return false ;
437468 if (timestampDeltaWidth != other .timestampDeltaWidth )
@@ -459,6 +490,7 @@ public int hashCode() {
459490 result = prime * result + familyOffsetWidth ;
460491 result = prime * result + (includesMvccVersion ? 1231 : 1237 );
461492 result = prime * result + maxQualifierLength ;
493+ result = prime * result + maxTagsLength ;
462494 result = prime * result + maxRowLength ;
463495 result = prime * result + mvccVersionDeltaWidth ;
464496 result = prime * result + mvccVersionIndexWidth ;
@@ -470,13 +502,16 @@ public int hashCode() {
470502 result = prime * result + numMvccVersionBytes ;
471503 result = prime * result + numMetaBytes ;
472504 result = prime * result + numQualifierBytes ;
505+ result = prime * result + numTagsBytes ;
473506 result = prime * result + numRowBytes ;
474507 result = prime * result + numTimestampBytes ;
475508 result = prime * result + numUniqueFamilies ;
476509 result = prime * result + numUniqueQualifiers ;
510+ result = prime * result + numUniqueTags ;
477511 result = prime * result + numUniqueRows ;
478512 result = prime * result + numKeyValueBytes ;
479513 result = prime * result + qualifierOffsetWidth ;
514+ result = prime * result + tagsOffsetWidth ;
480515 result = prime * result + rowTreeDepth ;
481516 result = prime * result + timestampDeltaWidth ;
482517 result = prime * result + timestampIndexWidth ;
@@ -514,12 +549,16 @@ public String toString() {
514549 builder .append (numMvccVersionBytes );
515550 builder .append (", numValueBytes=" );
516551 builder .append (numValueBytes );
552+ builder .append (", numTagBytes=" );
553+ builder .append (numTagsBytes );
517554 builder .append (", nextNodeOffsetWidth=" );
518555 builder .append (nextNodeOffsetWidth );
519556 builder .append (", familyOffsetWidth=" );
520557 builder .append (familyOffsetWidth );
521558 builder .append (", qualifierOffsetWidth=" );
522559 builder .append (qualifierOffsetWidth );
560+ builder .append (", tagOffsetWidth=" );
561+ builder .append (tagsOffsetWidth );
523562 builder .append (", timestampIndexWidth=" );
524563 builder .append (timestampIndexWidth );
525564 builder .append (", mvccVersionIndexWidth=" );
@@ -534,6 +573,8 @@ public String toString() {
534573 builder .append (maxRowLength );
535574 builder .append (", maxQualifierLength=" );
536575 builder .append (maxQualifierLength );
576+ builder .append (", maxTagLength=" );
577+ builder .append (maxTagsLength );
537578 builder .append (", minTimestamp=" );
538579 builder .append (minTimestamp );
539580 builder .append (", timestampDeltaWidth=" );
@@ -552,6 +593,8 @@ public String toString() {
552593 builder .append (numUniqueFamilies );
553594 builder .append (", numUniqueQualifiers=" );
554595 builder .append (numUniqueQualifiers );
596+ builder .append (", numUniqueTags=" );
597+ builder .append (numUniqueTags );
555598 builder .append ("]" );
556599 return builder .toString ();
557600 }
@@ -575,10 +618,14 @@ public int getAbsoluteQualifierOffset() {
575618 return getAbsoluteFamilyOffset () + numFamilyBytes ;
576619 }
577620
578- public int getAbsoluteTimestampOffset () {
621+ public int getAbsoluteTagsOffset () {
579622 return getAbsoluteQualifierOffset () + numQualifierBytes ;
580623 }
581624
625+ public int getAbsoluteTimestampOffset () {
626+ return getAbsoluteTagsOffset () + numTagsBytes ;
627+ }
628+
582629 public int getAbsoluteMvccVersionOffset () {
583630 return getAbsoluteTimestampOffset () + numTimestampBytes ;
584631 }
@@ -602,10 +649,18 @@ public int getValueOffsetWidth() {
602649 return valueOffsetWidth ;
603650 }
604651
652+ public int getTagsOffsetWidth () {
653+ return tagsOffsetWidth ;
654+ }
655+
605656 public void setValueOffsetWidth (int dataOffsetWidth ) {
606657 this .valueOffsetWidth = dataOffsetWidth ;
607658 }
608659
660+ public void setTagsOffsetWidth (int dataOffsetWidth ) {
661+ this .tagsOffsetWidth = dataOffsetWidth ;
662+ }
663+
609664 public int getValueLengthWidth () {
610665 return valueLengthWidth ;
611666 }
@@ -674,6 +729,14 @@ public int getNumValueBytes() {
674729 return numValueBytes ;
675730 }
676731
732+ public int getNumTagsBytes () {
733+ return numTagsBytes ;
734+ }
735+
736+ public void setNumTagsBytes (int numTagBytes ){
737+ this .numTagsBytes = numTagBytes ;
738+ }
739+
677740 public void setNumValueBytes (int numValueBytes ) {
678741 this .numValueBytes = numValueBytes ;
679742 }
@@ -782,6 +845,13 @@ public void setNumUniqueQualifiers(int numUniqueQualifiers) {
782845 this .numUniqueQualifiers = numUniqueQualifiers ;
783846 }
784847
848+ public void setNumUniqueTags (int numUniqueTags ) {
849+ this .numUniqueTags = numUniqueTags ;
850+ }
851+
852+ public int getNumUniqueTags () {
853+ return numUniqueTags ;
854+ }
785855 public int getNumQualifierBytes () {
786856 return numQualifierBytes ;
787857 }
@@ -802,10 +872,19 @@ public int getMaxQualifierLength() {
802872 return maxQualifierLength ;
803873 }
804874
875+ // TODO : decide on some max value for this ? INTEGER_MAX?
805876 public void setMaxQualifierLength (int maxQualifierLength ) {
806877 this .maxQualifierLength = maxQualifierLength ;
807878 }
808879
880+ public int getMaxTagsLength () {
881+ return this .maxTagsLength ;
882+ }
883+
884+ public void setMaxTagsLength (int maxTagLength ) {
885+ this .maxTagsLength = maxTagLength ;
886+ }
887+
809888 public int getTimestampIndexWidth () {
810889 return timestampIndexWidth ;
811890 }
0 commit comments