summaryrefslogtreecommitdiff
path: root/sql/item_windowfunc.h
diff options
context:
space:
mode:
authorVarun Gupta <varunraiko1803@gmail.com>2017-06-26 03:53:27 +0530
committerVarun Gupta <varunraiko1803@gmail.com>2017-11-01 23:13:01 +0530
commit31f1541f1e367f6eb91f948c4e814bb6554e6b78 (patch)
treed0b53656c6403e36e3f7e0e74e8e3a4cca9dc0ee /sql/item_windowfunc.h
parentcc046fa92c8724801c3bd725b62a21b849e738f6 (diff)
downloadmariadb-git-31f1541f1e367f6eb91f948c4e814bb6554e6b78.tar.gz
Setting handler to have the return type as that of the element by which we are ordering the partition
Diffstat (limited to 'sql/item_windowfunc.h')
-rw-r--r--sql/item_windowfunc.h12
1 files changed, 8 insertions, 4 deletions
diff --git a/sql/item_windowfunc.h b/sql/item_windowfunc.h
index 6595012fabf..9087404ea3e 100644
--- a/sql/item_windowfunc.h
+++ b/sql/item_windowfunc.h
@@ -701,11 +701,13 @@ class Item_sum_ntile : public Item_sum_window_with_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:
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()
{
@@ -715,7 +717,7 @@ public:
return 0;
}
null_value= false;
- return ((Cached_item_int*) value)->get_value();
+ return ((Cached_item_real*) value)->get_value();
}
longlong val_int()
@@ -769,7 +771,9 @@ public:
}
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()
{