rdblue commented on code in PR #5490:
URL: https://github.com/apache/iceberg/pull/5490#discussion_r942664982


##########
python/pyiceberg/table/sorting.py:
##########
@@ -36,11 +36,17 @@ class SortDirection(Enum):
     ASC = "asc"
     DESC = "desc"
 
+    def __str__(self):
+        return str(self.name)
+
 
 class NullOrder(Enum):
     NULLS_FIRST = "nulls-first"
     NULLS_LAST = "nulls-last"
 
+    def __str__(self):
+        return str(self.name)

Review Comment:
   Do we want this to be the SQL sort order? If so, we probably want to remove 
the `_` or `-` in the name or value. Otherwise we'll get output like `day(ts) 
DESC NULLS_LAST`.



##########
python/pyiceberg/table/sorting.py:
##########
@@ -83,6 +89,9 @@ def set_null_order(cls, values: Dict[str, Any]) -> Dict[str, 
Any]:
     direction: SortDirection = Field()
     null_order: NullOrder = Field(alias="null-order")
 
+    def __str__(self):
+        return f"{self.transform}({self.source_id}) {self.direction} 
{self.null_order}"

Review Comment:
   Also, if `transform` is the identity transform, it should be omitted. Rather 
than `identity(category) ASC NULLS_FIRST` it should be `category ASC 
NULLS_FIRST`.



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