Class RawRows

java.lang.Object
com.cognite.client.util.RawRows

public class RawRows extends Object
Helper class for working with RawRow objects.
  • Constructor Details

    • RawRows

      public RawRows()
  • Method Details

    • of

      public static RawRow of(Map<String,Object> columns) throws Exception
      Create a RawRow object based on a Map<String, Object> representing the row columns. The Map<String, Object> is parsed into a Struct and set as the columns in the RawRow. Each entry in the Map becomes a separate column in the resulting RawRow. You need to add a valid database, table name and row key to the resulting RawRow afterwards. This method will just set them as empty strings.
      Parameters:
      columns - The Map representing the row columns.
      Returns:
      The resulting RawRow object.
      Throws:
      Exception - if the input Map cannot be parsed correctly.
    • of

      public static RawRow of(String rowKey, Map<String,Object> columns) throws Exception
      Create a RawRow object based on a Map<String, Object> representing the row columns. The Map<String, Object> is parsed into a Struct and set as the columns in the RawRow. Each entry in the Map becomes a separate column in the resulting RawRow. You need to add a valid database and table name to the resulting RawRow afterwards. This method will just set them as empty strings.
      Parameters:
      rowKey - The row key to add to the RawRow.
      columns - The Map representing the row columns.
      Returns:
      The resulting RawRow object.
      Throws:
      Exception - if the input Map cannot be parsed correctly.
    • of

      public static RawRow of(String dbName, String tableName, String rowKey, Map<String,Object> columns) throws Exception
      Create a RawRow object based on a Map<String, Object> representing the row columns. The Map<String, Object> is parsed into a Struct and set as the columns in the RawRow. Each entry in the Map becomes a separate column in the resulting RawRow.
      Parameters:
      dbName - The database name to add to the RawRow.
      tableName - The table name to add to the RawRow.
      rowKey - The row key to add to the RawRow.
      columns - The Map representing the row columns.
      Returns:
      The resulting RawRow object.
      Throws:
      Exception - if the input Map cannot be parsed correctly.
    • of

      public static RawRow of(String columnsJsonObject) throws Exception
      Create a RawRow object based on a Json object representing the row columns. The Json object is parsed into a Struct and set as the columns in the RawRow. Each top-level field in the Json object becomes a separate column in the resulting RawRow. You need to add a valid database, table name and row key to the resulting RawRow afterwards. This method will just set them as empty strings.
      Parameters:
      columnsJsonObject - The Json object representing the row columns.
      Returns:
      The resulting RawRow object.
      Throws:
      Exception - if the input Json does not represent a valid Json object.
    • of

      public static RawRow of(String rowKey, String columnsJsonObject) throws Exception
      Create a RawRow object based on a Json object representing the row columns. The Json object is parsed into a Struct and set as the columns in the RawRow. Each top-level field in the Json object becomes a separate column in the resulting RawRow. You need to add a valid database and table name to the resulting RawRow afterwards. This method will just set them as empty strings.
      Parameters:
      rowKey - The row key to add to the RawRow.
      columnsJsonObject - The Json object representing the row columns.
      Returns:
      The resulting RawRow object.
      Throws:
      Exception - if the input Json does not represent a valid Json object.
    • of

      public static RawRow of(String dbName, String tableName, String rowKey, String columnsJsonObject) throws Exception
      Create a RawRow object based on a Json object representing the row columns. The Json object is parsed into a Struct and set as the columns in the RawRow. Each top-level field in the Json object becomes a separate column in the resulting RawRow.
      Parameters:
      dbName - The database name to add to the RawRow.
      tableName - The table name to add to the RawRow.
      rowKey - The row key to add to the RawRow.
      columnsJsonObject - The Json object representing the row columns.
      Returns:
      The resulting RawRow object.
      Throws:
      Exception - if the input Json does not represent a valid Json object.
    • setTableName

      public static List<RawRow> setTableName(Collection<RawRow> rows, String tableName)
      Specify the target CDF Raw table (name) for a collection of RawRow.
      Parameters:
      rows - The rows that will get their destination table set.
      tableName - The CDF Raw destination table name.
      Returns:
      the rows with table name set.
    • setDbName

      public static List<RawRow> setDbName(Collection<RawRow> rows, String dbName)
      Specify the target CDF Raw database (name) for a collection of RawRow.
      Parameters:
      rows - The rows that will get their destination table set.
      dbName - The CDF Raw destination database name.
      Returns:
      the rows with database name set.