Je Majeures Ver 8.0.3-rc pour Linux sur x86_64 (MySQL Community Server (GPL))MySQL 8 Fonctions de fenêtre + texte intégral recherche
Créer une table et l'index de texte intégral sur la colonne Nom
CREATE TABLE `title` (
`id` smallint(4) unsigned NOT NULL PRIMARY KEY,
`name` text COLLATE utf8_unicode_ci,
FULLTEXT idx (name) WITH PARSER ngram
) DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
Insérer des données:
insert into `title` values(14,"I'm flying in for the game (one night in Niagara Falls, NY and one night in Buffalo then back home).");
insert into `title` values(23,"I've never been to the area.");
insert into `title` values(43,"Where and what must I eat (Canadian side of Niagara, American side and Buffalo)?");
insert into `title` values(125,"Don't really have much planned other than the Falls and the game.");
Quand exécuter:
select
id,
round(MATCH (name) AGAINST ('other than the'),2) scope
from title;
Résultat (tout ok):
id | scope
----------
14 | 0.43
23 | 0.23
43 | 0.12
125 | 1.15
Lorsque l'utilisation classique GROUP BY - tous ok
select
max(scope),
min(scope),
sum(scope)
from
(
select id, round(MATCH (name) AGAINST ('other than the'),2) scope
from title
) a;
résultat ok:
max | min | sum
----------------
1.15 | 0.12 | 1.96
Mais quand je tente utiliser la fonction de la fenêtre sur Je ne comprends pas:
select
id,
max(scope) over(),
min(scope) over(),
sum(scope) over()
from
(
select id, round(MATCH (name) AGAINST ('other than the'),2) scope
from title
) a;
-je obtenir un résultat étrange (POURQUOI?):
id | max | min | sum
------------------------
14 | 1.15 | 1.15 | 4.60
23 | 1.15 | 1.15 | 4.60
43 | 1.15 | 1.15 | 4.60
125| 1.15 | 1.15 | 4.60
J'espère obtenir des résultats similaires au groupe classique par, comme:
id | max | min | sum
------------------------
14 | 1.15 | 0.12 | 1.96
23 | 1.15 | 0.12 | 1.96
43 | 1.15 | 0.12 | 1.96
125| 1.15 | 0.12 | 1.96
Est-ce un bogue dans MySQL Ver-8.0.3 rc ou incorrect ma requête? Merci!
Votre résultat me semble étrange. Je m'attendrais également à la même sortie que vous attendez. –
Votre observation est correcte. C'est un bug qui a été corrigé après la sortie de 8.0.3-rc. -Dag (MySQL dev) – DagW