summaryrefslogtreecommitdiff
path: root/sql/item_sum.cc
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch '10.3' into 10.4bb-10.4-MDEV-23468Oleksandr Byelkin2020-12-251-7/+7
|\
| * Merge branch '10.2' into 10.3Oleksandr Byelkin2020-12-231-7/+7
| |\
| | * MDEV-4677 GROUP_CONCAT not showing any output with group_concat_max_len >= 4GbSergei Golubchik2020-12-101-7/+7
| | | | | | | | | | | | | | | don't allow group_concat_max_len values >= 4Gb (they never worked anyway)
* | | Merge 10.3 into 10.4Marko Mäkelä2020-11-031-5/+9
|\ \ \ | |/ /
| * | Merge 10.2 into 10.3Marko Mäkelä2020-11-021-5/+9
| |\ \ | | |/
| | * MDEV-22387: Do not violate __attribute__((nonnull))Marko Mäkelä2020-11-021-4/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This follows up commit commit 94a520ddbe39ae97de1135d98699cf2674e6b77e and commit 7c5519c12d46ead947d341cbdcbb6fbbe4d4fe1b. After these changes, the default test suites on a cmake -DWITH_UBSAN=ON build no longer fail due to passing null pointers as parameters that are declared to never be null, but plenty of other runtime errors remain.
* | | Merge branch '10.3' into 10.4Oleksandr Byelkin2020-08-031-6/+6
|\ \ \ | |/ /
| * | Merge branch '10.2' into 10.3Oleksandr Byelkin2020-08-031-6/+6
| |\ \ | | |/
| | * Merge branch '10.1' into 10.2Oleksandr Byelkin2020-08-021-7/+7
| | |\
| | | * Code comment spellfixesIan Gilfillan2020-07-221-8/+8
| | | |
| | * | MDEV-21082: isnan/isinf compilation errors, isfinite warnings on MacOSVlad Lesin2019-11-191-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The fix consists of three commits backported from 10.3: 1) Cleanup isnan() portability checks (cherry picked from commit 7ffd7fe9627d1f750a3712aebb4503e5ae8aea8e) 2) Cleanup isinf() portability checks Original problem reported by Wlad: re-compilation of 10.3 on top of 10.2 build would cache undefined HAVE_ISINF from 10.2, whereas it is expected to be 1 in 10.3. std::isinf() seem to be available on all supported platforms. (cherry picked from commit bc469a0bdf85400f7a63834f5b7af1a513dcdec9) 3) Use std::isfinite in C++ code This is addition to parent revision fixing build failures. (cherry picked from commit 54999f4e75f42baca484ae436b382ca8817df1dd)
* | | | Merge 10.3 into 10.4Marko Mäkelä2020-06-131-15/+25
|\ \ \ \ | |/ / /
| * | | MDEV-11563: GROUP_CONCAT(DISTINCT ...) may produce a non-distinct listVarun Gupta2020-06-091-15/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Backported from MYSQL Bug #25331425: DISTINCT CLAUSE DOES NOT WORK IN GROUP_CONCAT Issue: ------ The problem occurs when: 1) GROUP_CONCAT (DISTINCT ....) is used in the query. 2) Data size greater than value of system variable: tmp_table_size. The result would contain values that are non-unique. Root cause: ----------- An in-memory structure is used to filter out non-unique values. When the data size exceeds tmp_table_size, the overflow is written to disk as a separate file. The expectation here is that when all such files are merged, the full set of unique values can be obtained. But the Item_func_group_concat::add function is in a bit of hurry. Even as it is adding values to the tree, it wants to decide if a value is unique and write it to the result buffer. This works fine if the configured maximum size is greater than the size of the data. But since tmp_table_size is set to a low value, the size of the tree is smaller and hence requires the creation of multiple copies on disk. Item_func_group_concat currently has no mechanism to merge all the copies on disk and then generate the result. This results in duplicate values. Solution: --------- In case of the DISTINCT clause, don't write to the result buffer immediately. Do the merge and only then put the unique values in the result buffer. This has be done in Item_func_group_concat::val_str. Note regarding result file changes: ----------------------------------- Earlier when a unique value was seen in Item_func_group_concat::add, it was dumped to the output. So result is in the order stored in SE. But with this fix, we wait until all the data is read and the final set of unique values are written to output buffer. So the data appears in the sorted order. This only fixes the cases when we have DISTINCT without ORDER BY clause in GROUP_CONCAT.
* | | | Merge 10.3 into 10.4Marko Mäkelä2020-05-161-3/+5
|\ \ \ \ | |/ / /
| * | | MDEV-18100: User defined aggregate functions not working correctly when the ↵Varun Gupta2020-05-151-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | schema is changed The issue here was that when the schema was changed the value for the THD::server_status is ored with SERVER_SESSION_STATE_CHANGED. For custom aggregate functions, currently we check if the server_status is equal to SERVER_STATUS_LAST_ROW_SENT then we should terminate the execution of the custom aggregate function as there are no more rows to fetch. So the check should be that if the server status has the bit set for SERVER_STATUS_LAST_ROW_SENT then we should terminate the execution of the custom aggregate function.
* | | | Merge remote-tracking branch 'origin/10.3' into 10.4Alexander Barkov2019-12-251-21/+1
|\ \ \ \ | |/ / /
| * | | MDEV-21392 Cleanup redundant overriding in Item_sum_numAlexander Barkov2019-12-251-21/+1
| | | |
* | | | MDEV-19961 MIN(timestamp_column) returns a wrong result in a GROUP BY queryAlexander Barkov2019-08-191-12/+60
| | | |
* | | | Merge commit '43882e764d6867c6855b1ff057758a3f08b25c55' into 10.4Alexander Barkov2019-08-131-38/+100
|\ \ \ \ | |/ / /
| * | | A cleanup for `MDEV-20273 Add class Item_sum_min_max` - removing duplicate codeAlexander Barkov2019-08-091-1/+63
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Reusing the MIN()/MAX() fix_length_and_dec() related code for window functions - FIRST_VALUE() - LAST_VALUE() - NTH_VALUE() - LEAD() - LAG
| * | | MDEV-20273 Add class Item_sum_min_maxAlexander Barkov2019-08-071-38/+38
| | | |
* | | | Merge 10.3 into 10.4Marko Mäkelä2019-07-251-4/+7
|\ \ \ \ | |/ / /
| * | | Merge 10.2 into 10.3Eugene Kosov2019-07-161-4/+7
| |\ \ \ | | |/ /
| | * | Merge 10.1 into 10.2Eugene Kosov2019-07-091-4/+7
| | |\ \ | | | |/
| | | * MDEV-17857 Assertion `tmp != ((long long) 0x8000000000000000LL)' failed in ↵Alexander Barkov2019-07-051-4/+7
| | | | | | | | | | | | | | | | TIME_from_longlong_datetime_packed upon SELECT with GROUP BY
* | | | Merge branch '10.3' into 10.4Oleksandr Byelkin2019-06-141-1/+5
|\ \ \ \ | |/ / /
| * | | Merge branch '10.2-release' into 10.3-releaseOleksandr Byelkin2019-06-141-1/+5
| |\ \ \ | | |/ /
| | * | MDEV-19633 ASAN use-after-poison in tree_insert() in main.func_gconcatSergei Golubchik2019-06-141-1/+5
| | | | | | | | | | | | | | | | | | | | when copying the TREE, take into account that init_tree can internally adjust tree->size_of_element
* | | | Merge branch '10.3' into 10.4Oleksandr Byelkin2019-05-191-5/+90
|\ \ \ \ | |/ / /
| * | | Merge 10.2 into 10.3Marko Mäkelä2019-05-141-1/+1
| |\ \ \ | | |/ /
| | * | Merge 10.1 into 10.2Marko Mäkelä2019-05-131-1/+1
| | |\ \ | | | |/
| | | * Merge branch '5.5' into 10.1Vicențiu Ciorbaru2019-05-111-1/+1
| | | |\
| | | | * Update FSF AddressVicențiu Ciorbaru2019-05-111-1/+1
| | | | | | | | | | | | | | | | | | | | * Update wrong zip-code
| | | | * MDEV-17249 MAKETIME(-1e50,0,0) returns a wrong resultAlexander Barkov2018-09-201-2/+4
| | | | |
| * | | | Merge branch '10.2' into 10.3Oleksandr Byelkin2019-05-121-4/+89
| |\ \ \ \ | | |/ / /
| | * | | Merge branch '10.1' into 10.2Oleksandr Byelkin2019-05-041-4/+89
| | |\ \ \ | | | |/ /
| | | * | MDEV-19350 Server crashes in delete_tree_element / ... / ↵Sergei Golubchik2019-04-271-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Item_func_group_concat::repack_tree Item_func_group_concat stores values in `tree`, which is often, but not always the same as `&tree_base`.
| | | * | MDEV-9531 GROUP_CONCAT with ORDER BY inside takes a lot of memory while it's ↵Sergei Golubchik2019-04-241-4/+89
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | executed group concat tree is allocated in a memroot, so the only way to free memory is to copy a part of the tree into a new memroot. track the accumilated length of the result, and when it crosses the threshold - copy the result into a new tree, free the old one.
* | | | | Merge 10.3 into 10.4Marko Mäkelä2019-05-051-1/+13
|\ \ \ \ \ | |/ / / /
| * | | | MDEV-18943: Group Concat with limit not working with viewsVarun Gupta2019-05-031-1/+13
| | | | | | | | | | | | | | | | | | | | | | | | | Adjusted the Item_func_group_concat::print function to take into account limit if present with GROUP_CONCAT
| * | | | Fixed some compilation warnings/errorsMonty2019-05-021-1/+1
| | | | |
* | | | | MDEV-19062 Item_sum_variance: move recurrence_m, recurrence_s, count to a ↵Alexander Barkov2019-03-281-54/+45
| | | | | | | | | | | | | | | | | | | | separate class
* | | | | A cleanup in Item_sum: removing dead codeAlexander Barkov2019-03-281-19/+0
| | | | |
* | | | | Fixed build failureSergey Vojtovich2019-03-231-1/+1
| | | | |
* | | | | Merge 10.3 into 10.4Marko Mäkelä2019-03-221-2/+15
|\ \ \ \ \ | |/ / / /
| * | | | Merge remote-tracking branch 'origin/10.2' into 10.3Alexander Barkov2019-03-221-2/+15
| |\ \ \ \ | | |/ / /
| | * | | Merge 10.1 into 10.2Marko Mäkelä2019-03-221-2/+15
| | |\ \ \ | | | |/ /
| | | * | Fixing "mtr func_math" failure in the test for MDEV-17643Alexander Barkov2019-03-201-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Adding an intermediate volatile variable to avoid using co-processor registers on some platforms (e.g. 32-bit x86). This change makes test results stable accross all platforms.
| | | * | MDEV-17643 Assertion `nr >= 0.0' failed in Item_sum_std::val_real()Alexander Barkov2019-03-151-0/+12
| | | | |
* | | | | MDEV-13995 MAX(timestamp) returns a wrong result near DST changeAlexander Barkov2018-12-101-0/+9
| | | | |