Class DefaultDataFrame

java.lang.Object
org.opensearch.ml.common.dataframe.AbstractDataFrame
org.opensearch.ml.common.dataframe.DefaultDataFrame
All Implemented Interfaces:
Iterable<Row>, org.opensearch.core.common.io.stream.Writeable, org.opensearch.core.xcontent.ToXContent, org.opensearch.core.xcontent.ToXContentObject, DataFrame

public class DefaultDataFrame extends AbstractDataFrame
  • Nested Class Summary

    Nested classes/interfaces inherited from interface org.opensearch.core.xcontent.ToXContent

    org.opensearch.core.xcontent.ToXContent.DelegatingMapParams, org.opensearch.core.xcontent.ToXContent.MapParams, org.opensearch.core.xcontent.ToXContent.Params

    Nested classes/interfaces inherited from interface org.opensearch.core.common.io.stream.Writeable

    org.opensearch.core.common.io.stream.Writeable.Reader<V>, org.opensearch.core.common.io.stream.Writeable.WriteableRegistry, org.opensearch.core.common.io.stream.Writeable.Writer<V>
  • Field Summary

    Fields inherited from interface org.opensearch.core.xcontent.ToXContent

    EMPTY_PARAMS
  • Constructor Summary

    Constructors
    Constructor
    Description
    DefaultDataFrame(org.opensearch.core.common.io.stream.StreamInput streamInput)
     
     
    DefaultDataFrame(ColumnMeta[] columnMetas, List<Row> rows)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    appendRow(Object[] values)
    Add a new row given values array.
    void
    Add a new row given a Row data
    Get the array of column meta
    int
    Find the index of the target in columnMetas
    getRow(int index)
    Get Row data given index value
     
    parse(org.opensearch.core.xcontent.XContentParser parser)
     
    remove(int columnIndex)
    Build a new DataFrame by removing one column based on index
    select(int[] columns)
    Build a new DataFrame given the input columns
    int
    Get the size of the data frame.
     
    org.opensearch.core.xcontent.XContentBuilder
    toXContent(org.opensearch.core.xcontent.XContentBuilder builder)
     
    org.opensearch.core.xcontent.XContentBuilder
    toXContent(org.opensearch.core.xcontent.XContentBuilder builder, org.opensearch.core.xcontent.ToXContent.Params params)
     
    void
    writeTo(org.opensearch.core.common.io.stream.StreamOutput out)
     

    Methods inherited from class org.opensearch.ml.common.dataframe.AbstractDataFrame

    getDataFrameType

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods inherited from interface java.lang.Iterable

    forEach, spliterator

    Methods inherited from interface org.opensearch.core.xcontent.ToXContentObject

    isFragment
  • Constructor Details

    • DefaultDataFrame

      public DefaultDataFrame(ColumnMeta[] columnMetas)
    • DefaultDataFrame

      public DefaultDataFrame(ColumnMeta[] columnMetas, List<Row> rows)
    • DefaultDataFrame

      public DefaultDataFrame(org.opensearch.core.common.io.stream.StreamInput streamInput) throws IOException
      Throws:
      IOException
  • Method Details

    • appendRow

      public void appendRow(Object[] values)
      Description copied from interface: DataFrame
      Add a new row given values array.
      Parameters:
      values - input values
    • appendRow

      public void appendRow(Row row)
      Description copied from interface: DataFrame
      Add a new row given a Row data
      Parameters:
      row - input row data
    • getRow

      public Row getRow(int index)
      Description copied from interface: DataFrame
      Get Row data given index value
      Parameters:
      index - index value
      Returns:
      row data
    • size

      public int size()
      Description copied from interface: DataFrame
      Get the size of the data frame. This is the row size actually.
      Returns:
      the size
    • columnMetas

      public ColumnMeta[] columnMetas()
      Description copied from interface: DataFrame
      Get the array of column meta
      Returns:
      array of ColumnMeta
    • remove

      public DataFrame remove(int columnIndex)
      Description copied from interface: DataFrame
      Build a new DataFrame by removing one column based on index
      Parameters:
      columnIndex - the index of column
      Returns:
      new DataFrame
    • select

      public DataFrame select(int[] columns)
      Description copied from interface: DataFrame
      Build a new DataFrame given the input columns
      Parameters:
      columns - the indices of column
      Returns:
      new DataFrame
    • getColumnIndex

      public int getColumnIndex(String target)
      Description copied from interface: DataFrame
      Find the index of the target in columnMetas
      Parameters:
      target - the string value of the target
      Returns:
      column index of the target in the list of columnMetas
    • iterator

      public Iterator<Row> iterator()
    • writeTo

      public void writeTo(org.opensearch.core.common.io.stream.StreamOutput out) throws IOException
      Specified by:
      writeTo in interface org.opensearch.core.common.io.stream.Writeable
      Overrides:
      writeTo in class AbstractDataFrame
      Throws:
      IOException
    • parse

      public static DefaultDataFrame parse(org.opensearch.core.xcontent.XContentParser parser) throws IOException
      Throws:
      IOException
    • toXContent

      public org.opensearch.core.xcontent.XContentBuilder toXContent(org.opensearch.core.xcontent.XContentBuilder builder) throws IOException
      Throws:
      IOException
    • toXContent

      public org.opensearch.core.xcontent.XContentBuilder toXContent(org.opensearch.core.xcontent.XContentBuilder builder, org.opensearch.core.xcontent.ToXContent.Params params) throws IOException
      Throws:
      IOException
    • toString

      public String toString()
      Overrides:
      toString in class Object