org.apache.sysds.runtime.transform.encode

## Class EncoderRecode

- java.lang.Object
- - org.apache.sysds.runtime.transform.encode.Encoder
  - - org.apache.sysds.runtime.transform.encode.EncoderRecode

- All Implemented Interfaces:
    Serializable

      public class EncoderRecode
      extends Encoder

  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `EncoderRecode()`
    `EncoderRecode(org.apache.wink.json4j.JSONObject parsedSpec, String[] colnames, int clen, int minCol, int maxCol)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `MatrixBlock` | `apply(FrameBlock in, MatrixBlock out)` Encode input data blockwise according to existing transform meta data (transform apply).
    `void` | `build(FrameBlock in)` Build the transform meta data for the given block input.
    `void` | `buildPartial(FrameBlock in)`
    `static String` | `constructRecodeMapEntry(String token, Long code)` Returns the Recode map entry which consists of concatenation of code, delimiter and token.
    `MatrixBlock` | `encode(FrameBlock in, MatrixBlock out)` Block encode: build and apply (transform encode).
    `HashMap<Integer,HashMap<String,Long>>` | `getCPRecodeMaps()`
    `HashMap<Integer,HashSet<Object>>` | `getCPRecodeMapsPartial()`
    `FrameBlock` | `getMetaData(FrameBlock meta)` Construct a frame block out of the transform meta data.
    `void` | `initMetaData(FrameBlock meta)` Construct the recodemaps from the given input frame for all columns registered for recode.
    `void` | `mergeAt(Encoder other, int row, int col)` Merges another encoder, of a compatible type, in after a certain position.
    `int[]` | `numDistinctValues()`
    `void` | `prepareBuildPartial()`
    `static String[]` | `splitRecodeMapEntry(String value)` Splits a Recode map entry into its token and code.
    `Encoder` | `subRangeEncoder(IndexRange ixRange)` Returns a new Encoder that only handles a sub range of columns.

    - ### Methods inherited from class org.apache.sysds.runtime.transform.encode.Encoder

      `getColList, getColMapping, getNumCols, initColList, initColList, isApplicable, isApplicable, setColList, updateIndexRanges`

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

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

- - ### Constructor Detail

    - #### EncoderRecode

          public EncoderRecode(org.apache.wink.json4j.JSONObject parsedSpec,
                               String[] colnames,
                               int clen,
                               int minCol,
                               int maxCol)
                        throws org.apache.wink.json4j.JSONException

      Throws:
        `org.apache.wink.json4j.JSONException`

    - #### EncoderRecode

          public EncoderRecode()

  - ### Method Detail

    - #### getCPRecodeMaps

          public HashMap<Integer,HashMap<String,Long>> getCPRecodeMaps()

    - #### getCPRecodeMapsPartial

          public HashMap<Integer,HashSet<Object>> getCPRecodeMapsPartial()

    - #### encode

          public MatrixBlock encode(FrameBlock in,
                                    MatrixBlock out)

      Description copied from class: `Encoder`
      Block encode: build and apply (transform encode).
      Specified by:
        `encode` in class `Encoder`
      Parameters:
        `in` - input frame block
        `out` - output matrix block
      Returns:
        output matrix block

    - #### build

          public void build(FrameBlock in)

      Description copied from class: `Encoder`
      Build the transform meta data for the given block input. This call modifies and keeps meta data as encoder state.
      Specified by:
        `build` in class `Encoder`
      Parameters:
        `in` - input frame block

    - #### prepareBuildPartial

          public void prepareBuildPartial()

    - #### buildPartial

          public void buildPartial(FrameBlock in)

    - #### apply

          public MatrixBlock apply(FrameBlock in,
                                   MatrixBlock out)

      Description copied from class: `Encoder`
      Encode input data blockwise according to existing transform meta data (transform apply).
      Specified by:
        `apply` in class `Encoder`
      Parameters:
        `in` - input frame block
        `out` - output matrix block
      Returns:
        output matrix block

    - #### subRangeEncoder

          public Encoder subRangeEncoder(IndexRange ixRange)

      Description copied from class: `Encoder`
      Returns a new Encoder that only handles a sub range of columns.
      Overrides:
        `subRangeEncoder` in class `Encoder`
      Parameters:
        `ixRange` - the range (1-based, begin inclusive, end exclusive)
      Returns:
        an encoder of the same type, just for the sub-range

    - #### mergeAt

          public void mergeAt(Encoder other,
                              int row,
                              int col)

      Description copied from class: `Encoder`
      Merges another encoder, of a compatible type, in after a certain position. Resizes as necessary. `Encoders` are compatible with themselves and `EncoderComposite` is compatible with every other `Encoder`.
      Overrides:
        `mergeAt` in class `Encoder`
      Parameters:
        `other` - the encoder that should be merged in
        `row` - the row where it should be placed (1-based)
        `col` - the col where it should be placed (1-based)

    - #### numDistinctValues

          public int[] numDistinctValues()

    - #### getMetaData

          public FrameBlock getMetaData(FrameBlock meta)

      Description copied from class: `Encoder`
      Construct a frame block out of the transform meta data.
      Specified by:
        `getMetaData` in class `Encoder`
      Parameters:
        `meta` - output frame block
      Returns:
        output frame block?

    - #### initMetaData

          public void initMetaData(FrameBlock meta)

      Construct the recodemaps from the given input frame for all columns registered for recode.
      Specified by:
        `initMetaData` in class `Encoder`
      Parameters:
        `meta` - frame block

    - #### constructRecodeMapEntry

          public static String constructRecodeMapEntry(String token,
                                                       Long code)

      Returns the Recode map entry which consists of concatenation of code, delimiter and token.
      Parameters:
        `token` - is part of Recode map
        `code` - is code for token
      Returns:
        the concatenation of token and code with delimiter in between

    - #### splitRecodeMapEntry

          public static String[] splitRecodeMapEntry(String value)

      Splits a Recode map entry into its token and code.
      Parameters:
        `value` - concatenation of token and code with delimiter in between
      Returns:
        string array of token and code

Copyright © 2020 The Apache Software Foundation. All rights reserved.