Class CheckCompatibility


public class CheckCompatibility extends TypeUtil.CustomOrderSchemaVisitor<List<String>>
  • Method Details

    • writeCompatibilityErrors

      public static List<String> writeCompatibilityErrors(Schema readSchema, Schema writeSchema)
      Returns a list of compatibility errors for writing with the given write schema. This includes nullability: writing optional (nullable) values to a required field is an error.
      Parameters:
      readSchema - a read schema
      writeSchema - a write schema
      Returns:
      a list of error details, or an empty list if there are no compatibility problems
    • writeCompatibilityErrors

      public static List<String> writeCompatibilityErrors(Schema readSchema, Schema writeSchema, boolean checkOrdering)
      Returns a list of compatibility errors for writing with the given write schema. This includes nullability: writing optional (nullable) values to a required field is an error Optionally this method allows case where input schema has different ordering than table schema.
      Parameters:
      readSchema - a read schema
      writeSchema - a write schema
      checkOrdering - If false, allow input schema to have different ordering than table schema
      Returns:
      a list of error details, or an empty list if there are no compatibility problems
    • typeCompatibilityErrors

      public static List<String> typeCompatibilityErrors(Schema readSchema, Schema writeSchema, boolean checkOrdering)
      Returns a list of compatibility errors for writing with the given write schema. This checks type compatibility and not nullability: writing optional (nullable) values to a required field is not an error. To check nullability as well as types, Optionally this method allows case where input schema has different ordering than table schema. use writeCompatibilityErrors(Schema, Schema).
      Parameters:
      readSchema - a read schema
      writeSchema - a write schema
      checkOrdering - If false, allow input schema to have different ordering than table schema
      Returns:
      a list of error details, or an empty list if there are no compatibility problems
    • typeCompatibilityErrors

      public static List<String> typeCompatibilityErrors(Schema readSchema, Schema writeSchema)
      Returns a list of compatibility errors for writing with the given write schema. This checks type compatibility and not nullability: writing optional (nullable) values to a required field is not an error. To check nullability as well as types, use writeCompatibilityErrors(Schema, Schema).
      Parameters:
      readSchema - a read schema
      writeSchema - a write schema
      Returns:
      a list of error details, or an empty list if there are no compatibility problems
    • readCompatibilityErrors

      public static List<String> readCompatibilityErrors(Schema readSchema, Schema writeSchema)
      Returns a list of compatibility errors for reading with the given read schema.
      Parameters:
      readSchema - a read schema
      writeSchema - a write schema
      Returns:
      a list of error details, or an empty list if there are no compatibility problems
    • schema

      public List<String> schema(Schema readSchema, Supplier<List<String>> structErrors)
      Overrides:
      schema in class TypeUtil.CustomOrderSchemaVisitor<List<String>>
    • struct

      public List<String> struct(Types.StructType readStruct, Iterable<List<String>> fieldErrorLists)
      Overrides:
      struct in class TypeUtil.CustomOrderSchemaVisitor<List<String>>
    • field

      public List<String> field(Types.NestedField readField, Supplier<List<String>> fieldErrors)
      Overrides:
      field in class TypeUtil.CustomOrderSchemaVisitor<List<String>>
    • list

      public List<String> list(Types.ListType readList, Supplier<List<String>> elementErrors)
      Overrides:
      list in class TypeUtil.CustomOrderSchemaVisitor<List<String>>
    • map

      public List<String> map(Types.MapType readMap, Supplier<List<String>> keyErrors, Supplier<List<String>> valueErrors)
      Overrides:
      map in class TypeUtil.CustomOrderSchemaVisitor<List<String>>
    • primitive

      public List<String> primitive(Type.PrimitiveType readPrimitive)
      Overrides:
      primitive in class TypeUtil.CustomOrderSchemaVisitor<List<String>>