Skip to content

Commit fd7e5a3

Browse files
Bigtable: Using cleaner number input for snippets (GoogleCloudPlatform#1787)
1 parent 75caea1 commit fd7e5a3

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

bigtable/snippets/src/main/java/com/example/bigtable/WriteBatch.java

+2-3
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ public static void writeBatch(String projectId, String instanceId, String tableI
3333

3434
try (BigtableDataClient dataClient = BigtableDataClient.create(projectId, instanceId)) {
3535
long timestamp = System.currentTimeMillis() * 1000;
36-
ByteString one = ByteString.copyFrom(new byte[] {0, 0, 0, 0, 0, 0, 0, 1});
3736

3837
BulkMutation bulkMutation =
3938
BulkMutation.create(tableId)
@@ -44,7 +43,7 @@ public static void writeBatch(String projectId, String instanceId, String tableI
4443
COLUMN_FAMILY_NAME,
4544
ByteString.copyFrom("connected_wifi".getBytes()),
4645
timestamp,
47-
one)
46+
1)
4847
.setCell(COLUMN_FAMILY_NAME, "os_build", timestamp, "12155.0.0-rc1"))
4948
.add(
5049
"tablet#a0b81f74#20190502",
@@ -53,7 +52,7 @@ public static void writeBatch(String projectId, String instanceId, String tableI
5352
COLUMN_FAMILY_NAME,
5453
ByteString.copyFrom("connected_wifi".getBytes()),
5554
timestamp,
56-
one)
55+
1)
5756
.setCell(COLUMN_FAMILY_NAME, "os_build", timestamp, "12155.0.0-rc6"));
5857

5958
dataClient.bulkMutateRows(bulkMutation);

bigtable/snippets/src/main/java/com/example/bigtable/WriteSimple.java

+2-3
Original file line numberDiff line numberDiff line change
@@ -34,20 +34,19 @@ public static void writeSimple(String projectId, String instanceId, String table
3434
long timestamp = System.currentTimeMillis() * 1000;
3535

3636
String rowkey = "phone#4c410523#20190501";
37-
ByteString one = ByteString.copyFrom(new byte[] {0, 0, 0, 0, 0, 0, 0, 1});
3837

3938
RowMutation rowMutation =
4039
RowMutation.create(tableId, rowkey)
4140
.setCell(
4241
COLUMN_FAMILY_NAME,
4342
ByteString.copyFrom("connected_cell".getBytes()),
4443
timestamp,
45-
one)
44+
1)
4645
.setCell(
4746
COLUMN_FAMILY_NAME,
4847
ByteString.copyFrom("connected_wifi".getBytes()),
4948
timestamp,
50-
one)
49+
1)
5150
.setCell(COLUMN_FAMILY_NAME, "os_build", timestamp, "PQ2A.190405.003");
5251

5352
dataClient.mutateRow(rowMutation);

0 commit comments

Comments
 (0)