Skip to content

Commit

Permalink
Move avro schema length to BaseSchemRegistry
Browse files Browse the repository at this point in the history
  • Loading branch information
shydefoo committed Sep 26, 2024
1 parent abcfb3e commit 7e7e417
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ public abstract class BaseSchemaRegistry {
protected static String COLUMN_FAMILY = "metadata";
protected static String QUALIFIER = "avro";
protected static String KEY_PREFIX = "schema#";
public static final int SCHEMA_REFERENCE_LENGTH = 4;

public static class SchemaReference {
private final String tableName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,10 @@ private List<Feature> decodeFeatures(
BinaryDecoder reusedDecoder,
long timestamp)
throws IOException {
ByteString schemaReferenceBytes = value.substring(0, 4);
byte[] featureValueBytes = value.substring(4).toByteArray();
ByteString schemaReferenceBytes =
value.substring(0, BigTableSchemaRegistry.SCHEMA_REFERENCE_LENGTH);
byte[] featureValueBytes =
value.substring(BigTableSchemaRegistry.SCHEMA_REFERENCE_LENGTH).toByteArray();

BigTableSchemaRegistry.SchemaReference schemaReference =
new BigTableSchemaRegistry.SchemaReference(tableName, schemaReferenceBytes);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,10 @@ private List<Feature> decodeFeatures(
BinaryDecoder reusedDecoder,
long timestamp)
throws IOException {
ByteString schemaReferenceBytes = value.substring(0, 4);
byte[] featureValueBytes = value.substring(4).toByteArray();
ByteString schemaReferenceBytes =
value.substring(0, HBaseSchemaRegistry.SCHEMA_REFERENCE_LENGTH);
byte[] featureValueBytes =
value.substring(HBaseSchemaRegistry.SCHEMA_REFERENCE_LENGTH).toByteArray();

HBaseSchemaRegistry.SchemaReference schemaReference =
new HBaseSchemaRegistry.SchemaReference(tableName, schemaReferenceBytes);
Expand Down

0 comments on commit 7e7e417

Please sign in to comment.