Class VeniceSchemaProjector
The projection follows the writer schema, which is guaranteed (by an upstream preflight projection-subset check)
to be obtainable from the input schema. At every nesting level (records, array elements, map values) the input may
wrap a field as a nullable union ([null, X] vs writer X) and may carry extra fields the writer does
not declare. Projection rebuilds each record under the writer schema, unwrapping nullable inputs and dropping the
input's extra fields at every level. Subtrees that need no projection (the input subschema already equals the writer
subschema) are copied by reference rather than rebuilt.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.apache.avro.generic.GenericRecordprojectRmd(org.apache.avro.generic.GenericRecord srcRmd, org.apache.avro.Schema targetRmdSchema) Project a Replication Metadata (RMD) record down to the writer's RMD schema, in lockstep with the value.org.apache.avro.generic.GenericRecordprojectValue(org.apache.avro.generic.GenericRecord src, org.apache.avro.Schema writerValueSchema) Project a value record down to the writer value schema.
-
Constructor Details
-
VeniceSchemaProjector
public VeniceSchemaProjector()
-
-
Method Details
-
projectValue
public org.apache.avro.generic.GenericRecord projectValue(org.apache.avro.generic.GenericRecord src, org.apache.avro.Schema writerValueSchema) Project a value record down to the writer value schema.- Parameters:
src- the source value record (serialized against the superset schema), ornullfor a tombstonewriterValueSchema- the chosen registered writer value schema- Returns:
- a new record under
writerValueSchema, ornullifsrcisnull
-
projectRmd
public org.apache.avro.generic.GenericRecord projectRmd(org.apache.avro.generic.GenericRecord srcRmd, org.apache.avro.Schema targetRmdSchema) Project a Replication Metadata (RMD) record down to the writer's RMD schema, in lockstep with the value.The
replication_checkpoint_vectoris value-independent and is copied as-is. Thetimestampis a union of a value-levellongand (for record values) a per-field timestamp record:- a value-level
longis structure-independent and copied as-is; while - a per-field timestamp record (active-active stores) is projected to the writer's per-field timestamp schema. The per-field RMD record is flat (one entry per top-level value field) and a value field's timestamp metadata is unchanged by nullable wrapping, so projection is a field-by-field copy that drops the timestamp entries for value fields the writer schema does not declare.
- Parameters:
srcRmd- the source RMD record (generated against the superset value schema), ornullif the record carries no RMD (e.g. a batch record in a hybrid store)targetRmdSchema- the writer's RMD schema (generated against the writer value schema)- Returns:
- a new RMD record under
targetRmdSchema, ornullifsrcRmdisnull
- a value-level
-