This is an automated email from the ASF dual-hosted git repository.
alexvanboxel pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/beam.git
The following commit(s) were added to refs/heads/master by this push:
new 3aa488d [BEAM-9605] BIP-1: Rename setRowOption to setOption on Option
builder
new 9597c5b Merge pull request #11218 from [BEAM-9605] BIP-1: Rename
setRowOption to setOption on Option builder
3aa488d is described below
commit 3aa488d4a752b5ec3cd210e7ae9b7db4d80124d4
Author: Alex Van Boxel <[email protected]>
AuthorDate: Wed Mar 25 14:16:33 2020 +0100
[BEAM-9605] BIP-1: Rename setRowOption to setOption on Option builder
Rename setRowOption to setOption on Option builder as setRowOption
name is too confusing.
It sets an option as a Row, not an option on a Row. Using setOption
is better and doesn't conflict with the other setOption with 3
parameters and explicit type.
This commit also removed left over @Nullable annotations.
---
.../core/src/main/java/org/apache/beam/sdk/schemas/Schema.java | 10 +++-------
.../java/org/apache/beam/sdk/schemas/SchemaOptionsTest.java | 2 +-
2 files changed, 4 insertions(+), 8 deletions(-)
diff --git
a/sdks/java/core/src/main/java/org/apache/beam/sdk/schemas/Schema.java
b/sdks/java/core/src/main/java/org/apache/beam/sdk/schemas/Schema.java
index e64f123..d0a8645 100644
--- a/sdks/java/core/src/main/java/org/apache/beam/sdk/schemas/Schema.java
+++ b/sdks/java/core/src/main/java/org/apache/beam/sdk/schemas/Schema.java
@@ -336,7 +336,7 @@ public class Schema implements Serializable {
SAME,
WEAKEN,
IGNORE
- };
+ }
/** Returns true if two Schemas have the same fields, but possibly in
different orders. */
public boolean equivalent(Schema other) {
@@ -389,7 +389,7 @@ public class Schema implements Serializable {
builder.append("Options:");
builder.append(options);
return builder.toString();
- };
+ }
@Override
public int hashCode() {
@@ -1171,7 +1171,6 @@ public class Schema implements Serializable {
/** Get the value of an option. If the option is not found null is
returned. */
@SuppressWarnings("TypeParameterUnusedInFormals")
- @Nullable
public <T> T getValue(String optionName) {
Option option = options.get(optionName);
if (option != null) {
@@ -1182,13 +1181,11 @@ public class Schema implements Serializable {
}
/** Get the value of an option. If the option is not found null is
returned. */
- @Nullable
public <T> T getValue(String optionName, Class<T> valueClass) {
return getValue(optionName);
}
/** Get the value of an option. If the option is not found the default
value is returned. */
- @Nullable
public <T> T getValueOrDefault(String optionName, T defaultValue) {
Option option = options.get(optionName);
if (option != null) {
@@ -1198,7 +1195,6 @@ public class Schema implements Serializable {
}
/** Get the type of an option. */
- @Nullable
public FieldType getType(String optionName) {
Option option = options.get(optionName);
if (option != null) {
@@ -1212,7 +1208,7 @@ public class Schema implements Serializable {
return Options.builder().setOption(optionName, fieldType, value);
}
- public static Options.Builder setRowOption(String optionName, Row value) {
+ public static Options.Builder setOption(String optionName, Row value) {
return Options.builder().setRowOption(optionName, value);
}
}
diff --git
a/sdks/java/core/src/test/java/org/apache/beam/sdk/schemas/SchemaOptionsTest.java
b/sdks/java/core/src/test/java/org/apache/beam/sdk/schemas/SchemaOptionsTest.java
index f3e3685..b8bb0b0 100644
---
a/sdks/java/core/src/test/java/org/apache/beam/sdk/schemas/SchemaOptionsTest.java
+++
b/sdks/java/core/src/test/java/org/apache/beam/sdk/schemas/SchemaOptionsTest.java
@@ -169,7 +169,7 @@ public class SchemaOptionsTest {
@Test
public void testRowOption() {
- Schema.Options options = Schema.Options.setRowOption(OPTION_NAME,
TEST_ROW).build();
+ Schema.Options options = Schema.Options.setOption(OPTION_NAME,
TEST_ROW).build();
assertEquals(TEST_ROW, options.getValue(OPTION_NAME));
assertEquals(FieldType.row(TEST_ROW.getSchema()),
options.getType(OPTION_NAME));
}