Class VeniceSchemaProjector
The projection is a pure structural drop. The writer schema is guaranteed (by an upstream preflight subset check) to be a strict subset of the input schema: every field the writer declares exists in the input and is deeply, exactly equal; the input may only carry extra top-level fields. Projection therefore reduces to: build a record under the writer schema, copy each writer field's value from the input by exact name, and let the input's extra top-level fields fall away.
-
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.Projection only runs when write compute is not enabled. In that mode the RMD timestamp is always a whole-record (value-level)
long, so projection reduces to copying thelongtimestamp and the value-independent replication_checkpoint_vector onto a record under the target RMD schema. A per-field timestamp only arises with write compute (partial updates), where the corresponding superset schema is used and no projection is needed; encountering one here therefore indicates a misuse and is rejected.- 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
-