Change in ovirt-engine[ovirt-engine-3.5]: core: do not use distinct if sort expr have func

oourfali at redhat.com oourfali at redhat.com
Wed Mar 11 15:36:59 UTC 2015


Oved Ourfali has submitted this change and it was merged.

Change subject: core: do not use distinct if sort expr have func
......................................................................


core: do not use distinct if sort expr have func

A former patch made by Omer F added distinct to the search in order to
prevent duplicates.
In the case the search is in the format :

SELECT DISTINCT * FROM T .... ORDER BY f({arguments})

There is a problem since the DISTINCT is performed first and then the
sorting, so f is unknown since it is not part of the result set.

This patch checks if the sort clause has a function call and removes the
DISTINCT if it finds one.

Also added a unit test for this case.

Change-Id: I7c036b2b9ee94266b6e3df54f2c50167e454ed6a
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1198506
Signed-off-by: emesika <emesika at redhat.com>
---
M backend/manager/modules/searchbackend/src/main/java/org/ovirt/engine/core/searchbackend/SyntaxChecker.java
M backend/manager/modules/searchbackend/src/test/java/org/ovirt/engine/core/searchbackend/SyntaxCheckerTest.java
2 files changed, 16 insertions(+), 7 deletions(-)

Approvals:
  Eli Mesika: Verified
  Oved Ourfali: Looks good to me, approved



-- 
To view, visit https://gerrit.ovirt.org/38492
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I7c036b2b9ee94266b6e3df54f2c50167e454ed6a
Gerrit-PatchSet: 2
Gerrit-Project: ovirt-engine
Gerrit-Branch: ovirt-engine-3.5
Gerrit-Owner: Eli Mesika <emesika at redhat.com>
Gerrit-Reviewer: Eli Mesika <emesika at redhat.com>
Gerrit-Reviewer: Liran Zelkha <lzelkha at redhat.com>
Gerrit-Reviewer: Omer Frenkel <ofrenkel at redhat.com>
Gerrit-Reviewer: Oved Ourfali <oourfali at redhat.com>
Gerrit-Reviewer: automation at ovirt.org
Gerrit-Reviewer: oVirt Jenkins CI Server



More information about the Engine-commits mailing list