Interface CacheBlock
- 
- All Superinterfaces:
- org.apache.hadoop.io.Writable
 - All Known Implementing Classes:
- CompressedMatrixBlock,- FrameBlock,- MatrixBlock,- TensorBlock
 
 public interface CacheBlock extends org.apache.hadoop.io.WritableInterface for all blocks handled by lazy write buffer. This abstraction allows us to keep the buffer pool independent of matrix and frame blocks.
- 
- 
Method SummaryAll Methods Instance Methods Abstract Methods Modifier and Type Method Description voidcompactEmptyBlock()Free unnecessarily allocated empty block.DataCharacteristicsgetDataCharacteristics()doublegetDouble(int r, int c)Returns the double value at the passed row and column.doublegetDoubleNaN(int r, int c)Returns the double value at the passed row and column.longgetExactSerializedSize()Get the exact serialized size in bytes of the cache block.longgetInMemorySize()Get the in-memory size in bytes of the cache block.intgetNumColumns()intgetNumRows()StringgetString(int r, int c)Returns the string of the value at the passed row and column.booleanisShallowSerialize()Indicates if the cache block is subject to shallow serialized, which is generally true if in-memory size and serialized size are almost identical allowing to avoid unnecessary deep serialize.booleanisShallowSerialize(boolean inclConvert)Indicates if the cache block is subject to shallow serialized, which is generally true if in-memory size and serialized size are almost identical allowing to avoid unnecessary deep serialize.voidmerge(CacheBlock that, boolean appendOnly)Merge the given block into the current block.CacheBlockslice(int rl, int ru, int cl, int cu, boolean deep, CacheBlock block)Slice a sub block out of the current block and write into the given output block.CacheBlockslice(int rl, int ru, int cl, int cu, CacheBlock block)Slice a sub block out of the current block and write into the given output block.voidtoShallowSerializeBlock()Converts a cache block that is not shallow serializable into a form that is shallow serializable.
 
- 
- 
- 
Method Detail- 
getNumRowsint getNumRows() 
 - 
getNumColumnsint getNumColumns() 
 - 
getDataCharacteristicsDataCharacteristics getDataCharacteristics() 
 - 
getInMemorySizelong getInMemorySize() Get the in-memory size in bytes of the cache block.- Returns:
- in-memory size in bytes of cache block
 
 - 
getExactSerializedSizelong getExactSerializedSize() Get the exact serialized size in bytes of the cache block.- Returns:
- exact serialized size in bytes of cache block
 
 - 
isShallowSerializeboolean isShallowSerialize() Indicates if the cache block is subject to shallow serialized, which is generally true if in-memory size and serialized size are almost identical allowing to avoid unnecessary deep serialize.- Returns:
- true if shallow serialized
 
 - 
isShallowSerializeboolean isShallowSerialize(boolean inclConvert) Indicates if the cache block is subject to shallow serialized, which is generally true if in-memory size and serialized size are almost identical allowing to avoid unnecessary deep serialize.- Parameters:
- inclConvert- if true report blocks as shallow serialize that are currently not amenable but can be brought into an amenable form via- toShallowSerializeBlock.
- Returns:
- true if shallow serialized
 
 - 
toShallowSerializeBlockvoid toShallowSerializeBlock() Converts a cache block that is not shallow serializable into a form that is shallow serializable. This methods has no affect if the given cache block is not amenable.
 - 
compactEmptyBlockvoid compactEmptyBlock() Free unnecessarily allocated empty block.
 - 
sliceCacheBlock slice(int rl, int ru, int cl, int cu, CacheBlock block) Slice a sub block out of the current block and write into the given output block. This method returns the passed instance if not null.- Parameters:
- rl- row lower
- ru- row upper
- cl- column lower
- cu- column upper
- block- cache block
- Returns:
- sub-block of cache block
 
 - 
sliceCacheBlock slice(int rl, int ru, int cl, int cu, boolean deep, CacheBlock block) Slice a sub block out of the current block and write into the given output block. This method returns the passed instance if not null.- Parameters:
- rl- row lower
- ru- row upper
- cl- column lower
- cu- column upper
- deep- enforce deep-copy
- block- cache block
- Returns:
- sub-block of cache block
 
 - 
mergevoid merge(CacheBlock that, boolean appendOnly) Merge the given block into the current block. Both blocks needs to be of equal dimensions and contain disjoint non-zero cells.- Parameters:
- that- cache block
- appendOnly- ?
 
 - 
getDoubledouble getDouble(int r, int c)Returns the double value at the passed row and column. If the value is missing 0 is returned.- Parameters:
- r- row of the value
- c- column of the value
- Returns:
- double value at the passed row and column
 
 - 
getDoubleNaNdouble getDoubleNaN(int r, int c)Returns the double value at the passed row and column. If the value is missing NaN is returned.- Parameters:
- r- row of the value
- c- column of the value
- Returns:
- double value at the passed row and column
 
 - 
getStringString getString(int r, int c) Returns the string of the value at the passed row and column. If the value is missing or NaN, null is returned.- Parameters:
- r- row of the value
- c- column of the value
- Returns:
- string of the value at the passed row and column
 
 
- 
 
-