Package com.linkedin.venice.utils
Class AvroSupersetSchemaUtils
- java.lang.Object
-
- com.linkedin.venice.utils.AvroSupersetSchemaUtils
-
public class AvroSupersetSchemaUtils extends java.lang.Object
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static org.apache.avro.Schema
generateSupersetSchema(org.apache.avro.Schema existingSchema, org.apache.avro.Schema newSchema)
Generate super-set schema of two Schemas.static MultiSchemaResponse.Schema
getLatestUpdateSchemaFromSchemaResponse(MultiSchemaResponse schemaResponse, int supersetSchemaId)
static MultiSchemaResponse.Schema
getSupersetSchemaFromSchemaResponse(MultiSchemaResponse schemaResponse, int supersetSchemaId)
static boolean
isSupersetSchema(org.apache.avro.Schema s1, org.apache.avro.Schema s2)
static boolean
validateSubsetValueSchema(org.apache.avro.Schema subsetValueSchema, java.lang.String supersetSchemaStr)
* Validate if the Subset Value Schema is a subset of the Superset Value Schema, here the field props are not used to check if the field is same or not.
-
-
-
Method Detail
-
isSupersetSchema
public static boolean isSupersetSchema(org.apache.avro.Schema s1, org.apache.avro.Schema s2)
- Returns:
- True if {@param s1} is {@param s2}'s superset schema and false otherwise.
-
generateSupersetSchema
public static org.apache.avro.Schema generateSupersetSchema(org.apache.avro.Schema existingSchema, org.apache.avro.Schema newSchema)
Generate super-set schema of two Schemas. If we have {A,B,C} and {A,B,D} it will generate {A,B,C,D}, where C/D could be nested record change as well eg, array/map of records, or record of records. Prerequisite: The top-level schema are of type RECORD only and each field have default values. ie they are compatible schemas and the generated schema will pick the default value from new value schema.- Parameters:
existingSchema
- schema existing in the reponewSchema
- schema to be added.- Returns:
- super-set schema of existingSchema abd newSchema
-
getSupersetSchemaFromSchemaResponse
public static MultiSchemaResponse.Schema getSupersetSchemaFromSchemaResponse(MultiSchemaResponse schemaResponse, int supersetSchemaId)
-
getLatestUpdateSchemaFromSchemaResponse
public static MultiSchemaResponse.Schema getLatestUpdateSchemaFromSchemaResponse(MultiSchemaResponse schemaResponse, int supersetSchemaId)
-
validateSubsetValueSchema
public static boolean validateSubsetValueSchema(org.apache.avro.Schema subsetValueSchema, java.lang.String supersetSchemaStr)
* Validate if the Subset Value Schema is a subset of the Superset Value Schema, here the field props are not used to check if the field is same or not.
-
-