zhengruifeng commented on code in PR #38847:
URL: https://github.com/apache/spark/pull/38847#discussion_r1035558901
##########
python/pyspark/sql/connect/plan.py:
##########
@@ -492,40 +492,27 @@ class Sort(LogicalPlan):
def __init__(
self,
child: Optional["LogicalPlan"],
- columns: List[Union[Column, str]],
+ columns: List["ColumnOrName"],
is_global: bool,
) -> None:
super().__init__(child)
self.columns = columns
self.is_global = is_global
def col_to_sort_field(
- self, col: Union[Column, str], session: "SparkConnectClient"
+ self, col: "ColumnOrName", session: "SparkConnectClient"
) -> proto.Sort.SortField:
+ sort: Optional[SortOrder] = None
if isinstance(col, Column):
- sf = proto.Sort.SortField()
- sf.expression.CopyFrom(col.to_plan(session))
- sf.direction = (
- proto.Sort.SortDirection.SORT_DIRECTION_ASCENDING
- if col._expr.ascending
- else proto.Sort.SortDirection.SORT_DIRECTION_DESCENDING
- )
- sf.nulls = (
- proto.Sort.SortNulls.SORT_NULLS_FIRST
- if not col._expr.nullsLast
- else proto.Sort.SortNulls.SORT_NULLS_LAST
- )
- return sf
- else:
- sf = proto.Sort.SortField()
- # Check string
- if isinstance(col, Column):
- sf.expression.CopyFrom(col.to_plan(session))
Review Comment:
this path is not reachable
--
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]