[
https://issues.apache.org/jira/browse/BEAM-12238?focusedWorklogId=591237&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-591237
]
ASF GitHub Bot logged work on BEAM-12238:
-----------------------------------------
Author: ASF GitHub Bot
Created on: 29/Apr/21 21:02
Start Date: 29/Apr/21 21:02
Worklog Time Spent: 10m
Work Description: ihji commented on a change in pull request #14683:
URL: https://github.com/apache/beam/pull/14683#discussion_r623395647
##########
File path:
sdks/java/harness/src/test/java/org/apache/beam/fn/harness/state/StateBackedIterableTest.java
##########
@@ -171,6 +173,38 @@ public void testEncodeDecodeStateBackedIterable() throws
Exception {
assertEquals(iterable.prefix, result.prefix);
assertEquals(iterable.request, result.request);
}
+
+ @Test
+ public void testSerializability() throws Exception {
+ FakeBeamFnStateClient fakeBeamFnStateClient =
+ new FakeBeamFnStateClient(
+ ImmutableMap.of(
+ key("suffix"), encode("C", "D", "E"),
+ key("emptySuffix"), encode()));
+
+ StateBackedIterable<String> iterable =
+ new StateBackedIterable<>(
+ fakeBeamFnStateClient,
+ "instruction",
+ encode("suffix"),
+ StringUtf8Coder.of(),
+ ImmutableList.of("A", "B"));
+
+ List<String> expected = ImmutableList.of("A", "B", "C", "D", "E");
+
+ ByteArrayOutputStream bout = new ByteArrayOutputStream();
+ ObjectOutputStream out = new ObjectOutputStream(bout);
+ out.writeObject(iterable);
+ out.flush();
+ ByteArrayInputStream bin = new ByteArrayInputStream(bout.toByteArray());
+ ObjectInputStream in = new ObjectInputStream(bin);
+ Iterable<String> deserialized = (Iterable<String>) in.readObject();
Review comment:
Probably a dumb question. The `beamFnStateClient` field is set to
transient. How could the deserialized iterable keep the information from
`fakeBeamFnStateClient`?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
Issue Time Tracking
-------------------
Worklog Id: (was: 591237)
Time Spent: 1h 20m (was: 1h 10m)
> StateBackedIterable is not Serializable
> ---------------------------------------
>
> Key: BEAM-12238
> URL: https://issues.apache.org/jira/browse/BEAM-12238
> Project: Beam
> Issue Type: Bug
> Components: sdk-java-core
> Reporter: Robert Bradshaw
> Assignee: Robert Bradshaw
> Priority: P2
> Fix For: 2.30.0
>
> Time Spent: 1h 20m
> Remaining Estimate: 0h
>
> This prevents its use within another serialized object. Though it is
> generally preferable to avoid the Serializable coder, prohibiting this would
> be a regression.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)