samredai commented on a change in pull request #3839:
URL: https://github.com/apache/iceberg/pull/3839#discussion_r783470432
##########
File path: python/src/iceberg/types.py
##########
@@ -157,15 +157,107 @@ def value(self) -> NestedField:
return self._value_field
-BooleanType = Type("boolean", "BooleanType", is_primitive=True)
-IntegerType = Type("int", "IntegerType", is_primitive=True)
-LongType = Type("long", "LongType", is_primitive=True)
-FloatType = Type("float", "FloatType", is_primitive=True)
-DoubleType = Type("double", "DoubleType", is_primitive=True)
-DateType = Type("date", "DateType", is_primitive=True)
-TimeType = Type("time", "TimeType", is_primitive=True)
-TimestampType = Type("timestamp", "TimestampType", is_primitive=True)
-TimestamptzType = Type("timestamptz", "TimestamptzType", is_primitive=True)
-StringType = Type("string", "StringType", is_primitive=True)
-UUIDType = Type("uuid", "UUIDType", is_primitive=True)
-BinaryType = Type("binary", "BinaryType", is_primitive=True)
+class Boolean(Type):
+ """`boolean` from https://iceberg.apache.org/#spec/#primitive-types"""
+
+ def __init__(self):
+ super().__init__("boolean", "BooleanType", is_primitive=True)
+
+
+class Integer(Type):
+ """32-bit signed integers: `int` from
https://iceberg.apache.org/#spec/#primitive-types"""
+
+ max: int = 2147483647
+
+ min: int = -2147483648
+
+ def __init__(self):
+ super().__init__("int", "IntegerType", is_primitive=True)
+
+
+class Long(Type):
+ """64-bit signed integers: `long` from
https://iceberg.apache.org/#spec/#primitive-types"""
+
+ max: int = 9223372036854775807
+
+ min: int = -9223372036854775808
+
+ def __init__(self):
+ super().__init__("long", "LongType", is_primitive=True)
+
+
+class Float(Type):
+ """32-bit IEEE 754 floating point: `float` from
https://iceberg.apache.org/#spec/#primitive-types"""
+
+ def __init__(self):
+ super().__init__("float", "FloatType", is_primitive=True)
+
+
+class Double(Type):
+ """64-bit IEEE 754 floating point: `double` from
https://iceberg.apache.org/#spec/#primitive-types"""
+
+ def __init__(self):
+ super().__init__("double", "DoubleType", is_primitive=True)
+
+
+class Date(Type):
+ """`date` type from https://iceberg.apache.org/#spec/#primitive-types"""
+
+ def __init__(self):
+ super().__init__("date", "DateType", is_primitive=True)
+
+
+class Time(Type):
+ """`time` type from https://iceberg.apache.org/#spec/#primitive-types"""
+
+ def __init__(self):
+ super().__init__("time", "TimeType", is_primitive=True)
+
+
+class Timestamp(Type):
+ """`timestamp` type from
https://iceberg.apache.org/#spec/#primitive-types"""
Review comment:
```py
"""A Timestamp data type in Iceberg can be represented using an instance
of this class. Timestamps in
Iceberg have microsecond precision and include a date and a time of day
without a timezone.
Example:
>>> column_foo = TimestampType()
>>> isinstance(column_foo, TimestampType)
True
"""
```
##########
File path: python/src/iceberg/types.py
##########
@@ -157,15 +157,107 @@ def value(self) -> NestedField:
return self._value_field
-BooleanType = Type("boolean", "BooleanType", is_primitive=True)
-IntegerType = Type("int", "IntegerType", is_primitive=True)
-LongType = Type("long", "LongType", is_primitive=True)
-FloatType = Type("float", "FloatType", is_primitive=True)
-DoubleType = Type("double", "DoubleType", is_primitive=True)
-DateType = Type("date", "DateType", is_primitive=True)
-TimeType = Type("time", "TimeType", is_primitive=True)
-TimestampType = Type("timestamp", "TimestampType", is_primitive=True)
-TimestamptzType = Type("timestamptz", "TimestamptzType", is_primitive=True)
-StringType = Type("string", "StringType", is_primitive=True)
-UUIDType = Type("uuid", "UUIDType", is_primitive=True)
-BinaryType = Type("binary", "BinaryType", is_primitive=True)
+class Boolean(Type):
+ """`boolean` from https://iceberg.apache.org/#spec/#primitive-types"""
+
+ def __init__(self):
+ super().__init__("boolean", "BooleanType", is_primitive=True)
+
+
+class Integer(Type):
+ """32-bit signed integers: `int` from
https://iceberg.apache.org/#spec/#primitive-types"""
+
+ max: int = 2147483647
+
+ min: int = -2147483648
+
+ def __init__(self):
+ super().__init__("int", "IntegerType", is_primitive=True)
+
+
+class Long(Type):
+ """64-bit signed integers: `long` from
https://iceberg.apache.org/#spec/#primitive-types"""
+
+ max: int = 9223372036854775807
+
+ min: int = -9223372036854775808
+
+ def __init__(self):
+ super().__init__("long", "LongType", is_primitive=True)
+
+
+class Float(Type):
+ """32-bit IEEE 754 floating point: `float` from
https://iceberg.apache.org/#spec/#primitive-types"""
+
+ def __init__(self):
+ super().__init__("float", "FloatType", is_primitive=True)
+
+
+class Double(Type):
+ """64-bit IEEE 754 floating point: `double` from
https://iceberg.apache.org/#spec/#primitive-types"""
+
+ def __init__(self):
+ super().__init__("double", "DoubleType", is_primitive=True)
+
+
+class Date(Type):
+ """`date` type from https://iceberg.apache.org/#spec/#primitive-types"""
+
+ def __init__(self):
+ super().__init__("date", "DateType", is_primitive=True)
+
+
+class Time(Type):
+ """`time` type from https://iceberg.apache.org/#spec/#primitive-types"""
+
+ def __init__(self):
+ super().__init__("time", "TimeType", is_primitive=True)
+
+
+class Timestamp(Type):
+ """`timestamp` type from
https://iceberg.apache.org/#spec/#primitive-types"""
+
+ def __init__(self):
+ super().__init__("timestamp", "TimestampType", is_primitive=True)
+
+
+class Timestamptz(Type):
+ """`timestamptz` type from
https://iceberg.apache.org/#spec/#primitive-types"""
Review comment:
```py
"""A Timestamptz data type in Iceberg can be represented using an
instance of this class. Timestamptzs in
Iceberg are stored as UTC and include a date and a time of day with a
timezone.
Example:
>>> column_foo = TimestamptzType()
>>> isinstance(column_foo, TimestamptzType)
True
"""
```
##########
File path: python/src/iceberg/types.py
##########
@@ -157,15 +157,107 @@ def value(self) -> NestedField:
return self._value_field
-BooleanType = Type("boolean", "BooleanType", is_primitive=True)
-IntegerType = Type("int", "IntegerType", is_primitive=True)
-LongType = Type("long", "LongType", is_primitive=True)
-FloatType = Type("float", "FloatType", is_primitive=True)
-DoubleType = Type("double", "DoubleType", is_primitive=True)
-DateType = Type("date", "DateType", is_primitive=True)
-TimeType = Type("time", "TimeType", is_primitive=True)
-TimestampType = Type("timestamp", "TimestampType", is_primitive=True)
-TimestamptzType = Type("timestamptz", "TimestamptzType", is_primitive=True)
-StringType = Type("string", "StringType", is_primitive=True)
-UUIDType = Type("uuid", "UUIDType", is_primitive=True)
-BinaryType = Type("binary", "BinaryType", is_primitive=True)
+class Boolean(Type):
+ """`boolean` from https://iceberg.apache.org/#spec/#primitive-types"""
+
+ def __init__(self):
+ super().__init__("boolean", "BooleanType", is_primitive=True)
+
+
+class Integer(Type):
+ """32-bit signed integers: `int` from
https://iceberg.apache.org/#spec/#primitive-types"""
+
+ max: int = 2147483647
+
+ min: int = -2147483648
+
+ def __init__(self):
+ super().__init__("int", "IntegerType", is_primitive=True)
+
+
+class Long(Type):
+ """64-bit signed integers: `long` from
https://iceberg.apache.org/#spec/#primitive-types"""
+
+ max: int = 9223372036854775807
+
+ min: int = -9223372036854775808
+
+ def __init__(self):
+ super().__init__("long", "LongType", is_primitive=True)
+
+
+class Float(Type):
+ """32-bit IEEE 754 floating point: `float` from
https://iceberg.apache.org/#spec/#primitive-types"""
+
+ def __init__(self):
+ super().__init__("float", "FloatType", is_primitive=True)
+
+
+class Double(Type):
+ """64-bit IEEE 754 floating point: `double` from
https://iceberg.apache.org/#spec/#primitive-types"""
+
+ def __init__(self):
+ super().__init__("double", "DoubleType", is_primitive=True)
+
+
+class Date(Type):
+ """`date` type from https://iceberg.apache.org/#spec/#primitive-types"""
+
+ def __init__(self):
+ super().__init__("date", "DateType", is_primitive=True)
+
+
+class Time(Type):
+ """`time` type from https://iceberg.apache.org/#spec/#primitive-types"""
+
+ def __init__(self):
+ super().__init__("time", "TimeType", is_primitive=True)
+
+
+class Timestamp(Type):
+ """`timestamp` type from
https://iceberg.apache.org/#spec/#primitive-types"""
+
+ def __init__(self):
+ super().__init__("timestamp", "TimestampType", is_primitive=True)
+
+
+class Timestamptz(Type):
+ """`timestamptz` type from
https://iceberg.apache.org/#spec/#primitive-types"""
+
+ def __init__(self):
+ super().__init__("timestamptz", "TimestamptzType", is_primitive=True)
+
+
+class String(Type):
+ """Arbitrary-length character sequences Encoded with UTF-8: `string` from
https://iceberg.apache.org/#spec/#primitive-types"""
Review comment:
```py
"""A String data type in Iceberg can be represented using an instance of
this class. Strings in
Iceberg are arbitrary-length character sequences and are encoded with
UTF-8.
Example:
>>> column_foo = StringType()
>>> isinstance(column_foo, StringType)
True
"""
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]