mirror of
https://github.com/MariaDB/server.git
synced 2025-08-07 00:04:31 +03:00
MDEV-35296 DESC does not work in ORDER BY with vector key
only user vector indexes for ORDER BY ... ASC
This commit is contained in:
@@ -356,3 +356,16 @@ a vec_totext(v)
|
|||||||
8 [33]
|
8 [33]
|
||||||
9 [33]
|
9 [33]
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
#
|
||||||
|
# MDEV-35296 DESC does not work in ORDER BY with vector key
|
||||||
|
#
|
||||||
|
create table t (v vector(1) not null, vector(v));
|
||||||
|
insert into t select vec_fromtext(concat('[',seq,']')) FROM seq_1_to_10;
|
||||||
|
select vec_totext(v) from t order by vec_distance_euclidean(v,vec_fromtext('[0]')) desc limit 5;
|
||||||
|
vec_totext(v)
|
||||||
|
[10]
|
||||||
|
[9]
|
||||||
|
[8]
|
||||||
|
[7]
|
||||||
|
[6]
|
||||||
|
drop table t;
|
||||||
|
@@ -257,3 +257,11 @@ update t1 set v = vec_fromtext(concat('[33]')) where a <= 15;
|
|||||||
--sorted_result
|
--sorted_result
|
||||||
select a, vec_totext(v) from t1 order by vec_distance_euclidean(v,vec_fromtext('[33]')) limit 25;
|
select a, vec_totext(v) from t1 order by vec_distance_euclidean(v,vec_fromtext('[33]')) limit 25;
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # MDEV-35296 DESC does not work in ORDER BY with vector key
|
||||||
|
--echo #
|
||||||
|
create table t (v vector(1) not null, vector(v));
|
||||||
|
insert into t select vec_fromtext(concat('[',seq,']')) FROM seq_1_to_10;
|
||||||
|
select vec_totext(v) from t order by vec_distance_euclidean(v,vec_fromtext('[0]')) desc limit 5;
|
||||||
|
drop table t;
|
||||||
|
@@ -26486,7 +26486,7 @@ static int test_if_order_by_key(JOIN *join, ORDER *order, TABLE *table,
|
|||||||
|
|
||||||
if ((*order->item)->real_item()->type() != Item::FIELD_ITEM)
|
if ((*order->item)->real_item()->type() != Item::FIELD_ITEM)
|
||||||
{
|
{
|
||||||
if (order->next)
|
if (order->next || order->direction != ORDER::ORDER_ASC)
|
||||||
DBUG_RETURN(0);
|
DBUG_RETURN(0);
|
||||||
|
|
||||||
DBUG_RETURN((*order->item)->part_of_sortkey().is_set(idx));
|
DBUG_RETURN((*order->item)->part_of_sortkey().is_set(idx));
|
||||||
|
Reference in New Issue
Block a user