Skip to content

Commit 288c0a9

Browse files
committed
Cleanup expression
Signed-off-by: Xuanwo <github@xuanwo.io>
1 parent 593cf50 commit 288c0a9

File tree

2 files changed

+0
-44
lines changed

2 files changed

+0
-44
lines changed

src/query/legacy-planners/src/plan_expression.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -209,10 +209,6 @@ impl Expression {
209209
.map(|return_type| DataField::new(&name, return_type))
210210
}
211211

212-
pub fn nullable(&self, input_schema: &DataSchemaRef) -> Result<bool> {
213-
Ok(self.to_data_type(input_schema)?.is_nullable())
214-
}
215-
216212
pub fn to_data_type(&self, input_schema: &DataSchemaRef) -> Result<DataTypeImpl> {
217213
let visitor = ExpressionDataTypeVisitor::create(input_schema.clone());
218214
visitor.visit(self)?.finalize()

src/query/legacy-planners/src/plan_expression_monotonicity.rs

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ use common_functions::scalars::FunctionContext;
2424
use common_functions::scalars::FunctionFactory;
2525
use common_functions::scalars::Monotonicity;
2626

27-
use crate::col;
2827
use crate::Expression;
2928
use crate::ExpressionVisitor;
3029
use crate::Recursion;
@@ -176,45 +175,6 @@ impl ExpressionMonotonicityVisitor {
176175
v.finalize().unwrap_or_else(|_| Monotonicity::default())
177176
})
178177
}
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-
}
218178
}
219179

220180
impl ExpressionVisitor for ExpressionMonotonicityVisitor {

0 commit comments

Comments
 (0)