@@ -24,7 +24,6 @@ use common_functions::scalars::FunctionContext;
24
24
use common_functions:: scalars:: FunctionFactory ;
25
25
use common_functions:: scalars:: Monotonicity ;
26
26
27
- use crate :: col;
28
27
use crate :: Expression ;
29
28
use crate :: ExpressionVisitor ;
30
29
use crate :: Recursion ;
@@ -176,45 +175,6 @@ impl ExpressionMonotonicityVisitor {
176
175
v. finalize ( ) . unwrap_or_else ( |_| Monotonicity :: default ( ) )
177
176
} )
178
177
}
179
-
180
- /// Extract sort column from sort expression. It checks the monotonicity information
181
- /// of the sort expression (like f(x) = x+2 is a monotonic function), and extract the
182
- /// column information, returns as Expression::Column.
183
- pub fn extract_sort_column (
184
- schema : DataSchemaRef ,
185
- sort_expr : & Expression ,
186
- left : Option < ColumnWithField > ,
187
- right : Option < ColumnWithField > ,
188
- column_name : & str ,
189
- ) -> Result < Expression > {
190
- if let Expression :: Sort {
191
- asc,
192
- nulls_first,
193
- origin_expr,
194
- ..
195
- } = sort_expr
196
- {
197
- let mut variables = HashMap :: new ( ) ;
198
- variables. insert ( column_name. to_owned ( ) , ( left, right) ) ;
199
- let mono = Self :: check_expression ( schema, origin_expr, variables, false ) ;
200
- if !mono. is_monotonic {
201
- return Ok ( sort_expr. clone ( ) ) ;
202
- }
203
-
204
- // need to flip the asc when is_positive is false
205
- let new_asc = if mono. is_positive { * asc } else { !* asc } ;
206
- return Ok ( Expression :: Sort {
207
- expr : Box :: new ( col ( column_name) ) ,
208
- asc : new_asc,
209
- nulls_first : * nulls_first,
210
- origin_expr : origin_expr. clone ( ) ,
211
- } ) ;
212
- }
213
- Err ( ErrorCode :: BadArguments ( format ! (
214
- "expect sort expression, get {:?}" ,
215
- sort_expr
216
- ) ) )
217
- }
218
178
}
219
179
220
180
impl ExpressionVisitor for ExpressionMonotonicityVisitor {
0 commit comments