Skip to content

Commit

Permalink
[BEAM-9569] Fix BeamSqlPojoExample logRecords method to not require R…
Browse files Browse the repository at this point in the history
…ow coder inference

It also adds a warning that Coder inference of Row objects is now
disabled into the release CHANGELOG.
  • Loading branch information
iemejia committed Apr 18, 2020
1 parent fa4f418 commit 37838f2
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 14 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ conversion to beam schema options. *Remark: Schema aware is still experimental.*
* Dataflow runner now requires the `--region` option to be set, unless a default value is set in the environment ([BEAM-9199](https://issues.apache.org/jira/browse/BEAM-9199)). See [here](https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) for more details.
* HBaseIO.ReadAll now requires a PCollection of HBaseIO.Read objects instead of HBaseQuery objects ([BEAM-9279](https://issues.apache.org/jira/browse/BEAM-9279)).
* ProcessContext.updateWatermark has been removed in favor of using a WatermarkEstimator ([BEAM-9430](https://issues.apache.org/jira/browse/BEAM-9430)).
* Coder inference for PCollection of Row objects has been disabled ([BEAM-9569](https://issues.apache.org/jira/browse/BEAM-9569)).

## Deprecations
* Java SDK: Beam Schema FieldType.getMetadata is now deprecated and is replaced by the Beam
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,13 @@ public static void main(String[] args) {
pipeline.run().waitUntilFinish();
}

private static MapElements<Row, Row> logRecords(String suffix) {
private static MapElements<Row, Void> logRecords(String suffix) {
return MapElements.via(
new SimpleFunction<Row, Row>() {
new SimpleFunction<Row, Void>() {
@Override
public Row apply(Row input) {
public Void apply(Row input) {
System.out.println(input.getValues() + suffix);
return input;
return null;
}
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
/** Describes a customer. */
@DefaultSchema(JavaBeanSchema.class)
public class Customer implements Serializable {
private String name;
private int id;
private String name;
private String countryOfResidence;

public Customer(int id, String name, String countryOfResidence) {
Expand All @@ -37,26 +37,26 @@ public Customer(int id, String name, String countryOfResidence) {

public Customer() {}

public String getName() {
return name;
}

public int getId() {
return id;
}

public String getCountryOfResidence() {
return countryOfResidence;
public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
public String getCountryOfResidence() {
return countryOfResidence;
}

public void setId(int id) {
this.id = id;
}

public void setName(String name) {
this.name = name;
}

public void setCountryOfResidence(String countryOfResidence) {
this.countryOfResidence = countryOfResidence;
}
Expand All @@ -77,6 +77,20 @@ public boolean equals(Object o) {

@Override
public int hashCode() {
return Objects.hash(name, id, countryOfResidence);
return Objects.hash(id, name, countryOfResidence);
}

@Override
public String toString() {
return "Customer{"
+ "id="
+ id
+ ", name='"
+ name
+ '\''
+ ", countryOfResidence='"
+ countryOfResidence
+ '\''
+ '}';
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,9 @@ public boolean equals(Object o) {
public int hashCode() {
return Objects.hash(id, customerId);
}

@Override
public String toString() {
return "Order{" + "id=" + id + ", customerId=" + customerId + '}';
}
}

0 comments on commit 37838f2

Please sign in to comment.