CircArgs opened a new pull request #3981:
URL: https://github.com/apache/iceberg/pull/3981


   This PR is in contrast to https://github.com/apache/iceberg/pull/3952 which 
saw an attempt to use optional arguments to get a semblance of combined 
type/literal functionality. This one steps back to offer true generics e.g. 
`FixedType[8]` as opposed to `FixedType(length=8)` with all the intuitive 
functionality that comes from using true types and not class instances.
   
   Examples:
   
   ```python
   IntegerType==IntegerType
   DecimalType[32, 3]==DecimalType[32, 3]
   StructType[
           NestedField[Decimal[32, 3], 0, "c1", True],
           NestedField[Float, 1, "c2", False],
       ] ==
   StructType[
           NestedField[Decimal[32, 3], 0, "c1", True],
           NestedField[Float, 1, "c2", False],
       ]
   ```
   
   ```python
   >>> issubclass(NestedField[Decimal[32, 3], 0, "c1", True], NestedField)
   True
   ```
   
   It provides the functionality to create further types possibly necessary in 
the future such as the transforms. For example, 
   
   ```python
   >>> BucketTransform = generic_class(
       "BucketTransform",
      {
               "type": Union[
                   DateType,
                   TimeType,
                   TimestampType,
                   TimestamptzType,
                   StringType,
                   BinaryType,
                   UUIDType,
                   NumberType,
                   FixedType,
               ],
           "num_buckets", int})
   
   >>>BucketTransform[IntegerType, 10]
   BucketTransform[type=IntegerType, num_buckets=10]
   ```
   


-- 
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]

Reply via email to