Commit graph

45498 commits

Author SHA1 Message Date
Daniel Black
aed1485b99 MDEV-9758: correct test case 2016-04-29 18:41:00 +02:00
Daniel Black
51a66299f3 CHECKSUM TABLE to calculate in multiple column chunks
Checksum implementations contain optimizations for calculating
checksums of larger blocks of memory.

This optimization calls my_checksum on a larger block of memory
rather than calling on multiple adjacent memory as its going though
the table columns for each table row.
2016-04-29 18:41:00 +02:00
Vladislav Vaintroub
8b94aec11a Fix connect2 test, simulated errors do not work with thread cache 2016-04-28 22:25:11 +02:00
Monty
9c846373f0 Merge commit 'd5822a3ad0657040114cdc185c6387b9eb3a12b2' into 10.2 2016-04-28 16:59:33 +03:00
Monty
48f02af761 MDEV-9602 crash in st_key::actual_rec_per_key when group by constant
Problem was that cost_group_min_max() could not handle if group by was optimized away.
2016-04-28 13:39:55 +03:00
Alexey Botchkov
47e0717806 MDEV-9792 Backport MDEV-8713 to 10.1. 2016-04-27 11:08:46 +04:00
Igor Babaev
3b6a64c247 Fixed bug mdev-9937.
When the specification of a WITH table referred to a view
that used a based table with the same name as the WITH table
the server went into an infinite loop because it erroneously
resolved the reference to the base table as the reference to
the WITH table.

With tables used in a view cannot be searched for beyond the
scope the view.
2016-04-20 10:55:53 -07:00
Sergei Petrunia
4b8e54bb98 MDEV-7885, MDEV-8857: Add testcases
The issues themselves were fixed as part of MDEV-8646
2016-04-17 13:25:05 -07:00
Sergei Petrunia
957809b190 MDEV-9922: Assertion `!join->only_const_tables() && fsort' failed
When join output is just one row, we still need to compute window
function values for it. We could skip invoking filesort for it,
but it doesn't seem to be worth it to do such optimization.
2016-04-16 20:41:06 +03:00
Sergei Petrunia
a81e711a06 MDEV-9925: Wrong result with aggregate function as a window function
Make Frame_range_current_row_bottom to take into account partition bounds.

Other partition bounds that could potentially hit the end of partition are
Frame_range_n_bottom, Frame_n_rows_following, Frame_unbounded_following,
and they all had end-of-partition protection.

To simplify the code, factored out end-of-partition checks into
class Partition_read_cursor.
2016-04-15 20:40:01 +03:00
Sergei Petrunia
d29e1472fb Make test result deterministic. 2016-04-15 17:48:40 +03:00
Igor Babaev
bc6df8d6e0 Merge branch 'bb-10.2-mdev9543' of github.com:MariaDB/server into bb-10.2-mdev9543 2016-04-14 01:08:54 -07:00
Igor Babaev
5ff4b21e02 Fixed bug mdev-9897.
This bug revealed a serious problem: if the same partition list
was used in two window specifications then the temporary table created
to calculate window functions contained fields for two identical
partitions. This problem was fixed as well.
2016-04-14 00:47:28 -07:00
Vicențiu Ciorbaru
3dd08a11de Fix another bug in dense_rank.
When ordering by a column and partitioning by another, we must reset the
peer_tracker for dense_rank, regardless if the value for the order
column changes or not.

Example:
select a, b, dense_rank() over (partition by b order by a)
a  |  b  |  dense_rank
----------------------
1  | p1  |           1
2  | p1  |           2
2  | p2  |           1   // Here, without this fix we returned 0.
2  | p2  |           2   // And 1 here.
2016-04-13 10:39:06 +02:00
Sergei Petrunia
b532be9f8c Merge ../10.2-window-funcs-r12 into 10.2 2016-04-12 00:00:53 +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
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
Monty
293cb04959 MDEV-9621 INSERT DELAYED fails on insert for tables with many columns
This fix also fixes a connection hang when trying to do INSERT DELAYED to a crashed table.

Added crash_mysqld.inc to allow easy crash+restart of mysqld
2016-04-07 19:31:10 +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
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
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
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
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
Sergei Petrunia
2078392cc9 Make EXPLAIN FORMAT=JSON be able to show the key that's used for sorting.
This will be useful for window functions development.
2016-03-30 18:39:10 +03:00
Vicențiu Ciorbaru
de35787a83 Merge branch 'cume_dist' into bb-10.2-mdev9543 2016-03-28 22:52:18 +03:00
Vicențiu Ciorbaru
3544fe0144 Implemented cume_dist function.
Also fixed a bug in row_counts detection, when partition changes.
2016-03-28 22:51:42 +03:00
Sergei Petrunia
4fe6fbbb63 Merge branch 'bb-10.2-mdev9543' of github.com:MariaDB/server into bb-10.2-mdev9543 2016-03-28 22:19:55 +03:00
Sergei Petrunia
2bd4dc38e0 Merge branch '10.2' into bb-10.2-mdev9543 2016-03-28 22:18:38 +03:00
Sergei Petrunia
d146c2cedc MDEV-9787: Window functions: HAVING and GROUP BY
- Hook window function computation into the right location.
- Add a testcase which shows that HAVING is now checked before
  the window function computation step.
2016-03-28 20:53:09 +03:00
Sergei Petrunia
e88758330c Make window functions computation step show up in EXPLAIN FORMAT=JSON output 2016-03-28 18:38:42 +03:00