@@ -45,10 +45,11 @@ public class CompressionDictionaryDetailsTabularData
4545 * We do not need to process this entry as listing does not contain any raw dictionary,
4646 * only exporting does.
4747 */
48- public static final int TABULAR_DATA_TYPE_RAW_DICTIONARY_INDEX = 3 ;
48+ public static final int TABULAR_DATA_TYPE_RAW_DICTIONARY_INDEX = 4 ;
4949
5050 public static final String KEYSPACE_NAME = "Keyspace" ;
5151 public static final String TABLE_NAME = "Table" ;
52+ public static final String TABLE_ID_NAME = "TableId" ;
5253 public static final String DICT_ID_NAME = "DictId" ;
5354 public static final String DICT_NAME = "Dict" ;
5455 public static final String KIND_NAME = "Kind" ;
@@ -58,6 +59,7 @@ public class CompressionDictionaryDetailsTabularData
5859
5960 private static final String [] ITEM_NAMES = new String []{ KEYSPACE_NAME ,
6061 TABLE_NAME ,
62+ TABLE_ID_NAME ,
6163 DICT_ID_NAME ,
6264 DICT_NAME ,
6365 KIND_NAME ,
@@ -66,6 +68,7 @@ public class CompressionDictionaryDetailsTabularData
6668
6769 private static final String [] ITEM_DESCS = new String []{ "keyspace" ,
6870 "table" ,
71+ "table_id" ,
6972 "dictionary_id" ,
7073 "dictionary_bytes" ,
7174 "kind" ,
@@ -84,6 +87,7 @@ public class CompressionDictionaryDetailsTabularData
8487 {
8588 ITEM_TYPES = new OpenType []{ SimpleType .STRING , // keyspace
8689 SimpleType .STRING , // table
90+ SimpleType .STRING , // tableId
8791 SimpleType .LONG , // dict id
8892 new ArrayType <String []>(SimpleType .BYTE , true ), // dict bytes
8993 SimpleType .STRING , // kind
@@ -115,6 +119,7 @@ public static CompositeData fromLightweightCompressionDictionary(LightweightComp
115119 {
116120 dictionary .keyspaceName ,
117121 dictionary .tableName ,
122+ dictionary .tableId ,
118123 dictionary .dictId .id ,
119124 null , // on purpose not returning actual dictionary
120125 dictionary .dictId .kind .name (),
@@ -133,10 +138,11 @@ public static CompositeData fromLightweightCompressionDictionary(LightweightComp
133138 *
134139 * @param keyspace keyspace of a dictionary
135140 * @param table table of a dictionary
141+ * @param tableId id of a table dictionary is for
136142 * @param dictionary dictionary itself
137143 * @return composite data representing dictionary
138144 */
139- public static CompositeData fromCompressionDictionary (String keyspace , String table , CompressionDictionary dictionary )
145+ public static CompositeData fromCompressionDictionary (String keyspace , String table , String tableId , CompressionDictionary dictionary )
140146 {
141147 try
142148 {
@@ -146,6 +152,7 @@ public static CompositeData fromCompressionDictionary(String keyspace, String ta
146152 {
147153 keyspace ,
148154 table ,
155+ tableId ,
149156 dictionary .dictId ().id ,
150157 dictionary .rawDictionary (),
151158 dictionary .kind ().name (),
@@ -176,6 +183,7 @@ public static CompositeData fromCompressionDictionaryDataObject(CompressionDicti
176183 {
177184 dataObject .keyspace ,
178185 dataObject .table ,
186+ dataObject .tableId ,
179187 dataObject .dictId ,
180188 dataObject .dict ,
181189 dataObject .kind ,
@@ -200,6 +208,7 @@ public static CompressionDictionaryDataObject fromCompositeData(CompositeData co
200208 {
201209 return new CompressionDictionaryDataObject ((String ) compositeData .get (CompressionDictionaryDetailsTabularData .KEYSPACE_NAME ),
202210 (String ) compositeData .get (CompressionDictionaryDetailsTabularData .TABLE_NAME ),
211+ (String ) compositeData .get (CompressionDictionaryDetailsTabularData .TABLE_ID_NAME ),
203212 (Long ) compositeData .get (CompressionDictionaryDetailsTabularData .DICT_ID_NAME ),
204213 (byte []) compositeData .get (CompressionDictionaryDetailsTabularData .DICT_NAME ),
205214 (String ) compositeData .get (CompressionDictionaryDetailsTabularData .KIND_NAME ),
@@ -211,6 +220,7 @@ public static class CompressionDictionaryDataObject
211220 {
212221 public final String keyspace ;
213222 public final String table ;
223+ public final String tableId ;
214224 public final long dictId ;
215225 public final byte [] dict ;
216226 public final String kind ;
@@ -220,6 +230,7 @@ public static class CompressionDictionaryDataObject
220230 @ JsonCreator
221231 public CompressionDictionaryDataObject (@ JsonProperty ("keyspace" ) String keyspace ,
222232 @ JsonProperty ("table" ) String table ,
233+ @ JsonProperty ("tableId" ) String tableId ,
223234 @ JsonProperty ("dictId" ) long dictId ,
224235 @ JsonProperty ("dict" ) byte [] dict ,
225236 @ JsonProperty ("kind" ) String kind ,
@@ -228,6 +239,7 @@ public CompressionDictionaryDataObject(@JsonProperty("keyspace") String keyspace
228239 {
229240 this .keyspace = keyspace ;
230241 this .table = table ;
242+ this .tableId = tableId ;
231243 this .dictId = dictId ;
232244 this .dict = dict ;
233245 this .kind = kind ;
@@ -241,7 +253,7 @@ public CompressionDictionaryDataObject(@JsonProperty("keyspace") String keyspace
241253 * An object of this class is considered to be valid if:
242254 *
243255 * <ul>
244- * <li>keyspace and table are not null</li>
256+ * <li>keyspace, table and table id are not null</li>
245257 * <li>dict id is lower than 0</li>
246258 * <li>dict is not null nor empty</li>
247259 * <li>dict length is less than or equal to 1MiB</li>
@@ -257,6 +269,8 @@ private void validate()
257269 throw new IllegalArgumentException ("Keyspace not specified." );
258270 if (table == null )
259271 throw new IllegalArgumentException ("Table not specified." );
272+ if (tableId == null )
273+ throw new IllegalArgumentException ("Table id not specified" );
260274 if (dictId <= 0 )
261275 throw new IllegalArgumentException ("Provided dictionary id must be positive but it is '" + dictId + "'." );
262276 if (dict == null || dict .length == 0 )
0 commit comments