You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sometimes query based on a cross shard aggregation shows a bad result, where not all shards are hit.
Reproduction Steps
Prepare for a keyspace with 2 shards
Deploy the following vschema:
alter vschema on aggt0 add vindex xxhash (shardkey) using xxhash;
Deploy the following schema:
createtableaggt0 (
shardkey bigintprimary key,
a int,
b int
);
insert into aggt0 (shardkey, a, b) values (0, 100, 10), (10, 200, 20);
Please notice that shardkey of 0 goes to 80- shard and that of 10 does to -80.
Run Query
mysql>selectA.a, A.b, (A.a/A.b) as d from (selectsum(a) as a, sum(b) as b from aggt0) A;
+------+------+---------+
| a | b | d |
+------+------+---------+
| 300 | 30 | 10.0000 |
+------+------+---------+1 row inset (0.13 sec)
This is absolutely good.
However, when the subquery hit not both but one shard, it may show a bad result.
Please repeat the query until you have the bad result.
the expected result
mysql>selectA.a, A.b, (A.a/A.b) as d from (selectsum(a) as a, sum(b) as b from aggt0 where a =100) A;
+------+------+---------+
| a | b | d |
+------+------+---------+
| 100 | 10 | 10.0000 |
+------+------+---------+1 row inset (0.00 sec)
the unexpected result
mysql>selectA.a, A.b, (A.a/A.b) as d from (selectsum(a) as a, sum(b) as b from aggt0 where a =100) A;
+------+------+------+
| a | b | d |
+------+------+------+
| 100 | 10 | NULL |
+------+------+------+1 row inset (0.01 sec)
Binary Version
14.0.4
Operating System and Environment details
unrelated
Log Fragments
N/A
The text was updated successfully, but these errors were encountered:
Overview of the Issue
Sometimes query based on a cross shard aggregation shows a bad result, where not all shards are hit.
Reproduction Steps
Prepare for a keyspace with 2 shards
Deploy the following vschema:
alter vschema on aggt0 add vindex xxhash (shardkey) using xxhash;
Please notice that
shardkey
of0
goes to80-
shard and that of10
does to-80
.This is absolutely good.
However, when the subquery hit not both but one shard, it may show a bad result.
Please repeat the query until you have the bad result.
Binary Version
Operating System and Environment details
Log Fragments
The text was updated successfully, but these errors were encountered: