Commit graph

175155 commits

Author SHA1 Message Date
Daniel Bartholomew
098f0aedac bump the VERSION 2016-09-27 09:51:32 -04:00
Igor Babaev
b91bd822fa Fixed bug mdev-10889
The bug was in the code of the recursive method
With_element::check_unrestricted_recursive. For recursive
calls of this method sel->get_with_element()->owner != owner.
2016-09-26 10:40:44 -07:00
Igor Babaev
1f1990a161 Fixed bug mdev-10884.
If a materialized derived table / view is specified by a unit
with SELECTs containing ORDER BY ... LIMIT then condition pushdown
cannot be done for these SELECTs.
If a materialized derived table / view is specified by a unit
containing global ORDER BY ... LIMIT then condition pushdown
cannot be done for this unit.
2016-09-25 17:29:10 -07:00
Elena Stepanova
09cbb772eb Follow-up for MDEV-10174 - fix the result file for the embedded test 2016-09-26 02:39:25 +03:00
Igor Babaev
20d7f933e2 Adjusted test results. 2016-09-25 00:21:14 -07:00
Igor Babaev
54efb08022 Fixed bug mdev-10881
The server missed to call check_dependencies_in_with_clauses()
when processing PREPARE ... FROM CREATE ... SELECT / INSERT ... SELECT
with WITH clause before SELECT.
2016-09-24 21:05:36 -07:00
Igor Babaev
61ab7333db Fixed bug mdev-10883.
When a prepared statement uses a CTE definition with a column list
renaming of columns of the CTE expression  must be performed
for every execution of the prepared statement.
2016-09-24 21:05:36 -07:00
Vladislav Vaintroub
018ac121cf use latest Connector/C commit
Fixes file descriptor leak after unsuccessful attempt to open
unix socket connection.
2016-09-24 20:44:15 +00:00
Sergei Petrunia
c1b2828fe0 MDEV-10174: Make the fix for MDEV-8989 enabled by default in 10.2
(Continued after a95e38) Update more test results.
2016-09-24 20:20:33 +03:00
Vicențiu Ciorbaru
de2175e96a Window functions can have an empty over clause
Make sure we select one window function if we have an empty over clause.
2016-09-24 15:25:00 +02:00
Vicențiu Ciorbaru
45faae60b7 Typo fix 2016-09-24 15:18:37 +02:00
Vicențiu Ciorbaru
1c858dd9e0 Make win_big test specify only if Sort_merge_passes have happened
The number is irrelevant and may differ by architecture. We are only
interested if it happened or not
2016-09-24 15:12:34 +02:00
Vicențiu Ciorbaru
8b95e7eb44 Make sure to call Rowid_seq_cursor::next to not face infinite recursion 2016-09-24 15:12:34 +02:00
Sergei Petrunia
047963922c MDEV-9736: Window functions: multiple cursors to read filesort result
Add support for having multiple IO_CACHEs with type=READ_CACHE to share
the file they are reading from.
Each IO_CACHE keeps its own in-memory buffer. When doing a read or seek
operation on the file, it notifies other IO_CACHEs that the file position
has been changed.

Make Rowid_seq_cursor use cloned IO_CACHE when reading filesort result.
2016-09-24 15:12:34 +02:00
Vicențiu Ciorbaru
6e4015727a Clean up nth_value
Implement nth_value correctly and add a test case for it.
2016-09-24 15:12:34 +02:00
Vicențiu Ciorbaru
53cf265b3b Implement LEAD and LAG and NTH_VALUE functions
Refactour out (into a copy for now) the logic of Item_sum_hybrid, to
allow for multiple arguments. It does not contain the comparator
members. The result is the class Item_sum_hybrid_simple.

LEAD and LAG make use of this Item to store previous rows in a chache.
It also helps in specifying the field type. Currently LEAD/LAG do not
support default values.

NTH_VALUE behaves identical to LEAD and LAG, except that the starting
position cursor is placed on the top of the frame instead of the current
row.
2016-09-24 15:12:34 +02:00
Vicențiu Ciorbaru
29b227c335 Cleanup win testcase to always be deterministic
Also remove some whitespace
2016-09-24 15:12:34 +02:00
Vicențiu Ciorbaru
09a8c795fb Fix win_std nondeterministic results 2016-09-24 15:12:34 +02:00
Vicențiu Ciorbaru
3dd3a5da0e MDEV-9935: Window functions: assertion failure with empty OVER () clause
Make window functions work with an empty over clause by forcing
a sort on the first column of the current join_tab. This is a temporary
fix until we get window functions to work with big tables.
2016-09-24 15:12:34 +02:00
Vicențiu Ciorbaru
e992464f27 Update Frame_positional_cursor to also take an optional bound
The positional cursor now fetches rows based on the positional
cursor and an offset (if present). It will fetch rows, based on the
offset, only if the required position is not out of bounds.
2016-09-24 15:12:34 +02:00
Vicențiu Ciorbaru
88a8abbc1b Add test results for win_first_last_value 2016-09-24 15:12:34 +02:00
Vicențiu Ciorbaru
872c0b4225 Allow first/last value functions to have frame definitions
Add a test case to check this behavior.
2016-09-24 15:12:34 +02:00
Vicențiu Ciorbaru
74fa10645e Update features result to account for window functions counter 2016-09-24 15:12:34 +02:00
Vicențiu Ciorbaru
a2bafbabe2 Make first_value and last_value computation efficient
With clever use of partition bounds, we only need to add one row to the
items at a time. This way we remove the need to "reset" the item and run
through the full partition again.
2016-09-24 15:12:34 +02:00
Vicențiu Ciorbaru
15b8a772cc Add results for first_value and last_value test case 2016-09-24 15:12:34 +02:00
Vicențiu Ciorbaru
9a5930bcdf Implement first_value and last_value as window functions
Currently the implementation doesn't support removal, thus the
computation is performed by running over the window frame again.
2016-09-24 15:12:34 +02:00
Vicențiu Ciorbaru
e413c6e9e7 Add test case for STD function used as window function
The test case also checks correct functionality of Frame_scan_cursor, as
currently STD does not implement the remove() call.
2016-09-24 15:12:34 +02:00
Vicențiu Ciorbaru
00bf18e2bf Move table record writing outside of loop
We can set values in the record buffer first and only perform one table
write call at the end. No need to write to file every time one column is
updated.

Also, remove unused method from Table_read_cursor.
2016-09-24 15:12:34 +02:00
Vicențiu Ciorbaru
2e7a585ddd Add test case for new window functions status var 2016-09-24 15:12:34 +02:00
Vicențiu Ciorbaru
62df3119a5 Add a counter for the number of select statements using window functions
The counter is available via SHOW [GLOBAL] STATUS and will be reported
by the feedback plugin.
2016-09-24 15:12:34 +02:00
Vicențiu Ciorbaru
5cb568786a MDEV-10669: Crash in SELECT with window function used
Make sure to call split_sum_func on all items that contain window
functions, so that all the column references are set up correctly.
2016-09-24 15:12:34 +02:00
Vicențiu Ciorbaru
2857ff3c98 MDEV-10815: Window Function Expressions Wrong Results
Fix window function expressions such as win_func() <operator> expr.
The problem was found in 2 places.
First, when we have complex expressions containing window functions, we
can only compute their final value _after_ we have computed the window
function's values. These values must be stored within the temporary
table that we are using, before sending them off.
This is done by performing an extra copy_funcs call before the final
end_send() call.

Second, such expressions need to have their inner arguments,
changed such that the references within those arguments point to fields within
the temporary table.
Ex: sum(t.a) over (order by t.b) + sum(t.a) over (order by t.b)
Before this fix, t.a pointed to the original table's a field. In order
to compute the sum function's value correctly, it needs to point to the
copy of this field inside the temp table.
This is done by calling split_sum_func for each argument in the
expression in turn.

The win.test results have also been updated as they contained wrong
values for such a use case.
2016-09-24 15:12:34 +02:00
Vicențiu Ciorbaru
1c72441364 Frame bounds using FOLLOWING or PRECEDING can have 0 as cardinal value
This makes them behave exactly like CURRENT ROW. Standard specifies
unsigned integer, which includes the value 0.

Expand the win_min_max test to include this kind of frame definitions.
2016-09-24 15:09:39 +02:00
Vicențiu Ciorbaru
954e46531d Fix compilation failure of TokuDB on BSD-like systems
mincore is defined differently in BSD mincore(void *, size_t, char *) vs
linux variant of: mincore(void *, size_t, unsigned char *).
Account for this difference in TokuDB.
2016-09-24 15:09:39 +02:00
Sergei Petrunia
a95e384d54 MDEV-10174: Make the fix for MDEV-8989 enabled by default in 10.2
- Change the default @@optimizer_switch value
- Adjust the testcases
2016-09-24 15:27:56 +03:00
Igor Babaev
457f3b9941 Added the test case for bug mdev-9941 that was fixed some time ago. 2016-09-23 14:42:12 -07:00
Igor Babaev
4872ec6177 Fixed bug mdev-10874.
In some cases the method Window_funcs_sort::setup() did
not build the sequence of sorting keys correctly.
2016-09-23 14:23:17 -07:00
Sergei Golubchik
78f58792ac more adequate rpm settings
new MariaDB-shared no longer provides or replaces mysql-libs or mariadb-libs
2016-09-23 22:34:03 +02:00
Sergei Golubchik
deafe7a7aa RPM fixes for CentOS7 and Fedora 2016-09-23 16:04:16 +02:00
Alexander Barkov
0f8a1a314d MDEV-10877 xxx_unicode_nopad_ci collations 2016-09-23 14:19:07 +04:00
Vladislav Vaintroub
6304c0bfc7 Windows : completion port based asynchronous IO. 2016-09-22 17:27:36 +00:00
Vladislav Vaintroub
c46304f751 Fix valgrind error.
Do not accessing trx->mysql_log_file_name
after transaction end.
2016-09-22 17:21:21 +00:00
Vladislav Vaintroub
630035beaf Fix buildbot errors on Windows
Do not use CloseHandle() on thread id. It is not a kernel handle.
2016-09-22 17:13:05 +00:00
Vladislav Vaintroub
f7a7c0c2fe MDEV-10297 Add priorization to threadpool
Also MDEV-10385 Threadpool refactoring
2016-09-22 17:01:28 +00:00
Sergei Golubchik
f32a511558 Merge branch '10.2' into bb-10.2-connector-c-integ-subm 2016-09-22 17:50:37 +02:00
Igor Babaev
272637887c Merge branch 'bb-10.2-mdev9864' into 10.2 2016-09-22 07:59:13 -07:00
Sergei Golubchik
f7640e1194 use the latest C/C commit 2016-09-22 13:32:00 +02:00
Sergei Golubchik
d2cfae67dc copy-paste error fixed 2016-09-22 13:07:38 +02:00
Sergei Golubchik
b309faff77 buildbot failures
* update net_field_length() to match the prototype
* various bug fixes in C/C
2016-09-22 12:17:15 +02:00
Sergei Golubchik
c82c375eea compilation failure on power8
fix a bad merge
2016-09-22 12:04:13 +02:00