Search in sources :

Example 1 with VALUE

use of org.apache.beam.sdk.io.gcp.bigtable.RowUtils.VALUE in project beam by apache.

the class BigtableTableTestUtils method setFixedTimestamp.

// There is no possibility to insert a value with fixed timestamp so we have to replace it
// for the testing purpose.
static com.google.bigtable.v2.Row setFixedTimestamp(com.google.bigtable.v2.Row row) {
    Family family = row.getFamilies(0);
    List<Column> columnsReplaced = family.getColumnsList().stream().map(column -> {
        Cell cell = column.getCells(0);
        return column(column.getQualifier().toStringUtf8(), cell.getValue().toByteArray());
    }).collect(toList());
    Family familyReplaced = Family.newBuilder().setName(family.getName()).addAllColumns(columnsReplaced).build();
    return com.google.bigtable.v2.Row.newBuilder().setKey(row.getKey()).addFamilies(familyReplaced).build();
}
Also used : BigtableUtils.byteStringUtf8(org.apache.beam.sdk.io.gcp.testing.BigtableUtils.byteStringUtf8) BigtableUtils.doubleToByteArray(org.apache.beam.sdk.io.gcp.testing.BigtableUtils.doubleToByteArray) UTF_8(java.nio.charset.StandardCharsets.UTF_8) Cell(com.google.bigtable.v2.Cell) Longs(org.apache.beam.vendor.guava.v26_0_jre.com.google.common.primitives.Longs) Family(com.google.bigtable.v2.Family) Column(com.google.bigtable.v2.Column) LABELS(org.apache.beam.sdk.io.gcp.bigtable.RowUtils.LABELS) Schema(org.apache.beam.sdk.schemas.Schema) BigtableUtils.booleanToByteArray(org.apache.beam.sdk.io.gcp.testing.BigtableUtils.booleanToByteArray) Collectors.toList(java.util.stream.Collectors.toList) List(java.util.List) KEY(org.apache.beam.sdk.io.gcp.bigtable.RowUtils.KEY) BigtableUtils.longToByteArray(org.apache.beam.sdk.io.gcp.testing.BigtableUtils.longToByteArray) ImmutableList(org.apache.beam.vendor.guava.v26_0_jre.com.google.common.collect.ImmutableList) Assert.fail(org.junit.Assert.fail) MatcherAssert.assertThat(org.hamcrest.MatcherAssert.assertThat) Row(org.apache.beam.sdk.values.Row) Matchers.containsString(org.hamcrest.Matchers.containsString) TIMESTAMP_MICROS(org.apache.beam.sdk.io.gcp.bigtable.RowUtils.TIMESTAMP_MICROS) VALUE(org.apache.beam.sdk.io.gcp.bigtable.RowUtils.VALUE) Nullable(org.checkerframework.checker.nullness.qual.Nullable) BigtableUtils.byteString(org.apache.beam.sdk.io.gcp.testing.BigtableUtils.byteString) Column(com.google.bigtable.v2.Column) Family(com.google.bigtable.v2.Family) Cell(com.google.bigtable.v2.Cell)

Aggregations

Cell (com.google.bigtable.v2.Cell)1 Column (com.google.bigtable.v2.Column)1 Family (com.google.bigtable.v2.Family)1 UTF_8 (java.nio.charset.StandardCharsets.UTF_8)1 List (java.util.List)1 Collectors.toList (java.util.stream.Collectors.toList)1 KEY (org.apache.beam.sdk.io.gcp.bigtable.RowUtils.KEY)1 LABELS (org.apache.beam.sdk.io.gcp.bigtable.RowUtils.LABELS)1 TIMESTAMP_MICROS (org.apache.beam.sdk.io.gcp.bigtable.RowUtils.TIMESTAMP_MICROS)1 VALUE (org.apache.beam.sdk.io.gcp.bigtable.RowUtils.VALUE)1 BigtableUtils.booleanToByteArray (org.apache.beam.sdk.io.gcp.testing.BigtableUtils.booleanToByteArray)1 BigtableUtils.byteString (org.apache.beam.sdk.io.gcp.testing.BigtableUtils.byteString)1 BigtableUtils.byteStringUtf8 (org.apache.beam.sdk.io.gcp.testing.BigtableUtils.byteStringUtf8)1 BigtableUtils.doubleToByteArray (org.apache.beam.sdk.io.gcp.testing.BigtableUtils.doubleToByteArray)1 BigtableUtils.longToByteArray (org.apache.beam.sdk.io.gcp.testing.BigtableUtils.longToByteArray)1 Schema (org.apache.beam.sdk.schemas.Schema)1 Row (org.apache.beam.sdk.values.Row)1 ImmutableList (org.apache.beam.vendor.guava.v26_0_jre.com.google.common.collect.ImmutableList)1 Longs (org.apache.beam.vendor.guava.v26_0_jre.com.google.common.primitives.Longs)1 Nullable (org.checkerframework.checker.nullness.qual.Nullable)1