mirror of
https://github.com/microsoft/HybridRow.git
synced 2026-01-26 04:43:17 +00:00
code cleanup in prep for next step: loading a namespace that includes a schema with a udt: the one that the Spark connector team needs.
This commit is contained in:
@@ -25,9 +25,28 @@ import java.util.PrimitiveIterator;
|
|||||||
@Type(value = TaggedPropertyType.class, name="tagged"),
|
@Type(value = TaggedPropertyType.class, name="tagged"),
|
||||||
@Type(value = TuplePropertyType.class, name="tuple"),
|
@Type(value = TuplePropertyType.class, name="tuple"),
|
||||||
// Primitive types
|
// Primitive types
|
||||||
|
@Type(value = PrimitivePropertyType.class, name="null"),
|
||||||
|
@Type(value = PrimitivePropertyType.class, name="bool"),
|
||||||
|
@Type(value = PrimitivePropertyType.class, name="int8"),
|
||||||
|
@Type(value = PrimitivePropertyType.class, name="int16"),
|
||||||
@Type(value = PrimitivePropertyType.class, name="int32"),
|
@Type(value = PrimitivePropertyType.class, name="int32"),
|
||||||
|
@Type(value = PrimitivePropertyType.class, name="int64"),
|
||||||
|
@Type(value = PrimitivePropertyType.class, name="varint"),
|
||||||
|
@Type(value = PrimitivePropertyType.class, name="uint8"),
|
||||||
|
@Type(value = PrimitivePropertyType.class, name="uint16"),
|
||||||
@Type(value = PrimitivePropertyType.class, name="uint32"),
|
@Type(value = PrimitivePropertyType.class, name="uint32"),
|
||||||
@Type(value = PrimitivePropertyType.class, name="utf8")
|
@Type(value = PrimitivePropertyType.class, name="uint64"),
|
||||||
|
@Type(value = PrimitivePropertyType.class, name="varuint"),
|
||||||
|
@Type(value = PrimitivePropertyType.class, name="float32"),
|
||||||
|
@Type(value = PrimitivePropertyType.class, name="float64"),
|
||||||
|
@Type(value = PrimitivePropertyType.class, name="float128"),
|
||||||
|
@Type(value = PrimitivePropertyType.class, name="decimal"),
|
||||||
|
@Type(value = PrimitivePropertyType.class, name="datetime"),
|
||||||
|
@Type(value = PrimitivePropertyType.class, name="unixdatetime"),
|
||||||
|
@Type(value = PrimitivePropertyType.class, name="binary"),
|
||||||
|
@Type(value = PrimitivePropertyType.class, name="guid"),
|
||||||
|
@Type(value = PrimitivePropertyType.class, name="utf8"),
|
||||||
|
@Type(value = PrimitivePropertyType.class, name="any")
|
||||||
})
|
})
|
||||||
public abstract class PropertyType {
|
public abstract class PropertyType {
|
||||||
|
|
||||||
|
|||||||
@@ -186,7 +186,7 @@ public enum TypeKind {
|
|||||||
/**
|
/**
|
||||||
* An untyped sparse field.
|
* An untyped sparse field.
|
||||||
* <p>
|
* <p>
|
||||||
* May only be used to define the type within a nested scope.
|
* May only be used to define the type of a field within a nested scope.
|
||||||
*/
|
*/
|
||||||
ANY(30, "any");
|
ANY(30, "any");
|
||||||
|
|
||||||
|
|||||||
@@ -4,54 +4,73 @@
|
|||||||
package com.azure.data.cosmos.serialization.hybridrow.schemas;
|
package com.azure.data.cosmos.serialization.hybridrow.schemas;
|
||||||
|
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.SchemaId;
|
import com.azure.data.cosmos.serialization.hybridrow.SchemaId;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* UDT properties represent nested structures with an independent schema.
|
* UDT properties represent nested structures with an independent schema.
|
||||||
* <p>
|
* <p>
|
||||||
* UDT properties include a nested row within an existing row as a column. The schema of the
|
* UDT properties include a nested row within an existing row as a column. The schema of the nested row may be evolved
|
||||||
* nested row may be evolved independently of the outer row. Changes to the independent schema affect
|
* independently of the outer row. Changes to the independent schema affect all outer schemas where the UDT is used.
|
||||||
* all outer schemas where the UDT is used.
|
|
||||||
*/
|
*/
|
||||||
public class UdtPropertyType extends ScopePropertyType {
|
public class UdtPropertyType extends ScopePropertyType {
|
||||||
|
|
||||||
|
@JsonProperty(required = true)
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
|
@JsonProperty(required = true)
|
||||||
private SchemaId schemaId;
|
private SchemaId schemaId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initializes a new {@link UdtPropertyType}.
|
* The name of the UDT schema defining the structure of a nested row.
|
||||||
*/
|
|
||||||
public UdtPropertyType() {
|
|
||||||
this.schemaId(SchemaId.INVALID);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The identifier of the UDT schema defining the structure for the nested row.
|
|
||||||
* <p>
|
* <p>
|
||||||
* The UDT schema MUST be defined within the same {@link Namespace} as the schema that references it.
|
* The UDT schema MUST be defined within the same {@link Namespace} as the schema that references it.
|
||||||
|
*
|
||||||
|
* @return the identifier of the UDT schema defining the structure of a nested row.
|
||||||
*/
|
*/
|
||||||
public final String name() {
|
public final String name() {
|
||||||
return this.name;
|
return this.name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public final void name(String value) {
|
/**
|
||||||
|
* Sets the name of the UDT schema defining the structure of a nested row.
|
||||||
|
* <p>
|
||||||
|
* The UDT schema MUST be defined within the same {@link Namespace} as the schema that references it.
|
||||||
|
*
|
||||||
|
* @param value the name of the UDT schema defining the structure of a nested row.
|
||||||
|
* @return a reference to this {@link UdtPropertyType}.
|
||||||
|
*/
|
||||||
|
public final UdtPropertyType name(String value) {
|
||||||
this.name = value;
|
this.name = value;
|
||||||
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The unique identifier for a schema.
|
* The unique identifier of the UDT schema defining the structure of a nested row.
|
||||||
* <p>
|
* <p>
|
||||||
* Optional uniquifier if multiple versions of {@link #name} appears within the Namespace.
|
* Optional uniqueifier if multiple versions of {@link #name} appears within the {@link Namespace}.
|
||||||
* <p>
|
* <p>
|
||||||
* If multiple versions of a UDT are defined within the {@link Namespace} then the globally
|
* If multiple versions of a UDT are defined within a {@link Namespace} the globally unique identifier of the
|
||||||
* unique identifier of the specific version referenced MUST be provided.
|
* specific version referenced MUST be provided.
|
||||||
* </p>
|
*
|
||||||
|
* @return the unique identifier of the UDT schema defining the structure of a nested row or {@code null}.
|
||||||
*/
|
*/
|
||||||
public final SchemaId schemaId() {
|
public final SchemaId schemaId() {
|
||||||
return this.schemaId;
|
return this.schemaId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the unique identifier of the UDT schema defining the structure of a nested row.
|
||||||
|
* <p>
|
||||||
|
* Optional uniqueifier if multiple versions of {@link #name} appears within the {@link Namespace}.
|
||||||
|
* <p>
|
||||||
|
* If multiple versions of a UDT are defined within a {@link Namespace} the globally unique identifier of the
|
||||||
|
* specific version referenced MUST be provided.
|
||||||
|
*
|
||||||
|
* @param value the unique identifier of the UDT schema defining the structure of a nested row or {@code null}.
|
||||||
|
* @return a reference to this {@link UdtPropertyType}.
|
||||||
|
*/
|
||||||
public final UdtPropertyType schemaId(SchemaId value) {
|
public final UdtPropertyType schemaId(SchemaId value) {
|
||||||
this.schemaId = value;
|
this.schemaId = value;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user