File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed
Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -2183,6 +2183,13 @@ def sort(
21832183 """
21842184
21852185 is_order_by_all = not cols
2186+
2187+ # This code performs additional type checks, run first.
2188+ exprs = self ._convert_cols_to_exprs ("sort()" , * cols )
2189+ if not is_order_by_all :
2190+ if not exprs :
2191+ raise ValueError ("sort() needs at least one sort expression." )
2192+
21862193 if (
21872194 is_order_by_all
21882195 and ascending is not None
@@ -2230,10 +2237,6 @@ def sort(
22302237 order = Ascending () if bool (asc_value ) else Descending ()
22312238 sort_exprs = [SortByAllOrder (order )]
22322239 else :
2233- exprs = self ._convert_cols_to_exprs ("sort()" , * cols )
2234- if not exprs :
2235- raise ValueError ("sort() needs at least one sort expression." )
2236-
22372240 orders = []
22382241 if ascending is not None :
22392242 if isinstance (ascending , (list , tuple )):
You can’t perform that action at this time.
0 commit comments