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

emesika at redhat.com emesika at redhat.com
Wed Mar 11 08:37:24 UTC 2015


Eli Mesika 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
  Omer Frenkel: Looks good to me, approved
  Liran Zelkha: Looks good to me, but someone else must approve



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

Gerrit-MessageType: merged
Gerrit-Change-Id: I7c036b2b9ee94266b6e3df54f2c50167e454ed6a
Gerrit-PatchSet: 6
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
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