Rules and Restrictions

Teradata Vantageā„¢ DATASET Data Type

brand
Software
Teradata Vantage
prodname
Teradata Database
Teradata Vantage NewSQL Engine
vrm_release
16.20
category
Programming Reference
featnum
B035-1198-162K

The two values passed into this function must be a valid schema.

The following information is from the Apache Avro specification. It is not Teradata specific; Teradata is implementing Apache's definition of matching schemas.

In this function, the first value passed in is regarded as the writer's schema and the second value passed in as the reader's schema. Both must represent a valid Avro schema, and the values must be a CHAR/VARCHAR/CLOB/JSON type.

To match, one of the following must occur:
  • Both schemas are arrays whose item types match.
  • Both schemas are maps whose value types match.
  • Both schemas are enums whose names match.
  • Both schemas are fixed whose sizes and names match.
  • Both schemas are records with the same name.
  • Either schema is a union.
  • Both schemas have the same primitive type.
  • The writer's schema may be promoted to the reader's schema if:
    • INT can be promoted to LONG, FLOAT, or DOUBLE.
    • LONG can be promoted to FLOAT or DOUBLE.
    • FLOAT can be promoted to DOUBLE.
    • The ordering of fields may be different. Fields are matched by name.
    • Schemas for fields with the same name in both records are resolved recursively.
    • If the writer's record contains a field with a name not present in the reader's record, the writer's value for that field is ignored.
    • If the reader's record schema has a field that contains a default value, and the writer's schema does not have a field with the same name, then use the default value from the reader's schema field.
    • If the reader's record schema has a field with no default value, and the writer's schema does not have a field with the same name, the schemas do not match.
  • If both are enums and the writer's symbol is not present in the reader's enum, then the schemas do not match.
  • If both are arrays: The resolution algorithm is applied recursively to the reader's and writer's array item schemas.
  • If both are maps: The resolution algorithm is applied recursively to the reader's and writer's value schemas.
  • If both are unions: The first schema in the reader's union that matches the selected writer's union schema is recursively resolved against it. If none match, the schemas do not match.
  • If the reader's schema is a union, but writer's is not, then the first schema in the reader's union that matches the writer's schema is recursively resolved against it. If none match, the schemas do not match.
  • If the writer's schema is a union, but the reader's schema is not:
    • If the reader's schema matches the selected writer's schema, it is recursively resolved against it.
    • If they do not match, the schemas do not match.
  • A schema's "doc" fields are ignored for the purposes of schema resolution.