6 * TableProperties contains read-only properties of its associated
9 public class TableProperties
{
10 private final long dataSize
;
11 private final long indexSize
;
12 private final long indexPartitions
;
13 private final long topLevelIndexSize
;
14 private final long indexKeyIsUserKey
;
15 private final long indexValueIsDeltaEncoded
;
16 private final long filterSize
;
17 private final long rawKeySize
;
18 private final long rawValueSize
;
19 private final long numDataBlocks
;
20 private final long numEntries
;
21 private final long numDeletions
;
22 private final long numMergeOperands
;
23 private final long numRangeDeletions
;
24 private final long formatVersion
;
25 private final long fixedKeyLen
;
26 private final long columnFamilyId
;
27 private final long creationTime
;
28 private final long oldestKeyTime
;
29 private final byte[] columnFamilyName
;
30 private final String filterPolicyName
;
31 private final String comparatorName
;
32 private final String mergeOperatorName
;
33 private final String prefixExtractorName
;
34 private final String propertyCollectorsNames
;
35 private final String compressionName
;
36 private final Map
<String
, String
> userCollectedProperties
;
37 private final Map
<String
, String
> readableProperties
;
38 private final Map
<String
, Long
> propertiesOffsets
;
41 * Access is private as this will only be constructed from
44 private TableProperties(final long dataSize
, final long indexSize
,
45 final long indexPartitions
, final long topLevelIndexSize
,
46 final long indexKeyIsUserKey
, final long indexValueIsDeltaEncoded
,
47 final long filterSize
, final long rawKeySize
, final long rawValueSize
,
48 final long numDataBlocks
, final long numEntries
, final long numDeletions
,
49 final long numMergeOperands
, final long numRangeDeletions
,
50 final long formatVersion
, final long fixedKeyLen
,
51 final long columnFamilyId
, final long creationTime
,
52 final long oldestKeyTime
, final byte[] columnFamilyName
,
53 final String filterPolicyName
, final String comparatorName
,
54 final String mergeOperatorName
, final String prefixExtractorName
,
55 final String propertyCollectorsNames
, final String compressionName
,
56 final Map
<String
, String
> userCollectedProperties
,
57 final Map
<String
, String
> readableProperties
,
58 final Map
<String
, Long
> propertiesOffsets
) {
59 this.dataSize
= dataSize
;
60 this.indexSize
= indexSize
;
61 this.indexPartitions
= indexPartitions
;
62 this.topLevelIndexSize
= topLevelIndexSize
;
63 this.indexKeyIsUserKey
= indexKeyIsUserKey
;
64 this.indexValueIsDeltaEncoded
= indexValueIsDeltaEncoded
;
65 this.filterSize
= filterSize
;
66 this.rawKeySize
= rawKeySize
;
67 this.rawValueSize
= rawValueSize
;
68 this.numDataBlocks
= numDataBlocks
;
69 this.numEntries
= numEntries
;
70 this.numDeletions
= numDeletions
;
71 this.numMergeOperands
= numMergeOperands
;
72 this.numRangeDeletions
= numRangeDeletions
;
73 this.formatVersion
= formatVersion
;
74 this.fixedKeyLen
= fixedKeyLen
;
75 this.columnFamilyId
= columnFamilyId
;
76 this.creationTime
= creationTime
;
77 this.oldestKeyTime
= oldestKeyTime
;
78 this.columnFamilyName
= columnFamilyName
;
79 this.filterPolicyName
= filterPolicyName
;
80 this.comparatorName
= comparatorName
;
81 this.mergeOperatorName
= mergeOperatorName
;
82 this.prefixExtractorName
= prefixExtractorName
;
83 this.propertyCollectorsNames
= propertyCollectorsNames
;
84 this.compressionName
= compressionName
;
85 this.userCollectedProperties
= userCollectedProperties
;
86 this.readableProperties
= readableProperties
;
87 this.propertiesOffsets
= propertiesOffsets
;
91 * Get the total size of all data blocks.
93 * @return the total size of all data blocks.
95 public long getDataSize() {
100 * Get the size of index block.
102 * @return the size of index block.
104 public long getIndexSize() {
109 * Get the total number of index partitions
110 * if {@link IndexType#kTwoLevelIndexSearch} is used.
112 * @return the total number of index partitions.
114 public long getIndexPartitions() {
115 return indexPartitions
;
119 * Size of the top-level index
120 * if {@link IndexType#kTwoLevelIndexSearch} is used.
122 * @return the size of the top-level index.
124 public long getTopLevelIndexSize() {
125 return topLevelIndexSize
;
129 * Whether the index key is user key.
130 * Otherwise it includes 8 byte of sequence
131 * number added by internal key format.
133 * @return the index key
135 public long getIndexKeyIsUserKey() {
136 return indexKeyIsUserKey
;
140 * Whether delta encoding is used to encode the index values.
142 * @return whether delta encoding is used to encode the index values.
144 public long getIndexValueIsDeltaEncoded() {
145 return indexValueIsDeltaEncoded
;
149 * Get the size of filter block.
151 * @return the size of filter block.
153 public long getFilterSize() {
158 * Get the total raw key size.
160 * @return the total raw key size.
162 public long getRawKeySize() {
167 * Get the total raw value size.
169 * @return the total raw value size.
171 public long getRawValueSize() {
176 * Get the number of blocks in this table.
178 * @return the number of blocks in this table.
180 public long getNumDataBlocks() {
181 return numDataBlocks
;
185 * Get the number of entries in this table.
187 * @return the number of entries in this table.
189 public long getNumEntries() {
194 * Get the number of deletions in the table.
196 * @return the number of deletions in the table.
198 public long getNumDeletions() {
203 * Get the number of merge operands in the table.
205 * @return the number of merge operands in the table.
207 public long getNumMergeOperands() {
208 return numMergeOperands
;
212 * Get the number of range deletions in this table.
214 * @return the number of range deletions in this table.
216 public long getNumRangeDeletions() {
217 return numRangeDeletions
;
221 * Get the format version, reserved for backward compatibility.
223 * @return the format version.
225 public long getFormatVersion() {
226 return formatVersion
;
230 * Get the length of the keys.
232 * @return 0 when the key is variable length, otherwise number of
233 * bytes for each key.
235 public long getFixedKeyLen() {
240 * Get the ID of column family for this SST file,
241 * corresponding to the column family identified by
242 * {@link #getColumnFamilyName()}.
244 * @return the id of the column family.
246 public long getColumnFamilyId() {
247 return columnFamilyId
;
251 * The time when the SST file was created.
252 * Since SST files are immutable, this is equivalent
253 * to last modified time.
255 * @return the created time.
257 public long getCreationTime() {
262 * Get the timestamp of the earliest key.
264 * @return 0 means unknown, otherwise the timestamp.
266 public long getOldestKeyTime() {
267 return oldestKeyTime
;
271 * Get the name of the column family with which this
272 * SST file is associated.
274 * @return the name of the column family, or null if the
275 * column family is unknown.
277 /*@Nullable*/ public byte[] getColumnFamilyName() {
278 return columnFamilyName
;
282 * Get the name of the filter policy used in this table.
284 * @return the name of the filter policy, or null if
285 * no filter policy is used.
287 /*@Nullable*/ public String
getFilterPolicyName() {
288 return filterPolicyName
;
292 * Get the name of the comparator used in this table.
294 * @return the name of the comparator.
296 public String
getComparatorName() {
297 return comparatorName
;
301 * Get the name of the merge operator used in this table.
303 * @return the name of the merge operator, or null if no merge operator
306 /*@Nullable*/ public String
getMergeOperatorName() {
307 return mergeOperatorName
;
311 * Get the name of the prefix extractor used in this table.
313 * @return the name of the prefix extractor, or null if no prefix
316 /*@Nullable*/ public String
getPrefixExtractorName() {
317 return prefixExtractorName
;
321 * Get the names of the property collectors factories used in this table.
323 * @return the names of the property collector factories separated
324 * by commas, e.g. {collector_name[1]},{collector_name[2]},...
326 public String
getPropertyCollectorsNames() {
327 return propertyCollectorsNames
;
331 * Get the name of the compression algorithm used to compress the SST files.
333 * @return the name of the compression algorithm.
335 public String
getCompressionName() {
336 return compressionName
;
340 * Get the user collected properties.
342 * @return the user collected properties.
344 public Map
<String
, String
> getUserCollectedProperties() {
345 return userCollectedProperties
;
349 * Get the readable properties.
351 * @return the readable properties.
353 public Map
<String
, String
> getReadableProperties() {
354 return readableProperties
;
358 * The offset of the value of each property in the file.
360 * @return the offset of each property.
362 public Map
<String
, Long
> getPropertiesOffsets() {
363 return propertiesOffsets
;