Class Schema
java.lang.Object
io.confluent.kafka.schemaregistry.type.logical.Schema
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic classstatic enumstatic class -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringReservedparamskey carrying a field's Avro aliases (its previous names) as a comma-delimited string, populated by the Avro reader fromSchema.Field.aliases().static final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final StringReservedparamskey carrying an enum value's Protobuf number, populated by the Protobuf reader fromEnumValueDescriptor.getNumber().static final StringReservedparamskey carrying a field's Protobuf field number, populated by the Protobuf reader fromFieldDescriptor.getNumber(). -
Method Summary
Modifier and TypeMethodDescriptionstatic Schemacreate(Schema.Type type) static SchemacreateArray(Schema elementType) static SchemacreateBinary(int length) static SchemaCreates an unbounded bytes type (alias for VARBINARY(MAX_LENGTH)).static SchemacreateChar(int length) static SchemacreateDecimal(int precision, int scale) static SchemacreateEnum(List<Schema.EnumValue> values) static Schemastatic SchemacreateMultiset(Schema elementType) static SchemacreateNamedTypeRef(String qualifiedName) static SchemaCreates an unbounded string type (alias for VARCHAR(MAX_LENGTH)).static SchemacreateStruct(List<Schema.Field> fields) static SchemacreateTime(int precision) static SchemacreateTimestamp(int precision) static SchemacreateTimestampLtz(int precision) static SchemacreateUnion(List<Schema.UnionBranch> branches) static SchemacreateVarbinary(int length) static SchemacreateVarchar(int length) booleanThis named type's Avro aliases (its previous names), or an empty list whenAVRO_ALIASESis unset.getDoc()intintgetRules()Validation rules attached to this schema.intgetScale()getTags()getType()inthashCode()static booleanisCelReservedName(String name) True ifnamematches a CEL reserved word (case-insensitive).static booleanTrue ifkeybelongs to a format-native reserved param namespace (avro.orprotobuf.).booleanstatic StringQuotenameas a DDL identifier if it would otherwise fail to tokenize as one — i.e.setNullable(boolean nullable) stripFormatNativeParams(Map<String, Object> params) Returnparamswith every format-native key removed, or the same map unchanged when it contains none.abstract StringtoDdl()toString()protected StringwithNullableSuffix(String ddl)
-
Field Details
-
NO_PARAM
public static final int NO_PARAM- See Also:
-
MAX_LENGTH
public static final int MAX_LENGTH- See Also:
-
DEFAULT_LENGTH
public static final int DEFAULT_LENGTH- See Also:
-
DEFAULT_DECIMAL_PRECISION
public static final int DEFAULT_DECIMAL_PRECISION- See Also:
-
DEFAULT_DECIMAL_SCALE
public static final int DEFAULT_DECIMAL_SCALE- See Also:
-
DEFAULT_TIME_PRECISION
public static final int DEFAULT_TIME_PRECISION- See Also:
-
DEFAULT_TIMESTAMP_PRECISION
public static final int DEFAULT_TIMESTAMP_PRECISION- See Also:
-
PROTOBUF_FIELD_NUMBER
Reservedparamskey carrying a field's Protobuf field number, populated by the Protobuf reader fromFieldDescriptor.getNumber(). Read viaSchema.Field.getFieldNumber(). Part of theprotobuf.format-native reserved namespace: it mirrors a Protobuf-native slot (the field number) that the LT type system has no home for, so it is emitted through that native slot and stripped from any generic param container. SeeisFormatNativeParam(String).- See Also:
-
PROTOBUF_ENUM_NUMBER
Reservedparamskey carrying an enum value's Protobuf number, populated by the Protobuf reader fromEnumValueDescriptor.getNumber(). Read viaSchema.EnumValue.getEnumNumber(). Format-native on the same terms asPROTOBUF_FIELD_NUMBER. Unlike a field number it may be negative and may repeat (Protobuf'sallow_alias).- See Also:
-
AVRO_ALIASES
Reservedparamskey carrying a field's Avro aliases (its previous names) as a comma-delimited string, populated by the Avro reader fromSchema.Field.aliases(). Read viaSchema.Field.getAliases(). Avro field names cannot contain commas, so the delimiter is unambiguous. Part of theavro.format-native reserved namespace: it mirrors an Avro-native slot (aliases) that the LT type system has no home for, so it is emitted through that native slot and stripped from any generic param container. SeeisFormatNativeParam(String).- See Also:
-
-
Method Details
-
isFormatNativeParam
True ifkeybelongs to a format-native reserved param namespace (avro.orprotobuf.). Such params are authoritative only through their owning format's native slot (Avro aliases, Protobuf field number); in every generic param container (confluent:params, Protobuffield_meta.params) they are stripped on write and ignored on read. They enter and leave the LT param map only via the owning format's native slot or via a DDLWITHclause. This is distinct from thelogical./connect./flink.namespaces, whose values are absorbed into the LT type/structure and never persist as LT params. -
stripFormatNativeParams
Returnparamswith every format-native key removed, or the same map unchanged when it contains none. Used by the format writers/readers to keep their generic param containers (confluent:params, Protobuffield_meta.params) free of keys that are authoritative only through a native slot. -
getType
-
isNullable
public boolean isNullable() -
setNullable
-
getDoc
-
setDoc
-
getTags
-
setTags
-
getParams
-
getAliases
This named type's Avro aliases (its previous names), or an empty list whenAVRO_ALIASESis unset. Values stored by the Avro reader are always fullnames, since Avro resolves relative aliases at parse time; the param is also settable through a DDLWITHclause orsetParams(java.util.Map<java.lang.String, java.lang.Object>), and those values are returned as written. Avrofixedis out of scope: it converts to an unnamed type with no home for them. -
setParams
-
getRules
Validation rules attached to this schema. For struct types this carries table-level CHECK constraints (constraints that may reference any field). Empty for non-struct schemas in the typical case. -
setRules
-
getFields
-
getField
-
getEnumValues
-
getBranches
-
getElementType
-
getKeyType
-
getValueType
-
getPrecision
public int getPrecision() -
getScale
public int getScale() -
getLength
public int getLength() -
getQualifiedName
-
toDdl
-
withNullableSuffix
-
create
-
createDecimal
-
createString
Creates an unbounded string type (alias for VARCHAR(MAX_LENGTH)). -
createVarchar
-
createChar
-
createBytes
Creates an unbounded bytes type (alias for VARBINARY(MAX_LENGTH)). -
createBinary
-
createVarbinary
-
createTime
-
createTimestamp
-
createTimestampLtz
-
createStruct
-
createEnum
-
createUnion
-
createArray
-
createMultiset
-
createMap
-
createNamedTypeRef
-
equals
-
hashCode
public int hashCode() -
toString
-
isCelReservedName
True ifnamematches a CEL reserved word (case-insensitive). The translator uses this to switch between dot-syntax and index-syntax column-ref emit so reserved-name fields still produce valid CEL. -
quoteIdentifierIfNeeded
Quotenameas a DDL identifier if it would otherwise fail to tokenize as one — i.e. it's empty, contains non-identifier characters, matches a SQL keyword that the grammar doesn't accept as an identifier, or matches a CEL reserved word (so CHECK references emit cleanly). Quoted form: backtick-wrap and double internal backticks.Used by both
toDdl()and the LT-to-DDL converter so identifier emission is consistent across paths.
-