Return-Path: X-Original-To: apmail-metamodel-dev-archive@minotaur.apache.org Delivered-To: apmail-metamodel-dev-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 3BCB819913 for ; Wed, 9 Mar 2016 10:29:41 +0000 (UTC) Received: (qmail 12357 invoked by uid 500); 9 Mar 2016 10:29:41 -0000 Delivered-To: apmail-metamodel-dev-archive@metamodel.apache.org Received: (qmail 12339 invoked by uid 500); 9 Mar 2016 10:29:41 -0000 Mailing-List: contact dev-help@metamodel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@metamodel.apache.org Delivered-To: mailing list dev@metamodel.apache.org Received: (qmail 12325 invoked by uid 99); 9 Mar 2016 10:29:40 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 09 Mar 2016 10:29:40 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id CA2972C044E for ; Wed, 9 Mar 2016 10:29:40 +0000 (UTC) Date: Wed, 9 Mar 2016 10:29:40 +0000 (UTC) From: "Alessandro Portosa (JIRA)" To: dev@metamodel.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Created] (METAMODEL-238) Error when using GROUPBY and ORBERBY with different fields MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 Alessandro Portosa created METAMODEL-238: -------------------------------------------- Summary: Error when using GROUPBY and ORBERBY with different fields Key: METAMODEL-238 URL: https://issues.apache.org/jira/browse/METAMODEL-238 Project: Apache MetaModel Issue Type: Bug Affects Versions: 4.5.1 Reporter: Alessandro Portosa MetaModel does not act as expected when providing it a different field for GROUPING and ORDERING. Let's say the we have a table with the following columns: total_children, city, country. 1) If i use "SELECT SUM(total_children) AS total_children_SUM, city AS city FROM schema.table GROUP BY city" I get the right results. 2) If i use "SELECT SUM(total_children) AS total_children_SUM , city AS city FROM schema.table GROUP BY city ORDER BY city asc" then I get the right results. 3) But if I use "SELECT SUM(total_children) AS total_children_SUM, city AS city FROM schema.table GROUP BY city ORDER BY country asc" I get the wrong results. I do get results, but these are the same as 1) where no ordering was required. The same happen with I use any other field that is not city (which is the field that I'm using for the grouping). This is how I use it: Query query = dataContext.parseQuery(sqlQuery); CompiledQuery cQuery = dataContext.compileQuery(query); DataSet dataSet = dataContext.executeQuery(cQuery); The used DataContext is a PojoDataContext. No error or exception. Just wrong data. -- This message was sent by Atlassian JIRA (v6.3.4#6332)