Skip to content

Commit

Permalink
AutoConsumeSchema: use decode(payload, schemaversion) (apache#10700)
Browse files Browse the repository at this point in the history
In `AutoConsumeSchema.decode `we should proxy the call to "`decode(payload, schemaversion)`" correctly to the wrapped Schema.

Even if the Schema is picked up from a map (`schemaMap`) that keeps track of the _schemaversion_, we must pass the correct `schemaversion` to the underlying Schema.

Some Schema implementations may fall back to using the "latest schema" if you pass "null" as _schemaversion_ or call `decode(payload)` (without _schemaversion_), leading to non consistent behaviour
  • Loading branch information
eolivelli authored May 26, 2021
1 parent 3b504d0 commit c2e5ec6
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ public GenericRecord decode(byte[] bytes, byte[] schemaVersion) {
SchemaVersion sv = BytesSchemaVersion.of(schemaVersion);
fetchSchemaIfNeeded(sv);
ensureSchemaInitialized(sv);
return adapt(schemaMap.get(sv).decode(bytes), schemaVersion);
return adapt(schemaMap.get(sv).decode(bytes, schemaVersion), schemaVersion);
}

@Override
Expand Down

0 comments on commit c2e5ec6

Please sign in to comment.