Commit graph

174078 commits

Author SHA1 Message Date
Sergei Petrunia
b532be9f8c Merge ../10.2-window-funcs-r12 into 10.2 2016-04-12 00:00:53 +02:00
Sergei Petrunia
0f62eee2f8 Fix compiler warning 2016-04-11 23:59:51 +02:00
Vicențiu Ciorbaru
419c925069 Fix dense_rank returning minimum rank of 2 when using null columns.
The bug was caused by a weird behaviour in test_if_group_changed, not
returning true when testing for the first time after initializing
the Cached_item list.
2016-04-11 10:46:58 +02:00
Sergei Petrunia
c61bb13956 Use --sorted_result to make test result predictable 2016-04-11 10:44:43 +02:00
Sergei Petrunia
fbf0364c26 MDEV-9780: Window functions: interplay between window function and other constructs
Implement the "DISTINCT must not be converted into GROUP BY when window
functions are present" part.
2016-04-10 17:22:24 +02:00
Sergei Petrunia
da7c5e3b85 MDEV-9895: Assertion `n_rows > 0' failed in Frame_cursor* get_frame_cursor
n=0 in "ROWS 0 PRECEDING" is valid, add handling for it:
- Adjust the assert
- Bottom bound of 'ROW 0 PRECEDING' is actually looking at the current
  row, that is, it needs to process partition's first row directly in
  Frame_n_rows_preceding::next_partition().
- Added testcases
2016-04-10 16:24:04 +02:00
Sergei Petrunia
2905b2feb6 Window functions: return error if aggregate is not supported as window functions 2016-04-10 11:28:33 +02:00
Sergei Petrunia
29705a4d38 Window functions: handle window functions as arguments to other functions
Window functions need to have their own column in the work (temp) table,
like aggregate functions do.
They don't need val_int() -> val_int_result() conversion though, so they
should be wrapped with Item_direct_ref, not Item_aggregate_ref.
2016-04-10 10:13:55 +02:00
Sergei Petrunia
91fc90c372 Update to previous cset, which added ORDER BY into the wrong clause 2016-04-09 17:01:01 +02:00
Sergei Petrunia
e292ea8751 Make the testcase deterministic 2016-04-08 12:02:43 +02:00
Alexander Barkov
a4c81986aa Modifying ctype_gbk_export_import.test to help "meld" not to confuse/join
individual records when displaying diff.
2016-04-08 12:12:26 +04:00
Alexander Barkov
35f2eefe86 Better coverange in ctype_gbk_export_import.
Adding tests for the sequence 0xEE5C5C which should be treated
in GBK context as GBK double-byte character 0xEE5C (with 5C in the second byte)
followed by 0x5C (as a normal REVERSE SOLIDUS).
2016-04-08 11:04:34 +04:00
Alexander Barkov
c121649840 ctype_gbk_export_import: adding an utf8 column, for better coverage. 2016-04-08 07:45:18 +04:00
Sergei Petrunia
cb002d3479 Window functions: make "ORDER BY window_func" work
- When window functions are present, JOIN::simple_order should be set
  to FALSE. (Otherwise, the optimizer may attempt to do a "pre-sorting"
  on the first join_tab. Which can work in some cases, but generally
  isn't)

- filesort tries to only read table fields that it requires. Window
  function requires its temp.table field.  In order to pass this info
  to filesort, added an implementation of Item_window_func::
  register_field_in_read_map.
2016-04-08 03:21:25 +03:00
Alexander Barkov
8f74a7e524 Fixing a test failure in ctype_gbk_export_import.test 2016-04-08 00:39:26 +04:00
Michael Widenius
2189df3cdd Fixed compiler warnings 2016-04-07 20:09:57 +03:00
Michael Widenius
031e3442f8 Removed file-key-management from mysql_install_db as someone may have
deciced to use it even before bootstrap.
2016-04-07 19:58:28 +03:00
Alexander Barkov
9db357d4c5 Adding more option combinations into ctype_gbk_export_import. 2016-04-07 17:22:16 +04:00
Alexander Barkov
d383a1681d Adding a test for "mysqldump -Tdir dbname tabname" followed by
"LOAD DATA INFILE" with various command line and CHARACTER SET
clause options.
2016-04-07 17:09:53 +04:00
Alexander Barkov
52018344fe Adding a new test ctype_gbk_export_import covering
export with SELECT INTO OUTFILE followed by
import with LOAD DATA INFILE, with various command line
--default-character-set=xxx and "CHARACTER SET xxx" clause
combinations.
2016-04-07 16:21:29 +04:00
Sergei Petrunia
59e5f5b47e Merge branch '10.2' into bb-10.2-mdev9543
- Make Window Functions errors use the MariaDB's extra error range.
- Fix a trivial bug in check_error_mesg
2016-04-07 00:54:39 +03:00
Sergei Petrunia
306de8a927 MDEV-9877: Window functions: wrong sort criteria is used
" The sort order for the sub-sequence of window functions starting
from the element marked by SORTORDER_CHANGE_FLAG up to the next
element marked by SORTORDER_CHANGE_FLAG must be taken from the
last element of the sub-sequence (not from the first one)."
2016-04-06 23:02:31 +03:00
Sergei Petrunia
2efabf81f1 MDEV-9847: Window functions: crash with big_tables=1
- Move filesort's sort_positions argument into class Filesort.
- Make window function code construct Filesort with sort_positions=true.
2016-04-06 20:34:23 +03:00
Sergei Petrunia
0a34dc1e97 Code cleanup after merge of 260dd47 into 10.2-window-functions
length is now calculated in Filesort::make_sortorder.
2016-04-06 19:58:02 +03:00
Sergei Petrunia
5b85d0a75b Window functions: Better class names
As discussed on the call:
- s/Window_funcs_computation_step/Window_funcs_computation/g
- s/Window_func_sort/Window_funcs_sort/g
2016-04-06 18:24:11 +03:00
Sergei Petrunia
89b744eb6c Fix the buildbot: file-key-management is provided by a plugin, so should be loose. 2016-04-06 18:08:16 +03:00
Sergei Petrunia
da64cd6dd6 Fix a typo: use __attribute__(...) not __attribute(...) 2016-04-06 13:12:49 +03:00
Vicențiu Ciorbaru
7c9cfa07ad Fix ntile to work with --ps-protocol 2016-04-06 12:17:04 +03:00
Alexander Barkov
00917fae7e MDEV-9874 LOAD XML INFILE does not handle well broken multi-byte characters
- Moving the new my_charlen()-based code handling multi-byte characters
  from READ_INFO::field_field() to a new method READ_INFO::read_mbtail()
- Reusing read_mbtail() in READ_INFO::read_value(), instead of the old
  my_mbcharlen()-based code which did not catch broken byte sequences
2016-04-06 10:31:38 +04:00
Alexander Barkov
d516a2ae0c MDEV-9823 LOAD DATA INFILE silently truncates incomplete byte sequences 2016-04-06 09:13:49 +04:00
Vladislav Vaintroub
bddd63cfba fix compile error on Windows, intrduced by previous monty's push 2016-04-06 01:01:09 +02:00
Monty
c0eebb831e Fixed but when generating .sys files 2016-04-06 01:18:38 +03:00
Sergei Petrunia
9bd194b1b7 MDEV-9848: Window functions: reuse sorting and/or scanning
- Rename Window_funcs_computation to Window_funcs_computation_step
- Introduce Window_func_sort which invokes filesort and then
  invokes computation of all window functions that use this ordering.
- Expose Window functions' sort operations in EXPLAIN|ANALYZE FORMAT=JSON
2016-04-05 19:10:44 +03:00
Monty
cdd4043117 Cleanups:
- Removed some QQ markers
- Removed some rows not compatible with valgrind 3.9.0
- Made mysql_install_db.sh more silent by default. --verbose now gives more information
- Added assert that auto-increment doesn't generate 0 (safety)
- Removed thd->set_time() in some places as it's set in init_for_queries()
- Fixed some --big tests in tokudb
- Fixed a bug in mysql_client_test.cc where sql_mode was not properly reset
2016-04-05 18:00:04 +03:00
Monty
d0b178fb45 Added new range of MariaDB error messages, starting from 3000
This is done by splitting variables.errmsg and locale.errmsg to
variables.errmsg_extra and locale.errmsg_extra

The ER() macros in unireg.h now looks more complex than before, but this
isn't critical as most usage of them are with constants and the compiler
will remove most of the test code.
2016-04-05 18:00:03 +03:00
Alexander Barkov
38f39a9288 Updating conf_to_src.c according to the current CHARSET_INFO structure. 2016-04-05 09:35:27 +04:00
Igor Babaev
e30bd913ae Fixed a problem with setting wrong flags for ordering in the code
of compare_window_funcs_by_window_specs().
2016-04-04 15:24:27 -07:00
Vicențiu Ciorbaru
960b221c0b Convert ntile to work with expressions as parameters. 2016-04-04 22:04:18 +03:00
Vicențiu Ciorbaru
be3902fceb Implement ntile window function.
The current implementation does not allow for a dynamic expression
within the sum function's parameter.
2016-04-04 22:04:18 +03:00
Vicențiu Ciorbaru
a5d300814c Remove no longer used Window_context class. 2016-04-04 22:04:18 +03:00
Vicențiu Ciorbaru
629f9feabe Fix post review comments regarding the usage of List<>. 2016-04-04 22:04:18 +03:00
Alexander Barkov
4b6b3a96ad Clean-up: Adding a class Term_string to share some LOAD DATA code
The new class is used for:
- FIELDS TERMINATED BY 'string'
- LINES STARTING BY 'string'
- LINES TERMINATED BY 'string'

The implementation of "FIELDS ENCLOSED BY 'char'" and "FIELDS ESCAPED BY 'char'"
should eventually also switch to this class to support multi-byte characters.
Currently multi-byte ENCLOSED and ESCAPED characters are rejected at parse time.
2016-04-04 09:52:24 +04:00
Igor Babaev
162ea7c0cf Fix a problem in code for percent_rank().
The problem popped up when running win_percent_cume.test
with --ps-protocol.
2016-04-01 15:29:45 -07:00
Igor Babaev
0b89c61413 Fixed a problem with --ps-protocol.
Window names has to be resolved only once.
2016-04-01 14:05:51 -07:00
Alexander Barkov
e56650d7e3 Clean-up: Changing READ_INFO to use a String object instead of
buff, buff_length, end_of_buff. This unifies "LOAD DATA" and "LOAD XML", so
they now both use String for a temporary value storage.
This change will make further work for MDEV-6353 easier.
2016-04-02 00:30:40 +04:00
Alexander Barkov
e975cd0ba9 MDEV-9842 LOAD DATA INFILE does not work well with a TEXT column when using sjis 2016-04-02 00:18:58 +04:00
Igor Babaev
2e4bd4407e The implementation of the template bubble_sort assumed
that the call-back comparison function returns a positive
number when arg1 < arg2, and a negative number when arg1 > arg2.
This is not in line with other implementation of sorting
algorithm.
Changed bubble_sort: now a negative result from the comparison
function means that arg1 < arg2, and positive result means
that arg1 > arg2.
Changed accordingly all call-back functions that are used as
parameters in the call of bubble_sort.

Added a test case to check the proper sorting of window functions.
2016-04-01 12:00:54 -07:00
Alexander Barkov
3fc6a8b832 MDEV-9811 LOAD DATA INFILE does not work well with gbk in some cases
MDEV-9824 LOAD DATA does not work with multi-byte strings in LINES TERMINATED BY when IGNORE is specified
2016-03-31 14:22:25 +04:00
Alexander Barkov
1d73005bf3 MDEV-8360 Clean-up CHARSET_INFO: strnncollsp: diff_if_only_endspace_difference
- Removing the "diff_if_only_endspace_difference" argument from
  MY_COLLATION_HANDLER::strnncollsp(), my_strnncollsp_simple(),
  as well as in the function template MY_FUNCTION_NAME(strnncollsp)
  in strcoll.ic

- Removing the "diff_if_only_space_different" from ha_compare_text(),
  hp_rec_key_cmp().

- Adding a new function my_strnncollsp_padspace_bin() and reusing
  it instead of duplicate code pieces in my_strnncollsp_8bit_bin(),
  my_strnncollsp_latin1_de(), my_strnncollsp_tis620(),
  my_strnncollsp_utf8_cs().

- Adding more tests for better coverage of the trailing space handling.

- Removing the unused definition of HA_END_SPACE_ARE_EQUAL
2016-03-31 11:04:48 +04:00
Sergey Vojtovich
282497dd6d MDEV-6720 - enable connection log in mysqltest by default 2016-03-31 10:11:16 +04:00