Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -266,4 +266,14 @@ public String create(PipelineOptions options) {
List<String> getJdkAddOpenModules();

void setJdkAddOpenModules(List<String> options);

/**
* Set trusted serializable classes for use with the Avro `java-class` schema property.
*
* <p>See: https://github.com/apache/avro/pull/3376
*/
@Description("Serializable classes required by java-class props in Avro 1.11.4+")
List<String> getAvroSerializableClasses();

void setAvroSerializableClasses(List<String> options);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

}
8 changes: 8 additions & 0 deletions sdks/java/container/boot.go
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,14 @@ func main() {
args = append(args, "--add-modules="+module.GetStringValue())
}
}
// Add trusted Avro serializable classes
if serializableClasses, ok := pipelineOptions.GetStructValue().GetFields()["avroSerializableClasses"]; ok {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could have both; a default that matches avro and this option to override when needed. Ideally the avro default list should be public so users can extend/modify it as required.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, for classes already caused regressions ("java.math.BigDecimal", and if there are others) we can add it here for users

var serializableClassesSlice []string
for _, cls := range serializableClasses.GetListValue().GetValues() {
serializableClassesSlice = append(serializableClassesSlice, cls.GetStringValue())
}
args = append(args, "-Dorg.apache.avro.SERIALIZABLE_CLASSES="+strings.Join(serializableClassesSlice, ","))
}
}
// Automatically open modules for Java 11+
openModuleAgentJar := "/opt/apache/beam/jars/open-module-agent.jar"
Expand Down
Loading