Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BEAM-4283] Fix naming of the BigQuery fields #5713

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -145,10 +145,10 @@ public NexmarkPerf decode(InputStream inStream)
new TableSchema()
.setFields(
ImmutableList.of(
new TableFieldSchema().setName("Runtime(sec)").setType("FLOAT"),
new TableFieldSchema().setName("Events(/sec)").setType("FLOAT"),
new TableFieldSchema().setName("runtimeSec").setType("FLOAT"),
new TableFieldSchema().setName("eventsPerSec").setType("FLOAT"),
new TableFieldSchema()
.setName("Size of the result collection")
.setName("numResults")
.setType("INTEGER")));

String tableSpec =
Expand All @@ -163,9 +163,9 @@ public NexmarkPerf decode(InputStream inStream)
input -> {
NexmarkPerf nexmarkPerf = input.getValue();
TableRow row = new TableRow()
.set("Runtime(sec)", nexmarkPerf.runtimeSec)
.set("Events(/sec)", nexmarkPerf.eventsPerSec)
.set("Size of the result collection", nexmarkPerf.numResults);
.set("runtimeSec", nexmarkPerf.runtimeSec)
.set("eventsPerSec", nexmarkPerf.eventsPerSec)
.set("numResults", nexmarkPerf.numResults);
return row;
};
BigQueryIO.Write io =
Expand Down
Expand Up @@ -104,16 +104,16 @@ public void testSavePerfsToBigQuery() throws IOException, InterruptedException {
assertEquals("Wrong number of rows inserted", 2, actualRows.size());
List<TableRow> expectedRows = new ArrayList<>();
TableRow row1 = new TableRow()
.set("Runtime(sec)", nexmarkPerf1.runtimeSec).set("Events(/sec)", nexmarkPerf1.eventsPerSec)
.set("runtimeSec", nexmarkPerf1.runtimeSec).set("eventsPerSec", nexmarkPerf1.eventsPerSec)
// when read using TableRowJsonCoder the row field is boxed into an Integer, cast it to int
// to for bowing into Integer in the expectedRows.
.set("Size of the result collection", (int) nexmarkPerf1.numResults);
.set("numResults", (int) nexmarkPerf1.numResults);
expectedRows.add(row1);
TableRow row2 = new TableRow()
.set("Runtime(sec)", nexmarkPerf2.runtimeSec).set("Events(/sec)", nexmarkPerf2.eventsPerSec)
.set("runtimeSec", nexmarkPerf2.runtimeSec).set("eventsPerSec", nexmarkPerf2.eventsPerSec)
// when read using TableRowJsonCoder the row field is boxed into an Integer, cast it to int
// to for bowing into Integer in the expectedRows.
.set("Size of the result collection", (int) nexmarkPerf2.numResults);
.set("numResults", (int) nexmarkPerf2.numResults);
expectedRows.add(row2);
assertThat(actualRows, containsInAnyOrder(Iterables.toArray(expectedRows, TableRow.class)));

Expand Down