summaryrefslogtreecommitdiff
path: root/sql/item_windowfunc.cc
Commit message (Collapse)AuthorAgeFilesLines
* Merge 10.3 into 10.4Marko Mäkelä2020-07-311-4/+2
|\
| * Merge 10.2 into 10.3Marko Mäkelä2020-07-311-4/+2
| |\
| | * MDEV-18916: crash in Window_spec::print_partition() with decimalsVarun Gupta2020-07-271-4/+2
| | | | | | | | | | | | | | | | | | Removed an unnecessary ifndef which was printing the window name for a named window only in the case of debug build. The print() for the window function should behave in the same way on both release and debug builds.
* | | Merge 10.3 into 10.4Marko Mäkelä2020-07-021-2/+2
|\ \ \ | |/ /
| * | Merge 10.2 into 10.3Marko Mäkelä2020-07-021-2/+2
| |\ \ | | |/
| | * MDEV-22984: Throw an error when arguments to window functions are window ↵Varun Gupta2020-06-301-0/+1
| | | | | | | | | | | | | | | | | | functions Window function is not allowed as arguments to window functions according to the standard.
* | | Merge commit '43882e764d6867c6855b1ff057758a3f08b25c55' into 10.4Alexander Barkov2019-08-131-30/+35
|\ \ \ | |/ /
| * | A cleanup for `MDEV-20273 Add class Item_sum_min_max` - removing duplicate codeAlexander Barkov2019-08-091-27/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | Reusing the MIN()/MAX() fix_length_and_dec() related code for window functions - FIRST_VALUE() - LAST_VALUE() - NTH_VALUE() - LEAD() - LAG
| * | MDEV-20272 PERCENTILE_DISC() crashes on a temporal type inputAlexander Barkov2019-08-071-10/+23
| | |
| * | MDEV-20278 PERCENTILE_DISC() returns a wrong data typeAlexander Barkov2019-08-071-2/+10
| | |
* | | MDEV-19124 Assertion `0' failed in Item::val_nativeAlexander Barkov2019-04-021-0/+8
| | |
* | | Merge 10.3 into 10.4Marko Mäkelä2018-10-171-0/+17
|\ \ \ | |/ /
| * | MDEV-17137: Syntax errors with VIEW using MEDIANVarun Gupta2018-10-161-0/+17
| | | | | | | | | | | | | | | | | | | | | The syntax error happened because we had not implemented a different print for percentile functions. The syntax is a bit different when we use percentile functions as window functions in comparision to normal window functions. Implemented a seperate print function for percentile functions
* | | MDEV-17317 Add THD* parameter into Item::get_date() and stricter data type ↵Alexander Barkov2018-09-281-2/+2
| | | | | | | | | | | | control to "fuzzydate"
* | | MDEV-16910 Add class VDecAlexander Barkov2018-08-071-5/+3
| | | | | | | | | | | | | | | Adding classes VDec and VDec2_lazy, according to the task description. This patch removes around 250 duplicate code lines.
* | | Merge remote-tracking branch 'origin/10.3' into 10.4Alexander Barkov2018-07-031-6/+8
|\ \ \ | |/ /
| * | MDEV-16489 when lead() returns null on a datetime field, the result is ↵Alexander Barkov2018-06-201-1/+1
| | | | | | | | | | | | treated as the literal string '[NULL]'
| * | Merge commit '6b8802e8dd5467556a024d807a1df23940b00895' into bb-10.3-fix_len_decbb-10.3-fix_len_decOleksandr Byelkin2018-06-191-2/+4
| |\ \ | | |/
| | * MDEV-11071: Assertion `thd->transaction.stmt.is_empty()' failed in ↵Oleksandr Byelkin2018-06-151-2/+4
| | | | | | | | | | | | | | | | | | Locked_tables_list::unlock_locked_table fix_length_and_dec now return result (error/OK)
| * | Merge 10.2 into 10.3Marko Mäkelä2018-06-181-3/+3
| |\ \ | | |/
| | * MDEV-15870 Using aggregate and window function in unexpected places can ↵Alexander Barkov2018-06-131-3/+3
| | | | | | | | | | | | crash the server
* | | MDEV-16592 Change Item::with_sum_func from a member to a virtual methodAlexander Barkov2018-06-271-1/+0
|/ /
* | MDEV-16385 ROW SP variable is allowed in unexpected contextAlexander Barkov2018-06-051-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The problem described in the bug report happened because the code did not test check_cols(1) after fix_fields() in a few places. Additionally, fix_fields() could be called multiple times for SP variables, because they are all fixed at a early stage in append_for_log(). Solution: 1. Adding a few helper methods - fix_fields_if_needed() - fix_fields_if_needed_for_scalar() - fix_fields_if_needed_for_bool() - fix_fields_if_needed_for_order_by() and using it in many cases instead of fix_fields() where the "fixed" status is not definitely known to be "false". 2. Adding DBUG_ASSERT(!fixed) into Item_splocal*::fix_fields() to catch double execution. 3. Adding tests. As a good side effect, the patch removes a lot of duplicate code (~60 lines): if (!item->fixed && item->fix_fields(..) && item->check_cols(1)) return true;
* | Merge bb-10.2-ext into 10.3Marko Mäkelä2018-02-151-0/+16
|\ \
| * | MDEV-15293 CAST(AS TIME) returns bad results for ↵Alexander Barkov2018-02-131-0/+11
| | | | | | | | | | | | LAST_VALUE(),NAME_CONST(),SP variable
| * | Merge remote-tracking branch 'origin/10.2' into bb-10.2-extAlexander Barkov2018-02-081-0/+5
| |\ \ | | |/
| | * fix Item_window_func::print() not to crash before fix_fields()Sergei Golubchik2018-02-061-0/+5
| | | | | | | | | | | | | | | | | | | | | because dbug_print_item() can be invoked any time in gdb, also before fix_fields. this fixes a crash of main.win in debug builds
* | | Merge bb-10.2-ext into 10.3Marko Mäkelä2017-11-301-2/+2
|\ \ \ | |/ /
| * | MDEV-14517 Cleanup for Item::with_subselect and Item::has_subquery()Alexander Barkov2017-11-281-2/+2
| | |
* | | Updates the tests for the percentile functionsVarun Gupta2017-11-011-4/+4
| | |
* | | Date-time fields are disabled currently for the result type of percentile ↵Varun Gupta2017-11-011-3/+2
| | | | | | | | | | | | function
* | | Tests added for percentile and median functionsVarun Gupta2017-11-011-1/+1
| | |
* | | Added fix_fields for percentile function to check the type of argument and ↵Varun Gupta2017-11-011-11/+43
| | | | | | | | | | | | to ensure that only numeric arguments are allowed
* | | Added the error ER_WRONG_TYPE_FOR_PERCENTILE_CONT, which ensures that the ↵Varun Gupta2017-11-011-7/+4
| | | | | | | | | | | | result type for percentile_cont is always numerical
* | | Added the error ER_NOT_SINGLE_ELEMENT_ORDER_LIST for th percentile ↵Varun Gupta2017-11-011-8/+1
| | | | | | | | | | | | | | | | | | functions, these ensure that for the percentile function we have the order list with exactly one element
* | | Ensured that the the element in the order by clause should have a numerical ↵Varun Gupta2017-11-011-0/+18
| | | | | | | | | | | | time, if not throw an error
* | | Percentile class implemented, most of the functions have the same ↵Varun Gupta2017-11-011-0/+21
| | | | | | | | | | | | functionalite as the percentile cont class
* | | Implemented the implementation of percentile functions using Item_cache ↵Varun Gupta2017-11-011-7/+7
| | | | | | | | | | | | instead of Cache_Item
* | | Setting handler to have the return type as that of the element by which we ↵Varun Gupta2017-11-011-0/+5
| | | | | | | | | | | | are ordering the partition
* | | Added value field to Item_sum_percentile_discVarun Gupta2017-11-011-0/+16
| | | | | | | | | | | | Check for single element in the order_list is added
* | | Enusure that my_global.h is included firstMichael Widenius2017-08-241-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Added sql/mariadb.h file that should be included first by files in sql directory, if sql_plugin.h is not used (sql_plugin.h adds SHOW variables that must be done before my_global.h is included) - Removed a lot of include my_global.h from include files - Removed include's of some files that my_global.h automatically includes - Removed duplicated include's of my_sys.h - Replaced include my_config.h with my_global.h
* | | Added copyright message to some filesMichael Widenius2017-08-241-0/+16
|/ /
* | Merge 10.2 into bb-10.2-extMarko Mäkelä2017-06-191-1/+1
|\ \ | |/
| * Fixed the bug mdev-13064.Igor Babaev2017-06-161-1/+1
| | | | | | | | | | | | | | | | This is another attempt to fix the bug mdev-12992. This patch introduces st_select_lex::context_analysis_place for the place in SELECT where context analysis is currently performed. It's similar to st_select_lex::parsing_place, but it is used at the preparation stage.
* | MDEV-12719 Determine Item::result_type() from Item::type_handler()Alexander Barkov2017-05-071-2/+2
| |
* | Cleanup: changing set_handler_by_field_type(field_type()) to ↵Alexander Barkov2017-05-061-2/+2
| | | | | | | | | | | | set_handler(type_handler()). This gives better performance, as excludes handler-by-type lookup.
* | Changing field::field_name and Item::name to LEX_CSTRINGMonty2017-04-231-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Benefits of this patch: - Removed a lot of calls to strlen(), especially for field_string - Strings generated by parser are now const strings, less chance of accidently changing a string - Removed a lot of calls with LEX_STRING as parameter (changed to pointer) - More uniform code - Item::name_length was not kept up to date. Now fixed - Several bugs found and fixed (Access to null pointers, access of freed memory, wrong arguments to printf like functions) - Removed a lot of casts from (const char*) to (char*) Changes: - This caused some ABI changes - lex_string_set now uses LEX_CSTRING - Some fucntions are now taking const char* instead of char* - Create_field::change and after changed to LEX_CSTRING - handler::connect_string, comment and engine_name() changed to LEX_CSTRING - Checked printf() related calls to find bugs. Found and fixed several errors in old code. - A lot of changes from LEX_STRING to LEX_CSTRING, especially related to parsing and events. - Some changes from LEX_STRING and LEX_STRING & to LEX_CSTRING* - Some changes for char* to const char* - Added printf argument checking for my_snprintf() - Introduced null_clex_str, star_clex_string, temp_lex_str to simplify code - Added item_empty_name and item_used_name to be able to distingush between items that was given an empty name and items that was not given a name This is used in sql_yacc.yy to know when to give an item a name. - select table_name."*' is not anymore same as table_name.* - removed not used function Item::rename() - Added comparision of item->name_length before some calls to my_strcasecmp() to speed up comparison - Moved Item_sp_variable::make_field() from item.h to item.cc - Some minimal code changes to avoid copying to const char * - Fixed wrong error message in wsrep_mysql_parse() - Fixed wrong code in find_field_in_natural_join() where real_item() was set when it shouldn't - ER_ERROR_ON_RENAME was used with extra arguments. - Removed some (wrong) ER_OUTOFMEMORY, as alloc_root will already give the error. TODO: - Check possible unsafe casts in plugin/auth_examples/qa_auth_interface.c - Change code to not modify LEX_CSTRING for database name (as part of lower_case_table_names)
* | Merge remote-tracking branch 'origin/10.2' into bb-10.2-extAlexander Barkov2017-02-271-12/+1
|\ \ | |/
| * MDEV-11746: Wrong result upon using FIRST_VALUE with a window frameVicențiu Ciorbaru2017-02-141-12/+0
| | | | | | | | | | Reimplement FIRST_VALUE to act as NTH_VALUE with 0 offset. The previous implementation was flawed when the window frame would remove values.
| * Fixed bug mdev-11745.Igor Babaev2017-02-091-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Due to this bug many queries that contained a window function with MIN/MAX aggregation returned wrong results. Calculation of a MIN/MAX aggregate function uses cache objects and a comparator object that are created and set up in Item_sum_hybrid::fix_fields () by a call of Item_sum_hybrid::setup_hybrid(). The latter binds the objects to the first argument of the MIN/MAX function. Meanwhile window function perform aggregation over fields of a temporary table. So binding must be done rather to these fields. The earliest moment when setup the objects used in MIN/max functions can be done is after all calls of the method split_sum_func(). This patch introduces this late setup, but only for aggregate functions used in window functions. Probably it makes sense to use this late setup for all MIN/MAX objects.