Commit graph

117 commits

Author SHA1 Message Date
Vicențiu Ciorbaru
aa74fef25e Fix 2 more bugs in item_windowfunc.
1. Item_windowfunc must check the nullness of the field if it returns the
   value from the result_field.
2. The decimal value must come from the window_func instead of the
   result_field when not fetching values from the result_field.

Added a more extensive test case that highlights if these bugs occur.
The 2 select statements check behaviour for decimal and real typed
fields respectively.
2016-03-16 01:42:45 +02:00
Vicențiu Ciorbaru
333ac13be5 Make sure to return the result value when calling Item_windowfunc::val_real()
This caused Item_windowfunc to return garbage.
2016-03-16 01:09:53 +02:00
Sergei Petrunia
833304313d Continuation of "Implemented a counter within Item_sum_sum" a few commits before
Query result had 0 where it should have had NULLs:
- Make Item_window_func::val* functions honor NULL-handling conventions:
  1. set null_value to indicate whether we've returned a NULL value
  2. val_str and val_decimal should return NULL pointer when they're
     returning SQL NULL value.

Fix assertion failure when sending results to network.
- The assert was due to window func returing SQL NULL despite having
  maybe_null=false
- Fixed by settting Item_window_func::maybe_null correctly in fix_fields
2016-03-16 01:26:39 +03:00
Vicențiu Ciorbaru
b579a626cf Implement percent_rank window function 2016-03-03 18:48:34 +02:00
Vicențiu Ciorbaru
f638ffef2c Convert if statements to switch case. 2016-03-03 18:48:34 +02:00
Sergei Petrunia
1cc6fd1f00 Remove comments that may be confusing 2016-03-02 14:01:43 +03:00
Sergei Petrunia
d290a66553 MDEV-9634: Window function produces incorrect value
- Item_sum_count::remove() should check if the argument's value is NULL.
- Window Function item must have its Item_window_func::split_sum_func
  called,
- and it must call split_sum_func for aggregate's arguments (see the
  comment near Item_window_func::split_sum_func for explanation why)
2016-02-26 02:08:45 +03:00
Igor Babaev
0c6d753708 Fixed a problems in the parser.
Resolved window names.
Checked some constraints for window frames.
Added test cases for window name resolution.
2016-02-19 23:20:09 -08:00
Sergei Petrunia
be15858245 MDEV-9526: Compute Aggregate functions as window functions
- Add temporary code: clone_read_record() clones READ_RECORD structure,
  as long as it is used for reading filesort() result that fits into
  memory.
- Add frame bounds for ROWS-type frames. ROWS n PRECEDING|FOLLOWING,
  ROWS UNBOUNDED PRECEDING|FOLLOWING, CURRENT ROW are supported.
- Add Item_sum_count::remove() which allows "streaming" computation
  of COUNT() over a moving frame.
2016-02-18 01:25:26 +03:00
Vicențiu Ciorbaru
0c223a96c1 Fix review comments. 2016-02-16 00:43:57 +02:00
Vicențiu Ciorbaru
9a673e0a88 Implement DENSE_RANK function. 2016-02-16 00:22:12 +02:00
Sergei Petrunia
d8a20d4db7 Post-merge fixes. win.test passes but further cleanup is needed. 2016-02-14 21:00:05 +03:00
Sergei Petrunia
64ab10ffff Initial implementation of RANK() window function 2016-02-14 11:30:36 +03:00
Sergei Petrunia
30c9450af7 More comments 2016-02-14 11:30:14 +03:00
Sergei Petrunia
346c1a0ad0 Got sort-and-read single-pass window function computation to work 2016-02-14 11:29:53 +03:00
Sergei Petrunia
6399187ebc Added comments 2016-02-14 11:14:34 +03:00
Igor Babaev
9d9c60fb12 Initial patch for the implementation of window functions (MDEV-6115):
- All parsing problems look like resolved
- Stub performing name resolution of window functions
in simplest queries has been added.
2016-02-12 20:33:56 -08:00