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
a756bfd4
Commit
a756bfd4
authored
Nov 30, 2007
by
holyfoot/hf@hfmain.(none)
Browse files
Options
Browse Files
Download
Plain Diff
Merge mysql.com:/home/hf/work/31890/my51-31890
into mysql.com:/home/hf/work/mrg/my51-mrg
parents
baeea12b
a2f08506
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
79 additions
and
24 deletions
+79
-24
include/queues.h
include/queues.h
+3
-3
mysql-test/r/partition.result
mysql-test/r/partition.result
+35
-0
mysql-test/t/partition.test
mysql-test/t/partition.test
+26
-0
mysys/queues.c
mysys/queues.c
+15
-21
No files found.
include/queues.h
View file @
a756bfd4
...
...
@@ -31,8 +31,8 @@ typedef struct st_queue {
void
*
first_cmp_arg
;
uint
elements
;
uint
max_elements
;
uint
offset_to_key
;
/* compare is done on element+offset */
int
max_at_top
;
/* Set
if queue_top gives max */
uint
offset_to_key
;
/* compare is done on element+offset */
int
max_at_top
;
/* Normally 1, set to -1
if queue_top gives max */
int
(
*
compare
)(
void
*
,
uchar
*
,
uchar
*
);
uint
auto_extent
;
}
QUEUE
;
...
...
@@ -43,7 +43,7 @@ typedef struct st_queue {
#define queue_replaced(queue) _downheap(queue,1)
#define queue_set_cmp_arg(queue, set_arg) (queue)->first_cmp_arg= set_arg
#define queue_set_max_at_top(queue, set_arg) \
(queue)->max_at_top= set_arg ?
(-1 ^ 1) : 0
(queue)->max_at_top= set_arg ?
-1 : 1
typedef
int
(
*
queue_compare
)(
void
*
,
uchar
*
,
uchar
*
);
int
init_queue
(
QUEUE
*
queue
,
uint
max_elements
,
uint
offset_to_key
,
...
...
mysql-test/r/partition.result
View file @
a756bfd4
...
...
@@ -1303,4 +1303,39 @@ select c1 from t1 group by (select c0 from t1 limit 1);
c1
-6862346
drop table t1;
CREATE TABLE t1
(int_column INT, char_column CHAR(5),
PRIMARY KEY(char_column,int_column))
PARTITION BY KEY(char_column,int_column)
PARTITIONS 101;
INSERT INTO t1 (int_column, char_column) VALUES
( 39868 ,'zZZRW'),
( 545592 ,'zZzSD'),
( 4936 ,'zzzsT'),
( 9274 ,'ZzZSX'),
( 970185 ,'ZZzTN'),
( 786036 ,'zZzTO'),
( 37240 ,'zZzTv'),
( 313801 ,'zzzUM'),
( 782427 ,'ZZZva'),
( 907955 ,'zZZvP'),
( 453491 ,'zzZWV'),
( 756594 ,'ZZZXU'),
( 718061 ,'ZZzZH');
SELECT * FROM t1 ORDER BY char_column DESC;
int_column char_column
718061 ZZzZH
756594 ZZZXU
453491 zzZWV
907955 zZZvP
782427 ZZZva
313801 zzzUM
37240 zZzTv
786036 zZzTO
970185 ZZzTN
9274 ZzZSX
4936 zzzsT
545592 zZzSD
39868 zZZRW
DROP TABLE t1;
End of 5.1 tests
mysql-test/t/partition.test
View file @
a756bfd4
...
...
@@ -1551,4 +1551,30 @@ insert ignore into t1 set c0 = 241221, c1 = -6862346, c2 = 56644;
select
c1
from
t1
group
by
(
select
c0
from
t1
limit
1
);
drop
table
t1
;
#
# Bug #31890 Partitions: ORDER BY DESC in InnoDB not working
#
CREATE
TABLE
t1
(
int_column
INT
,
char_column
CHAR
(
5
),
PRIMARY
KEY
(
char_column
,
int_column
))
PARTITION
BY
KEY
(
char_column
,
int_column
)
PARTITIONS
101
;
INSERT
INTO
t1
(
int_column
,
char_column
)
VALUES
(
39868
,
'zZZRW'
),
(
545592
,
'zZzSD'
),
(
4936
,
'zzzsT'
),
(
9274
,
'ZzZSX'
),
(
970185
,
'ZZzTN'
),
(
786036
,
'zZzTO'
),
(
37240
,
'zZzTv'
),
(
313801
,
'zzzUM'
),
(
782427
,
'ZZZva'
),
(
907955
,
'zZZvP'
),
(
453491
,
'zzZWV'
),
(
756594
,
'ZZZXU'
),
(
718061
,
'ZZzZH'
);
SELECT
*
FROM
t1
ORDER
BY
char_column
DESC
;
DROP
TABLE
t1
;
--
echo
End
of
5.1
tests
mysys/queues.c
View file @
a756bfd4
...
...
@@ -61,7 +61,7 @@ int init_queue(QUEUE *queue, uint max_elements, uint offset_to_key,
queue
->
first_cmp_arg
=
first_cmp_arg
;
queue
->
max_elements
=
max_elements
;
queue
->
offset_to_key
=
offset_to_key
;
queue
->
max_at_top
=
max_at_top
?
(
-
1
^
1
)
:
0
;
queue
_set_max_at_top
(
queue
,
max_at_top
)
;
DBUG_RETURN
(
0
);
}
...
...
@@ -137,7 +137,7 @@ int reinit_queue(QUEUE *queue, uint max_elements, uint offset_to_key,
queue
->
compare
=
compare
;
queue
->
first_cmp_arg
=
first_cmp_arg
;
queue
->
offset_to_key
=
offset_to_key
;
queue
->
max_at_top
=
max_at_top
?
(
-
1
^
1
)
:
0
;
queue
_set_max_at_top
(
queue
,
max_at_top
)
;
resize_queue
(
queue
,
max_elements
);
DBUG_RETURN
(
0
);
}
...
...
@@ -208,16 +208,14 @@ void delete_queue(QUEUE *queue)
void
queue_insert
(
register
QUEUE
*
queue
,
uchar
*
element
)
{
reg2
uint
idx
,
next
;
int
cmp
;
DBUG_ASSERT
(
queue
->
elements
<
queue
->
max_elements
);
queue
->
root
[
0
]
=
element
;
idx
=
++
queue
->
elements
;
/* max_at_top swaps the comparison if we want to order by desc */
while
((
cmp
=
queue
->
compare
(
queue
->
first_cmp_arg
,
element
+
queue
->
offset_to_key
,
queue
->
root
[(
next
=
idx
>>
1
)]
+
queue
->
offset_to_key
))
&&
(
cmp
^
queue
->
max_at_top
)
<
0
)
while
((
queue
->
compare
(
queue
->
first_cmp_arg
,
element
+
queue
->
offset_to_key
,
queue
->
root
[(
next
=
idx
>>
1
)]
+
queue
->
offset_to_key
)
*
queue
->
max_at_top
)
<
0
)
{
queue
->
root
[
idx
]
=
queue
->
root
[
next
];
idx
=
next
;
...
...
@@ -287,19 +285,17 @@ void _downheap(register QUEUE *queue, uint idx)
while
(
idx
<=
half_queue
)
{
int
cmp
;
next_index
=
idx
+
idx
;
if
(
next_index
<
elements
&&
(
queue
->
compare
(
queue
->
first_cmp_arg
,
queue
->
root
[
next_index
]
+
offset_to_key
,
queue
->
root
[
next_index
+
1
]
+
offset_to_key
)
^
queue
->
root
[
next_index
+
1
]
+
offset_to_key
)
*
queue
->
max_at_top
)
>
0
)
next_index
++
;
if
(
first
&&
(((
cmp
=
queue
->
compare
(
queue
->
first_cmp_arg
,
queue
->
root
[
next_index
]
+
offset_to_key
,
element
+
offset_to_key
))
==
0
)
||
((
cmp
^
queue
->
max_at_top
)
>
0
)))
(((
queue
->
compare
(
queue
->
first_cmp_arg
,
queue
->
root
[
next_index
]
+
offset_to_key
,
element
+
offset_to_key
)
*
queue
->
max_at_top
)
>=
0
)))
{
queue
->
root
[
idx
]
=
element
;
return
;
...
...
@@ -314,7 +310,7 @@ void _downheap(register QUEUE *queue, uint idx)
{
if
((
queue
->
compare
(
queue
->
first_cmp_arg
,
queue
->
root
[
next_index
]
+
offset_to_key
,
element
+
offset_to_key
)
^
element
+
offset_to_key
)
*
queue
->
max_at_top
)
<
0
)
break
;
queue
->
root
[
idx
]
=
queue
->
root
[
next_index
];
...
...
@@ -334,7 +330,6 @@ void _downheap(register QUEUE *queue, uint idx)
{
uchar
*
element
;
uint
elements
,
half_queue
,
next_index
,
offset_to_key
;
int
cmp
;
offset_to_key
=
queue
->
offset_to_key
;
element
=
queue
->
root
[
idx
];
...
...
@@ -346,13 +341,12 @@ void _downheap(register QUEUE *queue, uint idx)
if
(
next_index
<
elements
&&
(
queue
->
compare
(
queue
->
first_cmp_arg
,
queue
->
root
[
next_index
]
+
offset_to_key
,
queue
->
root
[
next_index
+
1
]
+
offset_to_key
)
^
queue
->
root
[
next_index
+
1
]
+
offset_to_key
)
*
queue
->
max_at_top
)
>
0
)
next_index
++
;
if
((
cmp
=
queue
->
compare
(
queue
->
first_cmp_arg
,
queue
->
root
[
next_index
]
+
offset_to_key
,
element
+
offset_to_key
))
==
0
||
(
cmp
^
queue
->
max_at_top
)
>
0
)
if
((
queue
->
compare
(
queue
->
first_cmp_arg
,
queue
->
root
[
next_index
]
+
offset_to_key
,
element
+
offset_to_key
)
*
queue
->
max_at_top
)
>=
0
)
break
;
queue
->
root
[
idx
]
=
queue
->
root
[
next_index
];
idx
=
next_index
;
...
...
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