File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed
datafusion/physical-expr-common/src Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -181,6 +181,26 @@ impl PhysicalSortExpr {
181181 . map_or ( true , |opts| self . options . descending == opts. descending )
182182 }
183183 }
184+
185+ /// Returns a [`Display`]able list of `PhysicalSortExpr`.
186+ pub fn format_list ( input : & [ PhysicalSortExpr ] ) -> impl Display + ' _ {
187+ struct DisplayableList < ' a > ( & ' a [ PhysicalSortExpr ] ) ;
188+ impl < ' a > Display for DisplayableList < ' a > {
189+ fn fmt ( & self , f : & mut Formatter ) -> fmt:: Result {
190+ let mut first = true ;
191+ for sort_expr in self . 0 {
192+ if first {
193+ first = false ;
194+ } else {
195+ write ! ( f, "," ) ?;
196+ }
197+ write ! ( f, "{}" , sort_expr) ?;
198+ }
199+ Ok ( ( ) )
200+ }
201+ }
202+ DisplayableList ( input)
203+ }
184204}
185205
186206/// Represents sort requirement associated with a plan
You can’t perform that action at this time.
0 commit comments