diff --git a/sql/item_func.cc b/sql/item_func.cc index cfb1106..b088f2a 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -3371,6 +3371,26 @@ my_decimal *Item_func_floor::decimal_op(my_decimal *decimal_value) { return nullptr; } +enum_monotonicity_info Item_func_floor::get_monotonicity_info() const { + if (args[0]->type() == Item::FIELD_ITEM && + (args[0]->data_type() == MYSQL_TYPE_DECIMAL || + args[0]->data_type() == MYSQL_TYPE_TINY || + args[0]->data_type() == MYSQL_TYPE_SHORT || + args[0]->data_type() == MYSQL_TYPE_INT24 || + args[0]->data_type() == MYSQL_TYPE_LONG || + args[0]->data_type() == MYSQL_TYPE_FLOAT || + args[0]->data_type() == MYSQL_TYPE_DOUBLE || + args[0]->data_type() == MYSQL_TYPE_LONGLONG)) + return MONOTONIC_INCREASING; + + return args[0]->get_monotonicity_info(); +} + +longlong Item_func_floor::val_int_endpoint(bool, bool *) { + assert(fixed == 1); + return int_op(); +} + bool Item_func_round::resolve_type(THD *thd) { if (param_type_is_default(thd, 0, 1, MYSQL_TYPE_NEWDECIMAL)) return true; if (param_type_is_default(thd, 1, 2, MYSQL_TYPE_LONGLONG)) return true; diff --git a/sql/item_func.h b/sql/item_func.h index e89ca49..190543a 100644 --- a/sql/item_func.h +++ b/sql/item_func.h @@ -1387,6 +1387,8 @@ class Item_func_floor final : public Item_func_int_val { longlong int_op() override; double real_op() override; my_decimal *decimal_op(my_decimal *) override; + enum_monotonicity_info get_monotonicity_info() const override; + longlong val_int_endpoint(bool left_endp, bool *incl_endp) override; bool check_partition_func_processor(uchar *) override { return false; } bool check_function_as_value_generator(uchar *) override { return false; } enum Functype functype() const override { return FLOOR_FUNC; }