Problem was with handling NULL values in ranges
mysql-test/r/partition_hash.result:
New partition pruning test cases
mysql-test/r/partition_list.result:
New partition pruning test cases
mysql-test/r/partition_pruning.result:
New partition pruning test cases
mysql-test/r/partition_range.result:
New partition pruning test cases
mysql-test/t/partition_hash.test:
New partition pruning test cases
mysql-test/t/partition_list.test:
New partition pruning test cases
mysql-test/t/partition_pruning.test:
New partition pruning test cases
mysql-test/t/partition_range.test:
New partition pruning test cases
sql/opt_range.cc:
Added comment
sql/sql_partition.cc:
Partition pruning didn't handle ranges with NULL values in a proper manner
In select_describe(), make the String object that holds the value of
"partitions" column to "own" the value buffer, so the buffer isn't
prematurely freed.
[this is the second attempt with review fixes]
mysql-test/r/partition_pruning.result:
BUG#19684: Testcase
mysql-test/t/partition_pruning.test:
BUG#19684: Testcase
sql/sql_select.cc:
BUG#19684: Garbage in 'partitions' column in EXPLAIN output:
- Added comment
- Make the String object that holds the value of "partitions" column
to "own" the value buffer, so the buffer isn't prematurely freed.
(for example, such objects can be returned from get_mm_parts() for "string_field = int_val).
Make find_used_partitions_imerge() to handle such SEL_TREE objects.
mysql-test/r/partition_pruning.result:
BUG#19055: testcase
mysql-test/t/partition_pruning.test:
BUG#19055: testcase
Added new test case for bug 17946
mysql-test/r/partition_pruning.result:
Added new test case for bug 17946
mysql-test/t/partition_pruning.test:
Added new test case for bug 17946
* Produce right results for conditions that were transformed to "(partitioning_range) AND
(list_of_subpartitioning_ranges)": make each partition id set iterator auto-reset itself
after it has returned all partition ids in the sequence
* Fix "Range mapping" and "Range mapping" partitioning interval analysis functions to
correctly deal with NULL values.
mysql-test/r/partition_pruning.result:
Testcase for BUG#18558
mysql-test/t/partition_pruning.test:
Testcase for BUG#18558
sql/opt_range.cc:
BUG#18558: Move partition set iterator initialization to sql_partition.cc, comment fixes
sql/partition_info.h:
BUG#18558: Make each partition set iterator auto-reset itself after it has returned all
partition ids in the set it enumerates.
sql/sql_partition.cc:
BUG#18558:
- Make each partition set iterator auto-reset itself after it has returned all
partition ids in the set it enumerates.
- Fix partition interval analysis to correctly handle intervals with one or both
NULL bounds.
sql/sql_partition.h:
BUG#18558:
- Make each partition set iterator auto-reset itself after it has returned all
partition ids in the set it enumerates.
- Rename PARTITION_ITERATOR::has_null_value to ret_null_part
obtain partition number, call partition_info->get_part_partition_id() when
the table has subpartitions, and get_partition_id() otherwise. (The bug
was that we were always doing the latter)
mysql-test/r/partition_pruning.result:
Testcase for BUG#18659
mysql-test/t/partition_pruning.test:
Testcase for BUG#18659
- Fix typo bug in SEL_ARG::is_singlepoint()
- In set_up_range_analysis_info(), treat MEDIUMINT as enumerable type just like other integer types
mysql-test/r/partition_pruning.result:
Testcase for BUG#18025
mysql-test/t/partition_pruning.test:
Testcase for BUG#18025
sql/opt_range.cc:
BUG#18025: Fix a typo bug in SEL_ARG::is_singlepoint()
sql/sql_partition.cc:
BUG#18025: In set_up_range_analysis_info(), treat MEDIUMINT as enumerable type just like other integer types.
Final patch
-----------
This WL is about using this bitmap in all parts of the partition handler.
Thus for:
rnd_init/rnd_next
index_init/index_next and all other variants of index scans
read_range_... the various range scans implemented in the partition handler.
Also use those bitmaps in the various other calls that currently loop over all
partitions.
mysql-test/r/partition_pruning.result:
WL# 2986
New results reflecting bitmap being used to determine if a partition is to be
included
mysql-test/t/partition_pruning.test:
WL# 2986
New tests to show bitmap being used in ha_partition
sql/ha_partition.cc:
WL# 2986
Used work from 2682 and removed the partition select code.
Added do {} while loop to any iteration over partitions to now utilise
m_part_info->used_partitions bitmap to determine if a partition should be
used.
sql/ha_partition.h:
WL# 2986
Removed unused member
sql/handler.h:
WL# 2986
Removed unused member
sql/opt_range.cc:
WL# 2986
Added bitmap_clear_all to clear bitmap prior to pruning
DBUG code for testing
sql/sql_partition.cc:
WL# 2986
Changed < to <=, which fixes the problem with edge cases going awry.
- post-...-post review fixes
- Added "integer range walking" that allows to do partition pruning for "a <=? t.field <=? b"
by finding used partitions for a, a+1, a+2, ..., b-1, b.
mysql-test/r/partition_pruning.result:
WL#2985 "Partition Pruning": tests for "integer range walking"
mysql-test/t/partition.test:
WL#2985 "Partition Pruning": post-review fixes
mysql-test/t/partition_pruning.test:
WL#2985 "Partition Pruning": tests for "integer range walking"
sql/handler.h:
WL#2985 "Partition Pruning": "integer range walking":
- class partition_info now has pointers to "partitioning interval analysis" functions
- added "partition set iterator" definitions.
sql/opt_range.cc:
WL#2985 "Partition Pruning": "integer range walking":
- Switched to use "partitioning interval analysis" functions
- Fixed two problems in find_used_partitions() that occur on complicated WHERE clauses.
sql/sql_partition.cc:
WL#2985 "Partition Pruning": "integer range walking":
- Added "partitioning interval analysis" functions: get_part_iter_for_interval_via_mapping,
get_part_iter_for_interval_via_walking,
- Added appropriate partition-set-iterator implementations
- Added a function to set up Partitioning Interval Analysis-related fields in partition_info.
sql/sql_select.cc:
WL#2985 "Partition pruning": added comments.
- Added more comments.
- Added a RANGE_OPT_PARAM::remove_jump_scans flag that disables construction of index_merge
SEL_TREEs that represent unusable conditions like "key1part1<c1 OR key2part2<c2"
- make prune_partitions() function handle the case where range analysis produces a list of
index_merge trees (it turned out that this is possible, appropriate test case added).
- Other small fixes.
mysql-test/r/partition_pruning.result:
WL#2985 "Partition Pruning": post-review fixes: more test cases
mysql-test/t/partition_pruning.test:
WL#2985 "Partition Pruning": post-review fixes: more test cases
sql/opt_range.cc:
WL#2985 "Partition Pruning": post-review fixes:
- Added more comments.
- Fix the debug printouts
- Added a RANGE_OPT_PARAM::remove_jump_scans flag that disables construction of index_merge
SEL_TREEs that represent unusable conditions like "key1part1<c1 OR key2part2<c2"
- make prune_partitions() function handle the case where range analysis produces a list of
index_merge trees (it turned out that this is possible, appropriate test case added).
sql/sql_partition.cc:
WL#2985 "Partition Pruning": post-review fixes: make requested edits in comments.
sql/table.h:
WL#2985 "Partition Pruning": post-review fixes: added bool TABLE::no_partitions_used
(this change was missed when making the original cset)