mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
Setting handler to have the return type as that of the element by which we are ordering the partition
This commit is contained in:
@ -5386,7 +5386,7 @@ public:
|
|||||||
Cached_item_decimal(Item *item_par);
|
Cached_item_decimal(Item *item_par);
|
||||||
bool cmp(void);
|
bool cmp(void);
|
||||||
int cmp_read_only();
|
int cmp_read_only();
|
||||||
my_decimal get_value(){ return value;};
|
my_decimal *get_value(){ return &value;};
|
||||||
void clear()
|
void clear()
|
||||||
{
|
{
|
||||||
null_value= false;
|
null_value= false;
|
||||||
|
@ -210,6 +210,11 @@ void Item_sum_percentile_disc::setup_window_func(THD *thd, Window_spec *window_s
|
|||||||
setup_percentile_func(thd, window_spec->order_list);
|
setup_percentile_func(thd, window_spec->order_list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Item_sum_percentile_disc::set_type_handler(Window_spec *window_spec)
|
||||||
|
{
|
||||||
|
type_handler()->get_handler_by_cmp_type(window_spec->order_list->first->item[0]->result_type());
|
||||||
|
}
|
||||||
|
|
||||||
bool Item_sum_dense_rank::add()
|
bool Item_sum_dense_rank::add()
|
||||||
{
|
{
|
||||||
if (peer_tracker->check_if_next_group() || first_add)
|
if (peer_tracker->check_if_next_group() || first_add)
|
||||||
|
@ -701,11 +701,13 @@ class Item_sum_ntile : public Item_sum_window_with_row_count
|
|||||||
ulong current_row_count_;
|
ulong current_row_count_;
|
||||||
};
|
};
|
||||||
|
|
||||||
class Item_sum_percentile_disc : public Item_sum_cume_dist
|
class Item_sum_percentile_disc : public Item_sum_cume_dist,
|
||||||
|
public Type_handler_hybrid_field_type
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Item_sum_percentile_disc(THD *thd, Item* arg) : Item_sum_cume_dist(thd, arg),
|
Item_sum_percentile_disc(THD *thd, Item* arg) : Item_sum_cume_dist(thd, arg),
|
||||||
value(NULL), val_calculated(FALSE) {}
|
Type_handler_hybrid_field_type(&type_handler_longlong),
|
||||||
|
value(NULL), val_calculated(FALSE) {}
|
||||||
|
|
||||||
double val_real()
|
double val_real()
|
||||||
{
|
{
|
||||||
@ -715,7 +717,7 @@ public:
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
null_value= false;
|
null_value= false;
|
||||||
return ((Cached_item_int*) value)->get_value();
|
return ((Cached_item_real*) value)->get_value();
|
||||||
}
|
}
|
||||||
|
|
||||||
longlong val_int()
|
longlong val_int()
|
||||||
@ -769,7 +771,9 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void update_field() {}
|
void update_field() {}
|
||||||
const Type_handler *type_handler() const { return &type_handler_double; }
|
void set_type_handler(Window_spec *window_spec);
|
||||||
|
const Type_handler *type_handler() const
|
||||||
|
{return Type_handler_hybrid_field_type::type_handler();}
|
||||||
|
|
||||||
void fix_length_and_dec()
|
void fix_length_and_dec()
|
||||||
{
|
{
|
||||||
|
@ -319,6 +319,10 @@ setup_windows(THD *thd, Ref_ptr_array ref_pointer_array, TABLE_LIST *tables,
|
|||||||
while ((win_func_item= li++))
|
while ((win_func_item= li++))
|
||||||
{
|
{
|
||||||
win_func_item->update_used_tables();
|
win_func_item->update_used_tables();
|
||||||
|
if (win_func_item->only_single_element_order_list())
|
||||||
|
{
|
||||||
|
((Item_sum_percentile_disc*)win_func_item)->set_type_handler(win_func_item->window_spec);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DBUG_RETURN(0);
|
DBUG_RETURN(0);
|
||||||
|
Reference in New Issue
Block a user