gravitino.api.types.types.Types¶
- class gravitino.api.types.types.Types¶
Bases:
objectThe helper class for Type. It contains all built-in types and provides utility methods.
- __init__()¶
Methods
__init__()allow_auto_increment(data_type)Checks if the given data type is allowed to be an auto-increment column.
- class BinaryType¶
Bases:
PrimitiveType- simple_string() str¶
Returns a readable string representation of the type.
- class BooleanType¶
Bases:
PrimitiveTypeThe boolean type in Gravitino.
- simple_string() str¶
Returns a readable string representation of the type.
- class ByteType(signed: bool = True)¶
Bases:
IntegralTypeThe byte type in Gravitino.
- signed() bool¶
Returns True if the integer type is signed, False otherwise.
- simple_string() str¶
Returns a readable string representation of the type.
- class DateType¶
Bases:
DateTimeTypeThe date time type in Gravitino.
- simple_string() str¶
Returns a readable string representation of the type.
- class DecimalType(precision: int, scale: int)¶
Bases:
FractionTypeThe decimal type in Gravitino.
- static check_precision_scale(precision: int, scale: int)¶
Ensures the precision and scale values are within valid range.
- Args:
precision: The precision of the decimal. scale: The scale of the decimal.
- simple_string() str¶
Returns a readable string representation of the type.
- class DoubleType¶
Bases:
FractionType- simple_string() str¶
Returns a readable string representation of the type.
- class ExternalType(catalog_string: str)¶
Bases:
TypeRepresents a type that is defined in an external catalog.
- classmethod of(catalog_string: str) ExternalType¶
Creates a new ExternalType with the given catalog string.
- Args:
catalog_string The string representation of this type in the catalog.
- Returns:
A new ExternalType instance.
- simple_string() str¶
Returns a readable string representation of the type.
- class FixedCharType(length: int)¶
Bases:
PrimitiveTypeThe fixed char type in Gravitino.
- simple_string() str¶
Returns a readable string representation of the type.
- class FixedType(length: int)¶
Bases:
PrimitiveTypeFixed-length byte array type, if you want to use variable-length byte array, use BinaryType instead.
- classmethod of(length: int) FixedType¶
- Args:
length: The length of the fixed type.
- Returns:
A FixedType instance with the given length.
- simple_string() str¶
Returns a readable string representation of the type.
- class FloatType¶
Bases:
FractionType- simple_string() str¶
Returns a readable string representation of the type.
- class IntegerType(signed=True)¶
Bases:
IntegralType- signed() bool¶
Returns True if the integer type is signed, False otherwise.
- simple_string() str¶
Returns a readable string representation of the type.
- class IntervalDayType¶
Bases:
IntervalTypeThe interval day type in Gravitino.
- simple_string() str¶
Returns a readable string representation of the type.
- class IntervalYearType¶
Bases:
IntervalTypeThe interval year type in Gravitino.
- simple_string() str¶
Returns a readable string representation of the type.
- class ListType(element_type: Type, element_nullable: bool)¶
Bases:
ComplexTypeThe list type in Gravitino.
- classmethod not_null(element_type: Type) ListType¶
Create a new ListType with the given element type.
- Args:
element_type: The element type of the list.
- Returns:
A new ListType instance.
- classmethod nullable(element_type: Type) ListType¶
Create a new ListType with the given element type and the type is nullable.
- Args:
element_type: The element type of the list.
- Returns:
A new ListType instance.
- classmethod of(element_type: Type, element_nullable: bool) ListType¶
Create a new ListType with the given element type and whether the element is nullable.
- Args:
element_type: The element type of the list. element_nullable: Whether the element of the list is nullable.
- Returns
A new ListType instance.
- simple_string() str¶
Returns a readable string representation of the type.
- class LongType(signed=True)¶
Bases:
IntegralType- signed() bool¶
Returns True if the integer type is signed, False otherwise.
- simple_string() str¶
Returns a readable string representation of the type.
- class MapType(key_type: Type, value_type: Type, value_nullable: bool)¶
Bases:
ComplexTypeThe map type in Gravitino.
- classmethod of(key_type: Type, value_type: Type, value_nullable: bool) MapType¶
Create a new MapType with the given key type, value type, and whether the value is nullable.
- Args:
key_type: The key type of the map. value_type: The value type of the map. value_nullable: Whether the value of the map is nullable.
- Returns:
A new MapType instance.
- simple_string() str¶
Returns a readable string representation of the type.
- class NullType¶
Bases:
TypeThe data type representing NULL values.
- simple_string() str¶
Returns a readable string representation of the type.
- class ShortType(signed=True)¶
Bases:
IntegralType- signed() bool¶
Returns True if the integer type is signed, False otherwise.
- simple_string() str¶
Returns a readable string representation of the type.
- class StringType¶
Bases:
PrimitiveTypeThe string type in Gravitino, equivalent to varchar(MAX), which the MAX is determined by the underlying catalog.
- simple_string() str¶
Returns a readable string representation of the type.
- class StructType(fields: List[Field])¶
Bases:
ComplexTypeThe struct type in Gravitino.
- classmethod of(*fields) StructType¶
- Args:
fields: The fields of the struct type.
- Returns:
A StructType instance with the given fields.
- simple_string() str¶
Returns a readable string representation of the type.
- class TimeType(precision: int | None = None)¶
Bases:
DateTimeType- has_precision_set() bool¶
Returns whether the time type has precision set
- precision() int¶
Returns the precision of the time type
- simple_string() str¶
Returns a readable string representation of the type.
- class TimestampType(with_time_zone: bool, precision: int | None = None)¶
Bases:
DateTimeType- has_precision_set() bool¶
Returns whether the precision is set for the timestamp type
- has_time_zone() bool¶
Returns whether the timestamp type has a timezone
- precision() int¶
Returns the precision of the timestamp type
- simple_string() str¶
Returns a readable string representation of the type.
- classmethod with_time_zone(precision: int | None = None) TimestampType¶
Create TimestampType with Timezone
- classmethod without_time_zone(precision: int | None = None) TimestampType¶
Create TimestampType without Timezone
- class UUIDType¶
Bases:
PrimitiveTypeThe uuid type in Gravitino.
- simple_string() str¶
Returns a readable string representation of the type.
- class UnionType(types: list[gravitino.api.types.type.Type])¶
Bases:
ComplexTypeThe union type in Gravitino.
- classmethod of(*types: Type) UnionType¶
Create a new UnionType with the given types.
- Args:
types: The types of the union.
- Returns:
A new UnionType instance.
- simple_string() str¶
Returns a readable string representation of the type.
- class UnparsedType(unparsed_type: str)¶
Bases:
TypeRepresents a type that is not parsed yet. The parsed type is represented by other types of types.
- classmethod of(unparsed_type: str) UnparsedType¶
Creates a new unparsed_type with the given unparsed type.
- Args:
unparsed_type The unparsed type.
- Returns
A new unparsed_type instance.
- simple_string() str¶
Returns a readable string representation of the type.
- class VarCharType(length: int)¶
Bases:
PrimitiveTypeThe varchar type in Gravitino.
- simple_string() str¶
Returns a readable string representation of the type.