Package org.apache.sysds.runtime.transform.decode

## Class Decoder

- java.lang.Object
- - org.apache.sysds.runtime.transform.decode.Decoder

All Implemented Interfaces:
  `Externalizable`, `Serializable`

Direct Known Subclasses:
  `DecoderBin`, `DecoderComposite`, `DecoderDummycode`, `DecoderPassThrough`, `DecoderRecode`

    public abstract class Decoder
    extends Object
    implements Externalizable

Base class for all transform decoders providing both a row and block interface for decoding matrices to frames.

See Also:
  Serialized Form

### Method Summary

All Methods Instance Methods Abstract Methods Concrete Methods
`abstract FrameBlock` `decode​(MatrixBlock in, FrameBlock out)` Block decode API converting a matrix block into a frame block.
`FrameBlock` `decode​(MatrixBlock in, FrameBlock out, int k)` Block decode API converting a matrix block into a frame block in parallel.
`abstract void` `decode​(MatrixBlock in, FrameBlock out, int rl, int ru)` Block decode row block
`String[]` `getColnames()`
`Types.ValueType[]` `getSchema()`
`abstract void` `initMetaData​(FrameBlock meta)`
`void` `readExternal​(ObjectInput in)` Redirects the default java serialization via externalizable to our default hadoop writable serialization for efficient broadcast/rdd deserialization.
`void` `setColnames​(String[] colnames)`
`Decoder` `subRangeDecoder​(int colStart, int colEnd, int dummycodedOffset)` Returns a new Decoder that only handles a sub range of columns.
`void` `updateIndexRanges​(long[] beginDims, long[] endDims)` Update index-ranges to after decoding.
`void` `writeExternal​(ObjectOutput os)` Redirects the default java serialization via externalizable to our default hadoop writable serialization for efficient broadcast/rdd serialization.

### Methods inherited from class java.lang.Object

`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Method Detail

#### getSchema

    public Types.ValueType[] getSchema()

#### setColnames

    public void setColnames​(String[] colnames)

#### getColnames

    public String[] getColnames()

#### decode

    public abstract FrameBlock decode​(MatrixBlock in,
                                      FrameBlock out)

Block decode API converting a matrix block into a frame block.

Parameters:
  `in` - Input matrix block
  `out` - Output frame block
Returns:
  returns given output frame block for convenience

#### decode

    public FrameBlock decode​(MatrixBlock in,
                             FrameBlock out,
                             int k)

Block decode API converting a matrix block into a frame block in parallel.

Parameters:
  `in` - Input matrix block
  `out` - Output frame block
  `k` - Parallelization degree
Returns:
  returns the given output frame block for convenience

#### decode

    public abstract void decode​(MatrixBlock in,
                                FrameBlock out,
                                int rl,
                                int ru)

Block decode row block

Parameters:
  `in` - input Matrix Block
  `out` - output FrameBlock
  `rl` - row start to decode
  `ru` - row end to decode (not inclusive)

#### subRangeDecoder

    public Decoder subRangeDecoder​(int colStart,
                                   int colEnd,
                                   int dummycodedOffset)

Returns a new Decoder that only handles a sub range of columns. The sub-range refers to the columns after decoding.

Parameters:
  `colStart` - the start index of the sub-range (1-based, inclusive)
  `colEnd` - the end index of the sub-range (1-based, exclusive)
  `dummycodedOffset` - the offset of dummycoded segments before colStart
Returns:
  a decoder of the same type, just for the sub-range

#### updateIndexRanges

    public void updateIndexRanges​(long[] beginDims,
                                  long[] endDims)

Update index-ranges to after decoding. Note that only Dummycoding changes the ranges.

Parameters:
  `beginDims` - the begin indexes before encoding
  `endDims` - the end indexes before encoding

#### initMetaData

    public abstract void initMetaData​(FrameBlock meta)

#### writeExternal

    public void writeExternal​(ObjectOutput os)
                       throws IOException

Redirects the default java serialization via externalizable to our default hadoop writable serialization for efficient broadcast/rdd serialization.

Specified by:
  `writeExternal` in interface `Externalizable`
Parameters:
  `os` - object output
Throws:
  `IOException` - if IOException occurs

#### readExternal

    public void readExternal​(ObjectInput in)
                      throws IOException

Redirects the default java serialization via externalizable to our default hadoop writable serialization for efficient broadcast/rdd deserialization.

Specified by:
  `readExternal` in interface `Externalizable`
Parameters:
  `in` - object input
Throws:
  `IOException` - if IOException occur