1 // Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
7 * TableProperties contains read-only properties of its associated
10 public class TableProperties
{
11 private final long dataSize
;
12 private final long indexSize
;
13 private final long indexPartitions
;
14 private final long topLevelIndexSize
;
15 private final long indexKeyIsUserKey
;
16 private final long indexValueIsDeltaEncoded
;
17 private final long filterSize
;
18 private final long rawKeySize
;
19 private final long rawValueSize
;
20 private final long numDataBlocks
;
21 private final long numEntries
;
22 private final long numDeletions
;
23 private final long numMergeOperands
;
24 private final long numRangeDeletions
;
25 private final long formatVersion
;
26 private final long fixedKeyLen
;
27 private final long columnFamilyId
;
28 private final long creationTime
;
29 private final long oldestKeyTime
;
30 private final byte[] columnFamilyName
;
31 private final String filterPolicyName
;
32 private final String comparatorName
;
33 private final String mergeOperatorName
;
34 private final String prefixExtractorName
;
35 private final String propertyCollectorsNames
;
36 private final String compressionName
;
37 private final Map
<String
, String
> userCollectedProperties
;
38 private final Map
<String
, String
> readableProperties
;
39 private final Map
<String
, Long
> propertiesOffsets
;
42 * Access is private as this will only be constructed from
45 private TableProperties(final long dataSize
, final long indexSize
,
46 final long indexPartitions
, final long topLevelIndexSize
,
47 final long indexKeyIsUserKey
, final long indexValueIsDeltaEncoded
,
48 final long filterSize
, final long rawKeySize
, final long rawValueSize
,
49 final long numDataBlocks
, final long numEntries
, final long numDeletions
,
50 final long numMergeOperands
, final long numRangeDeletions
,
51 final long formatVersion
, final long fixedKeyLen
,
52 final long columnFamilyId
, final long creationTime
,
53 final long oldestKeyTime
, final byte[] columnFamilyName
,
54 final String filterPolicyName
, final String comparatorName
,
55 final String mergeOperatorName
, final String prefixExtractorName
,
56 final String propertyCollectorsNames
, final String compressionName
,
57 final Map
<String
, String
> userCollectedProperties
,
58 final Map
<String
, String
> readableProperties
,
59 final Map
<String
, Long
> propertiesOffsets
) {
60 this.dataSize
= dataSize
;
61 this.indexSize
= indexSize
;
62 this.indexPartitions
= indexPartitions
;
63 this.topLevelIndexSize
= topLevelIndexSize
;
64 this.indexKeyIsUserKey
= indexKeyIsUserKey
;
65 this.indexValueIsDeltaEncoded
= indexValueIsDeltaEncoded
;
66 this.filterSize
= filterSize
;
67 this.rawKeySize
= rawKeySize
;
68 this.rawValueSize
= rawValueSize
;
69 this.numDataBlocks
= numDataBlocks
;
70 this.numEntries
= numEntries
;
71 this.numDeletions
= numDeletions
;
72 this.numMergeOperands
= numMergeOperands
;
73 this.numRangeDeletions
= numRangeDeletions
;
74 this.formatVersion
= formatVersion
;
75 this.fixedKeyLen
= fixedKeyLen
;
76 this.columnFamilyId
= columnFamilyId
;
77 this.creationTime
= creationTime
;
78 this.oldestKeyTime
= oldestKeyTime
;
79 this.columnFamilyName
= columnFamilyName
;
80 this.filterPolicyName
= filterPolicyName
;
81 this.comparatorName
= comparatorName
;
82 this.mergeOperatorName
= mergeOperatorName
;
83 this.prefixExtractorName
= prefixExtractorName
;
84 this.propertyCollectorsNames
= propertyCollectorsNames
;
85 this.compressionName
= compressionName
;
86 this.userCollectedProperties
= userCollectedProperties
;
87 this.readableProperties
= readableProperties
;
88 this.propertiesOffsets
= propertiesOffsets
;
92 * Get the total size of all data blocks.
94 * @return the total size of all data blocks.
96 public long getDataSize() {
101 * Get the size of index block.
103 * @return the size of index block.
105 public long getIndexSize() {
110 * Get the total number of index partitions
111 * if {@link IndexType#kTwoLevelIndexSearch} is used.
113 * @return the total number of index partitions.
115 public long getIndexPartitions() {
116 return indexPartitions
;
120 * Size of the top-level index
121 * if {@link IndexType#kTwoLevelIndexSearch} is used.
123 * @return the size of the top-level index.
125 public long getTopLevelIndexSize() {
126 return topLevelIndexSize
;
130 * Whether the index key is user key.
131 * Otherwise it includes 8 byte of sequence
132 * number added by internal key format.
134 * @return the index key
136 public long getIndexKeyIsUserKey() {
137 return indexKeyIsUserKey
;
141 * Whether delta encoding is used to encode the index values.
143 * @return whether delta encoding is used to encode the index values.
145 public long getIndexValueIsDeltaEncoded() {
146 return indexValueIsDeltaEncoded
;
150 * Get the size of filter block.
152 * @return the size of filter block.
154 public long getFilterSize() {
159 * Get the total raw key size.
161 * @return the total raw key size.
163 public long getRawKeySize() {
168 * Get the total raw value size.
170 * @return the total raw value size.
172 public long getRawValueSize() {
177 * Get the number of blocks in this table.
179 * @return the number of blocks in this table.
181 public long getNumDataBlocks() {
182 return numDataBlocks
;
186 * Get the number of entries in this table.
188 * @return the number of entries in this table.
190 public long getNumEntries() {
195 * Get the number of deletions in the table.
197 * @return the number of deletions in the table.
199 public long getNumDeletions() {
204 * Get the number of merge operands in the table.
206 * @return the number of merge operands in the table.
208 public long getNumMergeOperands() {
209 return numMergeOperands
;
213 * Get the number of range deletions in this table.
215 * @return the number of range deletions in this table.
217 public long getNumRangeDeletions() {
218 return numRangeDeletions
;
222 * Get the format version, reserved for backward compatibility.
224 * @return the format version.
226 public long getFormatVersion() {
227 return formatVersion
;
231 * Get the length of the keys.
233 * @return 0 when the key is variable length, otherwise number of
234 * bytes for each key.
236 public long getFixedKeyLen() {
241 * Get the ID of column family for this SST file,
242 * corresponding to the column family identified by
243 * {@link #getColumnFamilyName()}.
245 * @return the id of the column family.
247 public long getColumnFamilyId() {
248 return columnFamilyId
;
252 * The time when the SST file was created.
253 * Since SST files are immutable, this is equivalent
254 * to last modified time.
256 * @return the created time.
258 public long getCreationTime() {
263 * Get the timestamp of the earliest key.
265 * @return 0 means unknown, otherwise the timestamp.
267 public long getOldestKeyTime() {
268 return oldestKeyTime
;
272 * Get the name of the column family with which this
273 * SST file is associated.
275 * @return the name of the column family, or null if the
276 * column family is unknown.
278 /*@Nullable*/ public byte[] getColumnFamilyName() {
279 return columnFamilyName
;
283 * Get the name of the filter policy used in this table.
285 * @return the name of the filter policy, or null if
286 * no filter policy is used.
288 /*@Nullable*/ public String
getFilterPolicyName() {
289 return filterPolicyName
;
293 * Get the name of the comparator used in this table.
295 * @return the name of the comparator.
297 public String
getComparatorName() {
298 return comparatorName
;
302 * Get the name of the merge operator used in this table.
304 * @return the name of the merge operator, or null if no merge operator
307 /*@Nullable*/ public String
getMergeOperatorName() {
308 return mergeOperatorName
;
312 * Get the name of the prefix extractor used in this table.
314 * @return the name of the prefix extractor, or null if no prefix
317 /*@Nullable*/ public String
getPrefixExtractorName() {
318 return prefixExtractorName
;
322 * Get the names of the property collectors factories used in this table.
324 * @return the names of the property collector factories separated
325 * by commas, e.g. {collector_name[1]},{collector_name[2]},...
327 public String
getPropertyCollectorsNames() {
328 return propertyCollectorsNames
;
332 * Get the name of the compression algorithm used to compress the SST files.
334 * @return the name of the compression algorithm.
336 public String
getCompressionName() {
337 return compressionName
;
341 * Get the user collected properties.
343 * @return the user collected properties.
345 public Map
<String
, String
> getUserCollectedProperties() {
346 return userCollectedProperties
;
350 * Get the readable properties.
352 * @return the readable properties.
354 public Map
<String
, String
> getReadableProperties() {
355 return readableProperties
;
359 * The offset of the value of each property in the file.
361 * @return the offset of each property.
363 public Map
<String
, Long
> getPropertiesOffsets() {
364 return propertiesOffsets
;