Package com.cognite.client.util
Class RawRows
java.lang.Object
com.cognite.client.util.RawRows
Helper class for working with
RawRow objects.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic RawRowCreate aRawRowobject based on aJson objectrepresenting the row columns.static RawRowCreate aRawRowobject based on aJson objectrepresenting the row columns.static RawRowCreate aRawRowobject based on aJson objectrepresenting the row columns.static RawRowCreate aRawRowobject based on aMap<String, Object>representing the row columns.static RawRowCreate aRawRowobject based on aMap<String, Object>representing the row columns.static RawRowCreate aRawRowobject based on aMap<String, Object>representing the row columns.setDbName(Collection<RawRow> rows, String dbName) Specify the target CDF Raw database (name) for a collection ofRawRow.setTableName(Collection<RawRow> rows, String tableName) Specify the target CDF Raw table (name) for a collection ofRawRow.
-
Constructor Details
-
RawRows
public RawRows()
-
-
Method Details
-
of
Create aRawRowobject based on aMap<String, Object>representing the row columns. TheMap<String, Object>is parsed into aStructand set as thecolumnsin theRawRow. Each entry in theMapbecomes a separate column in the resultingRawRow. You need to add a valid database, table name and row key to the resultingRawRowafterwards. This method will just set them as empty strings.- Parameters:
columns- TheMaprepresenting the row columns.- Returns:
- The resulting
RawRowobject. - Throws:
Exception- if the input Map cannot be parsed correctly.
-
of
Create aRawRowobject based on aMap<String, Object>representing the row columns. TheMap<String, Object>is parsed into aStructand set as thecolumnsin theRawRow. Each entry in theMapbecomes a separate column in the resultingRawRow. You need to add a valid database and table name to the resultingRawRowafterwards. This method will just set them as empty strings.- Parameters:
rowKey- The row key to add to theRawRow.columns- TheMaprepresenting the row columns.- Returns:
- The resulting
RawRowobject. - 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 ExceptionCreate aRawRowobject based on aMap<String, Object>representing the row columns. TheMap<String, Object>is parsed into aStructand set as thecolumnsin theRawRow. Each entry in theMapbecomes a separate column in the resultingRawRow.- Parameters:
dbName- The database name to add to theRawRow.tableName- The table name to add to theRawRow.rowKey- The row key to add to theRawRow.columns- TheMaprepresenting the row columns.- Returns:
- The resulting
RawRowobject. - Throws:
Exception- if the input Map cannot be parsed correctly.
-
of
Create aRawRowobject based on aJson objectrepresenting the row columns. TheJson objectis parsed into aStructand set as thecolumnsin theRawRow. Each top-level field in theJson objectbecomes a separate column in the resultingRawRow. You need to add a valid database, table name and row key to the resultingRawRowafterwards. This method will just set them as empty strings.- Parameters:
columnsJsonObject- TheJson objectrepresenting the row columns.- Returns:
- The resulting
RawRowobject. - Throws:
Exception- if the input Json does not represent a valid Json object.
-
of
Create aRawRowobject based on aJson objectrepresenting the row columns. TheJson objectis parsed into aStructand set as thecolumnsin theRawRow. Each top-level field in theJson objectbecomes a separate column in the resultingRawRow. You need to add a valid database and table name to the resultingRawRowafterwards. This method will just set them as empty strings.- Parameters:
rowKey- The row key to add to theRawRow.columnsJsonObject- TheJson objectrepresenting the row columns.- Returns:
- The resulting
RawRowobject. - 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 aRawRowobject based on aJson objectrepresenting the row columns. TheJson objectis parsed into aStructand set as thecolumnsin theRawRow. Each top-level field in theJson objectbecomes a separate column in the resultingRawRow.- Parameters:
dbName- The database name to add to theRawRow.tableName- The table name to add to theRawRow.rowKey- The row key to add to theRawRow.columnsJsonObject- TheJson objectrepresenting the row columns.- Returns:
- The resulting
RawRowobject. - Throws:
Exception- if the input Json does not represent a valid Json object.
-
setTableName
Specify the target CDF Raw table (name) for a collection ofRawRow.- 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
Specify the target CDF Raw database (name) for a collection ofRawRow.- 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.
-