Search in sources :

Example 1 with Type

use of com.amazonaws.services.timestreamquery.model.Type in project amazon-timestream-tools by awslabs.

the class QueryExample method parseDatum.

private String parseDatum(ColumnInfo info, Datum datum) {
    if (datum.isNullValue() != null && datum.isNullValue()) {
        return info.getName() + "=" + "NULL";
    }
    Type columnType = info.getType();
    // If the column is of TimeSeries Type
    if (columnType.getTimeSeriesMeasureValueColumnInfo() != null) {
        return parseTimeSeries(info, datum);
    } else // If the column is of Array Type
    if (columnType.getArrayColumnInfo() != null) {
        List<Datum> arrayValues = datum.getArrayValue();
        return info.getName() + "=" + parseArray(info.getType().getArrayColumnInfo(), arrayValues);
    } else // If the column is of Row Type
    if (columnType.getRowColumnInfo() != null) {
        List<ColumnInfo> rowColumnInfo = info.getType().getRowColumnInfo();
        Row rowValues = datum.getRowValue();
        return parseRow(rowColumnInfo, rowValues);
    } else // If the column is of Scalar Type
    {
        return parseScalarType(info, datum);
    }
}
Also used : Type(com.amazonaws.services.timestreamquery.model.Type) ScalarType(com.amazonaws.services.timestreamquery.model.ScalarType) ColumnInfo(com.amazonaws.services.timestreamquery.model.ColumnInfo) ArrayList(java.util.ArrayList) List(java.util.List) Row(com.amazonaws.services.timestreamquery.model.Row)

Aggregations

ColumnInfo (com.amazonaws.services.timestreamquery.model.ColumnInfo)1 Row (com.amazonaws.services.timestreamquery.model.Row)1 ScalarType (com.amazonaws.services.timestreamquery.model.ScalarType)1 Type (com.amazonaws.services.timestreamquery.model.Type)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1