atlasdb
atlasdb copied to clipboard
[Generated Code] Field Deserialization Done On Every Columnar Get
Consider the schema
schema.addTableDefinition("table", new TableDefinition() {{
rowName();
rowComponent("row", ValueType.STRING);
columns();
column("column", "c", JPersister.class);
}});
Produces generated code
public SomeType getColumn() {
byte[] bytes = row.getColumns().get(PtBytes.toCachedBytes("c"));
if (bytes == null) {
return null;
}
Column value = Column.BYTES_HYDRATOR.hydrateFromBytes(bytes);
return value.getValue();
}
In particular, if you have something like
TableRowResult row = table.getRow(someRow).orElseThrow(() -> new IllegalStateException());
doStuff(row.getColumn(), row.getColumn());
This does the deserialization twice, which is unnecessary and probably unexpected - I imagine most users treat the RowResult
like they would one of the Immutables
data objects.