Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
81248942
Commit
81248942
authored
Sep 30, 2006
by
mikael/pappa@dator5.(none)
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
BUG#18198: Partition function handling
Review fixes
parent
fef3cb33
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
116 additions
and
9 deletions
+116
-9
mysql-test/r/partition_range.result
mysql-test/r/partition_range.result
+34
-0
mysql-test/t/partition_hash.test
mysql-test/t/partition_hash.test
+12
-0
mysql-test/t/partition_range.test
mysql-test/t/partition_range.test
+43
-0
sql/item.h
sql/item.h
+11
-3
sql/partition_info.cc
sql/partition_info.cc
+5
-4
sql/sql_partition.cc
sql/sql_partition.cc
+11
-2
No files found.
mysql-test/r/partition_range.result
View file @
81248942
drop table if exists t1;
drop table if exists t1;
create table t1 (a varchar(10) charset latin1 collate latin1_bin, b int)
partition by range (length(a) * b)
(partition p0 values less than (2), partition p1 values less than (10));
insert into t1 values ('a ', 2),('a',3);
drop table t1;
create table t1 (a varchar(10) charset latin1 collate latin1_bin, b int)
partition by range (b* length(a) * b)
(partition p0 values less than (2), partition p1 values less than (10));
insert into t1 values ('a ', 2),('a',3);
drop table t1;
create table t1 (a varchar(10) charset latin1 collate latin1_bin,
b varchar(10) charset latin1 collate latin1_bin)
partition by range (length(b) * length(a))
(partition p0 values less than (2), partition p1 values less than (10));
insert into t1 values ('a ', 'b '),('a','b');
drop table t1;
create table t1 (a varchar(10) charset latin1 collate latin1_bin,
b varchar(10) charset latin1 collate latin1_bin)
partition by range (length(a) * length(b))
(partition p0 values less than (2), partition p1 values less than (10));
insert into t1 values ('a ', 'b '),('a','b');
drop table t1;
create table t1 (a varchar(10) charset latin1 collate latin1_bin,
b varchar(10) charset latin1 collate latin1_bin, c int)
partition by range (length(a) * c)
(partition p0 values less than (2), partition p1 values less than (10));
insert into t1 values ('a ', 'b ', 2),('a','b', 3);
drop table t1;
create table t1 (a varchar(10) charset latin1 collate latin1_bin,
b varchar(10) charset latin1 collate latin1_bin, c int)
partition by range (c * length(a))
(partition p0 values less than (2), partition p1 values less than (10));
insert into t1 values ('a ', 'b ', 2),('a','b', 3);
drop table t1;
create table t1 (a int unsigned)
create table t1 (a int unsigned)
partition by range (a)
partition by range (a)
(partition pnull values less than (0),
(partition pnull values less than (0),
...
...
mysql-test/t/partition_hash.test
View file @
81248942
...
@@ -9,6 +9,18 @@
...
@@ -9,6 +9,18 @@
drop
table
if
exists
t1
;
drop
table
if
exists
t1
;
--
enable_warnings
--
enable_warnings
#
# BUG 18198: Partition functions handling
#
create
table
t1
(
a
varchar
(
10
)
charset
latin1
collate
latin1_bin
)
partition
by
hash
(
length
(
a
))
partitions
10
;
insert
into
t1
values
(
''
),(
' '
),(
'a'
),(
'a '
),(
'a '
);
explain
partitions
select
*
from
t1
where
a
=
'a '
;
explain
partitions
select
*
from
t1
where
a
=
'a'
;
explain
partitions
select
*
from
t1
where
a
=
'a '
OR
a
=
'a'
;
drop
table
t1
;
#
#
# More partition pruning tests, especially on interval walking
# More partition pruning tests, especially on interval walking
#
#
...
...
mysql-test/t/partition_range.test
View file @
81248942
...
@@ -9,6 +9,49 @@
...
@@ -9,6 +9,49 @@
drop
table
if
exists
t1
;
drop
table
if
exists
t1
;
--
enable_warnings
--
enable_warnings
#
# BUG 18198: Various tests for partition functions
#
create
table
t1
(
a
varchar
(
10
)
charset
latin1
collate
latin1_bin
,
b
int
)
partition
by
range
(
length
(
a
)
*
b
)
(
partition
p0
values
less
than
(
2
),
partition
p1
values
less
than
(
10
));
insert
into
t1
values
(
'a '
,
2
),(
'a'
,
3
);
drop
table
t1
;
create
table
t1
(
a
varchar
(
10
)
charset
latin1
collate
latin1_bin
,
b
int
)
partition
by
range
(
b
*
length
(
a
)
*
b
)
(
partition
p0
values
less
than
(
2
),
partition
p1
values
less
than
(
10
));
insert
into
t1
values
(
'a '
,
2
),(
'a'
,
3
);
drop
table
t1
;
create
table
t1
(
a
varchar
(
10
)
charset
latin1
collate
latin1_bin
,
b
varchar
(
10
)
charset
latin1
collate
latin1_bin
)
partition
by
range
(
length
(
b
)
*
length
(
a
))
(
partition
p0
values
less
than
(
2
),
partition
p1
values
less
than
(
10
));
insert
into
t1
values
(
'a '
,
'b '
),(
'a'
,
'b'
);
drop
table
t1
;
create
table
t1
(
a
varchar
(
10
)
charset
latin1
collate
latin1_bin
,
b
varchar
(
10
)
charset
latin1
collate
latin1_bin
)
partition
by
range
(
length
(
a
)
*
length
(
b
))
(
partition
p0
values
less
than
(
2
),
partition
p1
values
less
than
(
10
));
insert
into
t1
values
(
'a '
,
'b '
),(
'a'
,
'b'
);
drop
table
t1
;
create
table
t1
(
a
varchar
(
10
)
charset
latin1
collate
latin1_bin
,
b
varchar
(
10
)
charset
latin1
collate
latin1_bin
,
c
int
)
partition
by
range
(
length
(
a
)
*
c
)
(
partition
p0
values
less
than
(
2
),
partition
p1
values
less
than
(
10
));
insert
into
t1
values
(
'a '
,
'b '
,
2
),(
'a'
,
'b'
,
3
);
drop
table
t1
;
create
table
t1
(
a
varchar
(
10
)
charset
latin1
collate
latin1_bin
,
b
varchar
(
10
)
charset
latin1
collate
latin1_bin
,
c
int
)
partition
by
range
(
c
*
length
(
a
))
(
partition
p0
values
less
than
(
2
),
partition
p1
values
less
than
(
10
));
insert
into
t1
values
(
'a '
,
'b '
,
2
),(
'a'
,
'b'
,
3
);
drop
table
t1
;
#
#
# More checks for partition pruning
# More checks for partition pruning
#
#
...
...
sql/item.h
View file @
81248942
...
@@ -831,12 +831,20 @@ public:
...
@@ -831,12 +831,20 @@ public:
Check if a partition function is allowed
Check if a partition function is allowed
SYNOPSIS
SYNOPSIS
check_partition_func_processor()
check_partition_func_processor()
int_arg
Return argument
int_arg
Ignored
RETURN VALUE
RETURN VALUE
0
TRUE Partition function not accepted
FALSE Partition function accepted
DESCRIPTION
DESCRIPTION
check_partition_func_processor is used to check if a partition function
check_partition_func_processor is used to check if a partition function
uses an allowed function. The default is that an item is not allowed
uses an allowed function. An allowed function will always ensure that
X=Y guarantees that also part_function(X)=part_function(Y) where X is
a set of partition fields and so is Y. The problems comes mainly from
character sets where two equal strings can be quite unequal. E.g. the
german character for double s is equal to 2 s.
The default is that an item is not allowed
in a partition function. However all mathematical functions, string
in a partition function. However all mathematical functions, string
manipulation functions, date functions are allowed. Allowed functions
manipulation functions, date functions are allowed. Allowed functions
can never depend on server version, they cannot depend on anything
can never depend on server version, they cannot depend on anything
...
...
sql/partition_info.cc
View file @
81248942
...
@@ -838,11 +838,12 @@ end:
...
@@ -838,11 +838,12 @@ end:
/*
/*
Print error for no partition found
Print error for no partition found
SYNOPSIS
SYNOPSIS
print_no_partition_found()
print_no_partition_found()
table Table object
table Table object
RETURN VALUES
RETURN VALUES
NONE
*/
*/
void
partition_info
::
print_no_partition_found
(
TABLE
*
table
)
void
partition_info
::
print_no_partition_found
(
TABLE
*
table
)
...
@@ -863,10 +864,11 @@ void partition_info::print_no_partition_found(TABLE *table)
...
@@ -863,10 +864,11 @@ void partition_info::print_no_partition_found(TABLE *table)
Set up buffers and arrays for fields requiring preparation
Set up buffers and arrays for fields requiring preparation
SYNOPSIS
SYNOPSIS
set_up_charset_field_preps()
set_up_charset_field_preps()
part_info Partition info object
RETURN VALUES
RETURN VALUES
TRUE Memory Allocation error
TRUE Memory Allocation error
FALSE Success
FALSE Success
DESCRIPTION
DESCRIPTION
Set up arrays and buffers for fields that require special care for
Set up arrays and buffers for fields that require special care for
calculation of partition id. This is used for string fields with
calculation of partition id. This is used for string fields with
...
@@ -1025,5 +1027,4 @@ error:
...
@@ -1025,5 +1027,4 @@ error:
mem_alloc_error
(
size
);
mem_alloc_error
(
size
);
DBUG_RETURN
(
TRUE
);
DBUG_RETURN
(
TRUE
);
}
}
#endif
#endif
/* WITH_PARTITION_STORAGE_ENGINE */
/* WITH_PARTITION_STORAGE_ENGINE */
sql/sql_partition.cc
View file @
81248942
...
@@ -1437,9 +1437,11 @@ static uint32 get_part_id_from_linear_hash(longlong hash_value, uint mask,
...
@@ -1437,9 +1437,11 @@ static uint32 get_part_id_from_linear_hash(longlong hash_value, uint mask,
/*
/*
Check if a particular field is in need of character set
Check if a particular field is in need of character set
handling for partition functions.
handling for partition functions.
SYNOPSIS
SYNOPSIS
field_is_partition_charset()
field_is_partition_charset()
field The field to check
field The field to check
RETURN VALUES
RETURN VALUES
FALSE Not in need of character set handling
FALSE Not in need of character set handling
TRUE In need of character set handling
TRUE In need of character set handling
...
@@ -1461,8 +1463,9 @@ bool field_is_partition_charset(Field *field)
...
@@ -1461,8 +1463,9 @@ bool field_is_partition_charset(Field *field)
/*
/*
Check that partition function do
no
t contain any forbidden
Check that partition function do
esn'
t contain any forbidden
character sets and collations.
character sets and collations.
SYNOPSIS
SYNOPSIS
check_part_func_fields()
check_part_func_fields()
ptr Array of Field pointers
ptr Array of Field pointers
...
@@ -1471,6 +1474,7 @@ bool field_is_partition_charset(Field *field)
...
@@ -1471,6 +1474,7 @@ bool field_is_partition_charset(Field *field)
RETURN VALUES
RETURN VALUES
FALSE Success
FALSE Success
TRUE Error
TRUE Error
DESCRIPTION
DESCRIPTION
We will check in this routine that the fields of the partition functions
We will check in this routine that the fields of the partition functions
do not contain unallowed parts. It can also be used to check if there
do not contain unallowed parts. It can also be used to check if there
...
@@ -2390,9 +2394,13 @@ static uint32 get_part_id_linear_key(partition_info *part_info,
...
@@ -2390,9 +2394,13 @@ static uint32 get_part_id_linear_key(partition_info *part_info,
/*
/*
Copy to field buffers and set up field pointers
Copy to field buffers and set up field pointers
SYNOPSIS
SYNOPSIS
copy_to_part_field_buffers()
copy_to_part_field_buffers()
ptr Array of fields to copy
ptr Array of fields to copy
field_bufs Array of field buffers to copy to
restore_ptr Array of pointers to restore to
RETURN VALUES
RETURN VALUES
NONE
NONE
DESCRIPTION
DESCRIPTION
...
@@ -2451,8 +2459,9 @@ static void copy_to_part_field_buffers(Field **ptr,
...
@@ -2451,8 +2459,9 @@ static void copy_to_part_field_buffers(Field **ptr,
SYNOPSIS
SYNOPSIS
restore_part_field_pointers()
restore_part_field_pointers()
ptr Array of fields to restore
ptr Array of fields to restore
restore_ptr Array of field pointers to restore to
RETURN VALUES
RETURN VALUES
NONE
*/
*/
static
void
restore_part_field_pointers
(
Field
**
ptr
,
char
**
restore_ptr
)
static
void
restore_part_field_pointers
(
Field
**
ptr
,
char
**
restore_ptr
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment