Skip to content

Commit

Permalink
Review changes
Browse files Browse the repository at this point in the history
Reword statements

Simplify deserialization logic
  • Loading branch information
Daniyar Yeralin committed May 13, 2021
1 parent e7c7789 commit 37569c9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@ private void configureInnerSerde(Map<String, ?> configs, boolean isKey) {
}
}


@SuppressWarnings("unchecked")
private List<Inner> createListInstance(int listSize) {
try {
Expand Down Expand Up @@ -165,17 +164,10 @@ public List<Inner> deserialize(String topic, byte[] data) {
final int size = dis.readInt();
List<Inner> deserializedList = createListInstance(size);
for (int i = 0; i < size; i++) {
int entrySize = -1;
if (serStrategy == SerializationStrategy.CONSTANT_SIZE) {
if (nullIndexList.contains(i)) {
deserializedList.add(null);
}
entrySize = primitiveSize;
} else if (serStrategy == SerializationStrategy.VARIABLE_SIZE) {
entrySize = dis.readInt();
if (entrySize == ListSerde.NULL_ENTRY_VALUE) {
deserializedList.add(null);
}
int entrySize = serStrategy == SerializationStrategy.CONSTANT_SIZE ? primitiveSize : dis.readInt();
if (entrySize == ListSerde.NULL_ENTRY_VALUE || (nullIndexList != null && nullIndexList.contains(i))) {
deserializedList.add(null);
continue;
}
byte[] payload = new byte[entrySize];
if (dis.read(payload) == -1) {
Expand Down
11 changes: 5 additions & 6 deletions docs/streams/upgrade-guide.html
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,11 @@ <h3><a id="streams_api_changes_300" href="#streams_api_changes_300">Streams API
(meaning: use broker default replication factor).
The <code>replication.factor</code> value of <code>-1</code> requires broker version 2.4 or newer.
</p>
<p> The new serde type was introduced <code>ListSerde</code>: </p>
<ul>
<li> Added class <code>ListSerde</code> to (de)serialize <code>List</code>-based objects </li>
<li> Introduced <code>ListSerializer</code> and <code>ListDeserializer</code> to power the new functionality </li>
</ul>

<h3><a id="streams_api_changes_280" href="#streams_api_changes_280">Streams API changes in 2.8.0</a></h3>
<p>
Expand Down Expand Up @@ -1104,12 +1109,6 @@ <h3 class="anchor-heading"><a id="streams_api_changes_0101" class="anchor-link">
<li> JoinWindows has no default size anymore: JoinWindows.of("name").within(1000) changes to JoinWindows.of(1000) </li>
</ul>

<p> New serde type <code>ListSerde</code>: </p>
<ul>
<li> added class <code>ListSerde</code> to (de)serialize <code>List</code>-based objects </li>
<li> introduced <code>ListSerializer</code> and <code>ListDeserializer</code> to power the new functionality </li>
</ul>

<div class="pagination">
<a href="/{{version}}/documentation/streams/developer-guide/app-reset-tool" class="pagination__btn pagination__btn__prev">Previous</a>
<a href="#" class="pagination__btn pagination__btn__next pagination__btn--disabled">Next</a>
Expand Down

0 comments on commit 37569c9

Please sign in to comment.