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
1cdf82e0
Commit
1cdf82e0
authored
Oct 02, 2006
by
mikael/pappa@dator5.(none)
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
BUG#18198: Partition function handling
Fixes of after review fixes
parent
74c7f60d
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
41 additions
and
15 deletions
+41
-15
mysql-test/r/partition_hash.result
mysql-test/r/partition_hash.result
+14
-0
mysql-test/r/partition_range.result
mysql-test/r/partition_range.result
+6
-6
mysql-test/t/partition_range.test
mysql-test/t/partition_range.test
+6
-6
sql/ha_ndbcluster.cc
sql/ha_ndbcluster.cc
+7
-0
sql/ha_partition.cc
sql/ha_partition.cc
+4
-0
sql/partition_info.cc
sql/partition_info.cc
+1
-1
sql/partition_info.h
sql/partition_info.h
+3
-2
No files found.
mysql-test/r/partition_hash.result
View file @
1cdf82e0
drop table if exists t1;
drop table if exists t1;
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 ';
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 p0 ALL NULL NULL NULL NULL 5 Using where
explain partitions select * from t1 where a='a';
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 p0 ALL NULL NULL NULL NULL 5 Using where
explain partitions select * from t1 where a='a ' OR a='a';
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 p0 ALL NULL NULL NULL NULL 5 Using where
drop table t1;
create table t1 (a int unsigned)
create table t1 (a int unsigned)
partition by hash(a div 2)
partition by hash(a div 2)
partitions 4;
partitions 4;
...
...
mysql-test/r/partition_range.result
View file @
1cdf82e0
drop table if exists t1;
drop table if exists t1;
create table t1 (a varchar(10) charset latin1 collate latin1_bin, b int)
create table t1 (a varchar(10) charset latin1 collate latin1_bin, b int)
partition by range (length(a) * b)
partition by range (length(a) * b)
(partition p0 values less than (2), partition p1 values less than (
1
0));
(partition p0 values less than (2), partition p1 values less than (
40
0));
insert into t1 values ('a ', 2),('a',3);
insert into t1 values ('a ', 2),('a',3);
drop table t1;
drop table t1;
create table t1 (a varchar(10) charset latin1 collate latin1_bin, b int)
create table t1 (a varchar(10) charset latin1 collate latin1_bin, b int)
partition by range (b* length(a) * b)
partition by range (b* length(a) * b)
(partition p0 values less than (2), partition p1 values less than (
1
0));
(partition p0 values less than (2), partition p1 values less than (
40
0));
insert into t1 values ('a ', 2),('a',3);
insert into t1 values ('a ', 2),('a',3);
drop table t1;
drop table t1;
create table t1 (a varchar(10) charset latin1 collate latin1_bin,
create table t1 (a varchar(10) charset latin1 collate latin1_bin,
b varchar(10) charset latin1 collate latin1_bin)
b varchar(10) charset latin1 collate latin1_bin)
partition by range (length(b) * length(a))
partition by range (length(b) * length(a))
(partition p0 values less than (2), partition p1 values less than (
1
0));
(partition p0 values less than (2), partition p1 values less than (
40
0));
insert into t1 values ('a ', 'b '),('a','b');
insert into t1 values ('a ', 'b '),('a','b');
drop table t1;
drop table t1;
create table t1 (a varchar(10) charset latin1 collate latin1_bin,
create table t1 (a varchar(10) charset latin1 collate latin1_bin,
b varchar(10) charset latin1 collate latin1_bin)
b varchar(10) charset latin1 collate latin1_bin)
partition by range (length(a) * length(b))
partition by range (length(a) * length(b))
(partition p0 values less than (2), partition p1 values less than (
1
0));
(partition p0 values less than (2), partition p1 values less than (
40
0));
insert into t1 values ('a ', 'b '),('a','b');
insert into t1 values ('a ', 'b '),('a','b');
drop table t1;
drop table t1;
create table t1 (a varchar(10) charset latin1 collate latin1_bin,
create table t1 (a varchar(10) charset latin1 collate latin1_bin,
b varchar(10) charset latin1 collate latin1_bin, c int)
b varchar(10) charset latin1 collate latin1_bin, c int)
partition by range (length(a) * c)
partition by range (length(a) * c)
(partition p0 values less than (2), partition p1 values less than (
1
0));
(partition p0 values less than (2), partition p1 values less than (
40
0));
insert into t1 values ('a ', 'b ', 2),('a','b', 3);
insert into t1 values ('a ', 'b ', 2),('a','b', 3);
drop table t1;
drop table t1;
create table t1 (a varchar(10) charset latin1 collate latin1_bin,
create table t1 (a varchar(10) charset latin1 collate latin1_bin,
b varchar(10) charset latin1 collate latin1_bin, c int)
b varchar(10) charset latin1 collate latin1_bin, c int)
partition by range (c * length(a))
partition by range (c * length(a))
(partition p0 values less than (2), partition p1 values less than (
1
0));
(partition p0 values less than (2), partition p1 values less than (
40
0));
insert into t1 values ('a ', 'b ', 2),('a','b', 3);
insert into t1 values ('a ', 'b ', 2),('a','b', 3);
drop table t1;
drop table t1;
create table t1 (a int unsigned)
create table t1 (a int unsigned)
...
...
mysql-test/t/partition_range.test
View file @
1cdf82e0
...
@@ -14,41 +14,41 @@ drop table if exists t1;
...
@@ -14,41 +14,41 @@ drop table if exists t1;
#
#
create
table
t1
(
a
varchar
(
10
)
charset
latin1
collate
latin1_bin
,
b
int
)
create
table
t1
(
a
varchar
(
10
)
charset
latin1
collate
latin1_bin
,
b
int
)
partition
by
range
(
length
(
a
)
*
b
)
partition
by
range
(
length
(
a
)
*
b
)
(
partition
p0
values
less
than
(
2
),
partition
p1
values
less
than
(
1
0
));
(
partition
p0
values
less
than
(
2
),
partition
p1
values
less
than
(
40
0
));
insert
into
t1
values
(
'a '
,
2
),(
'a'
,
3
);
insert
into
t1
values
(
'a '
,
2
),(
'a'
,
3
);
drop
table
t1
;
drop
table
t1
;
create
table
t1
(
a
varchar
(
10
)
charset
latin1
collate
latin1_bin
,
b
int
)
create
table
t1
(
a
varchar
(
10
)
charset
latin1
collate
latin1_bin
,
b
int
)
partition
by
range
(
b
*
length
(
a
)
*
b
)
partition
by
range
(
b
*
length
(
a
)
*
b
)
(
partition
p0
values
less
than
(
2
),
partition
p1
values
less
than
(
1
0
));
(
partition
p0
values
less
than
(
2
),
partition
p1
values
less
than
(
40
0
));
insert
into
t1
values
(
'a '
,
2
),(
'a'
,
3
);
insert
into
t1
values
(
'a '
,
2
),(
'a'
,
3
);
drop
table
t1
;
drop
table
t1
;
create
table
t1
(
a
varchar
(
10
)
charset
latin1
collate
latin1_bin
,
create
table
t1
(
a
varchar
(
10
)
charset
latin1
collate
latin1_bin
,
b
varchar
(
10
)
charset
latin1
collate
latin1_bin
)
b
varchar
(
10
)
charset
latin1
collate
latin1_bin
)
partition
by
range
(
length
(
b
)
*
length
(
a
))
partition
by
range
(
length
(
b
)
*
length
(
a
))
(
partition
p0
values
less
than
(
2
),
partition
p1
values
less
than
(
1
0
));
(
partition
p0
values
less
than
(
2
),
partition
p1
values
less
than
(
40
0
));
insert
into
t1
values
(
'a '
,
'b '
),(
'a'
,
'b'
);
insert
into
t1
values
(
'a '
,
'b '
),(
'a'
,
'b'
);
drop
table
t1
;
drop
table
t1
;
create
table
t1
(
a
varchar
(
10
)
charset
latin1
collate
latin1_bin
,
create
table
t1
(
a
varchar
(
10
)
charset
latin1
collate
latin1_bin
,
b
varchar
(
10
)
charset
latin1
collate
latin1_bin
)
b
varchar
(
10
)
charset
latin1
collate
latin1_bin
)
partition
by
range
(
length
(
a
)
*
length
(
b
))
partition
by
range
(
length
(
a
)
*
length
(
b
))
(
partition
p0
values
less
than
(
2
),
partition
p1
values
less
than
(
1
0
));
(
partition
p0
values
less
than
(
2
),
partition
p1
values
less
than
(
40
0
));
insert
into
t1
values
(
'a '
,
'b '
),(
'a'
,
'b'
);
insert
into
t1
values
(
'a '
,
'b '
),(
'a'
,
'b'
);
drop
table
t1
;
drop
table
t1
;
create
table
t1
(
a
varchar
(
10
)
charset
latin1
collate
latin1_bin
,
create
table
t1
(
a
varchar
(
10
)
charset
latin1
collate
latin1_bin
,
b
varchar
(
10
)
charset
latin1
collate
latin1_bin
,
c
int
)
b
varchar
(
10
)
charset
latin1
collate
latin1_bin
,
c
int
)
partition
by
range
(
length
(
a
)
*
c
)
partition
by
range
(
length
(
a
)
*
c
)
(
partition
p0
values
less
than
(
2
),
partition
p1
values
less
than
(
1
0
));
(
partition
p0
values
less
than
(
2
),
partition
p1
values
less
than
(
40
0
));
insert
into
t1
values
(
'a '
,
'b '
,
2
),(
'a'
,
'b'
,
3
);
insert
into
t1
values
(
'a '
,
'b '
,
2
),(
'a'
,
'b'
,
3
);
drop
table
t1
;
drop
table
t1
;
create
table
t1
(
a
varchar
(
10
)
charset
latin1
collate
latin1_bin
,
create
table
t1
(
a
varchar
(
10
)
charset
latin1
collate
latin1_bin
,
b
varchar
(
10
)
charset
latin1
collate
latin1_bin
,
c
int
)
b
varchar
(
10
)
charset
latin1
collate
latin1_bin
,
c
int
)
partition
by
range
(
c
*
length
(
a
))
partition
by
range
(
c
*
length
(
a
))
(
partition
p0
values
less
than
(
2
),
partition
p1
values
less
than
(
1
0
));
(
partition
p0
values
less
than
(
2
),
partition
p1
values
less
than
(
40
0
));
insert
into
t1
values
(
'a '
,
'b '
,
2
),(
'a'
,
'b'
,
3
);
insert
into
t1
values
(
'a '
,
'b '
,
2
),(
'a'
,
'b'
,
3
);
drop
table
t1
;
drop
table
t1
;
...
...
sql/ha_ndbcluster.cc
View file @
1cdf82e0
...
@@ -1899,7 +1899,10 @@ int ha_ndbcluster::peek_indexed_rows(const byte *record)
...
@@ -1899,7 +1899,10 @@ int ha_ndbcluster::peek_indexed_rows(const byte *record)
error
=
m_part_info
->
get_partition_id
(
m_part_info
,
&
part_id
,
&
func_value
);
error
=
m_part_info
->
get_partition_id
(
m_part_info
,
&
part_id
,
&
func_value
);
dbug_tmp_restore_column_map
(
table
->
read_set
,
old_map
);
dbug_tmp_restore_column_map
(
table
->
read_set
,
old_map
);
if
(
error
)
if
(
error
)
{
m_part_info
->
err_value
=
func_value
;
DBUG_RETURN
(
error
);
DBUG_RETURN
(
error
);
}
op
->
setPartitionId
(
part_id
);
op
->
setPartitionId
(
part_id
);
}
}
}
}
...
@@ -2534,7 +2537,10 @@ int ha_ndbcluster::write_row(byte *record)
...
@@ -2534,7 +2537,10 @@ int ha_ndbcluster::write_row(byte *record)
error
=
m_part_info
->
get_partition_id
(
m_part_info
,
&
part_id
,
&
func_value
);
error
=
m_part_info
->
get_partition_id
(
m_part_info
,
&
part_id
,
&
func_value
);
dbug_tmp_restore_column_map
(
table
->
read_set
,
old_map
);
dbug_tmp_restore_column_map
(
table
->
read_set
,
old_map
);
if
(
error
)
if
(
error
)
{
m_part_info
->
err_value
=
func_value
;
DBUG_RETURN
(
error
);
DBUG_RETURN
(
error
);
}
op
->
setPartitionId
(
part_id
);
op
->
setPartitionId
(
part_id
);
}
}
...
@@ -2726,6 +2732,7 @@ int ha_ndbcluster::update_row(const byte *old_data, byte *new_data)
...
@@ -2726,6 +2732,7 @@ int ha_ndbcluster::update_row(const byte *old_data, byte *new_data)
m_part_info
,
&
old_part_id
,
&
new_part_id
,
m_part_info
,
&
old_part_id
,
&
new_part_id
,
&
func_value
)))
&
func_value
)))
{
{
m_part_info
->
err_value
=
func_value
;
DBUG_RETURN
(
error
);
DBUG_RETURN
(
error
);
}
}
...
...
sql/ha_partition.cc
View file @
1cdf82e0
...
@@ -2670,7 +2670,10 @@ int ha_partition::write_row(byte * buf)
...
@@ -2670,7 +2670,10 @@ int ha_partition::write_row(byte * buf)
#endif
#endif
dbug_tmp_restore_column_map
(
table
->
read_set
,
old_map
);
dbug_tmp_restore_column_map
(
table
->
read_set
,
old_map
);
if
(
unlikely
(
error
))
if
(
unlikely
(
error
))
{
m_part_info
->
err_value
=
func_value
;
DBUG_RETURN
(
error
);
DBUG_RETURN
(
error
);
}
m_last_part
=
part_id
;
m_last_part
=
part_id
;
DBUG_PRINT
(
"info"
,
(
"Insert in partition %d"
,
part_id
));
DBUG_PRINT
(
"info"
,
(
"Insert in partition %d"
,
part_id
));
DBUG_RETURN
(
m_file
[
part_id
]
->
write_row
(
buf
));
DBUG_RETURN
(
m_file
[
part_id
]
->
write_row
(
buf
));
...
@@ -2719,6 +2722,7 @@ int ha_partition::update_row(const byte *old_data, byte *new_data)
...
@@ -2719,6 +2722,7 @@ int ha_partition::update_row(const byte *old_data, byte *new_data)
m_part_info
,
&
old_part_id
,
&
new_part_id
,
m_part_info
,
&
old_part_id
,
&
new_part_id
,
&
func_value
)))
&
func_value
)))
{
{
m_part_info
->
err_value
=
func_value
;
DBUG_RETURN
(
error
);
DBUG_RETURN
(
error
);
}
}
...
...
sql/partition_info.cc
View file @
1cdf82e0
...
@@ -855,7 +855,7 @@ void partition_info::print_no_partition_found(TABLE *table)
...
@@ -855,7 +855,7 @@ void partition_info::print_no_partition_found(TABLE *table)
if
(
part_expr
->
null_value
)
if
(
part_expr
->
null_value
)
buf_ptr
=
(
char
*
)
"NULL"
;
buf_ptr
=
(
char
*
)
"NULL"
;
else
else
longlong2str
(
part_expr
->
val_int
()
,
buf
,
longlong2str
(
err_value
,
buf
,
part_expr
->
unsigned_flag
?
10
:
-
10
);
part_expr
->
unsigned_flag
?
10
:
-
10
);
my_error
(
ER_NO_PARTITION_FOR_GIVEN_VALUE
,
MYF
(
0
),
buf_ptr
);
my_error
(
ER_NO_PARTITION_FOR_GIVEN_VALUE
,
MYF
(
0
),
buf_ptr
);
dbug_tmp_restore_column_map
(
table
->
read_set
,
old_map
);
dbug_tmp_restore_column_map
(
table
->
read_set
,
old_map
);
...
...
sql/partition_info.h
View file @
1cdf82e0
...
@@ -151,6 +151,7 @@ public:
...
@@ -151,6 +151,7 @@ public:
* INTERVAL ANALYSIS ENDS
* INTERVAL ANALYSIS ENDS
********************************************/
********************************************/
longlong
err_value
;
char
*
part_info_string
;
char
*
part_info_string
;
char
*
part_func_string
;
char
*
part_func_string
;
...
@@ -227,7 +228,7 @@ public:
...
@@ -227,7 +228,7 @@ public:
restore_full_part_field_ptrs
(
NULL
),
restore_full_part_field_ptrs
(
NULL
),
part_expr
(
NULL
),
subpart_expr
(
NULL
),
item_free_list
(
NULL
),
part_expr
(
NULL
),
subpart_expr
(
NULL
),
item_free_list
(
NULL
),
first_log_entry
(
NULL
),
exec_log_entry
(
NULL
),
frm_log_entry
(
NULL
),
first_log_entry
(
NULL
),
exec_log_entry
(
NULL
),
frm_log_entry
(
NULL
),
list_array
(
NULL
),
list_array
(
NULL
),
err_value
(
0
),
part_info_string
(
NULL
),
part_info_string
(
NULL
),
part_func_string
(
NULL
),
subpart_func_string
(
NULL
),
part_func_string
(
NULL
),
subpart_func_string
(
NULL
),
part_state
(
NULL
),
part_state
(
NULL
),
...
...
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