[ 
https://issues.apache.org/jira/browse/METAMODEL-1088?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15302257#comment-15302257
 ] 

ASF GitHub Bot commented on METAMODEL-1088:
-------------------------------------------

Github user kaspersorensen commented on the pull request:

    https://github.com/apache/metamodel/pull/106#issuecomment-221906499
  
    Wait what ... Hmm I see that this is actually a fix that works 
functionally, but will mean that if you use an alias then the query will not be 
optimized at all. Is that what we want? I can live with it, since functionality 
is more important than non-functionals. But some people could take a big 
performance hit over this if they use an alias. Would be better to fix that too.


> Aliases do not work for MongoDB modules
> ---------------------------------------
>
>                 Key: METAMODEL-1088
>                 URL: https://issues.apache.org/jira/browse/METAMODEL-1088
>             Project: Apache MetaModel
>          Issue Type: Bug
>    Affects Versions: 4.5.2
>            Reporter: Alberto
>            Priority: Minor
>
> Queries containing aliases do not work properly for MongoDB modules. The 
> SelectItems of the returned dataset are not containing the aliases.
> See below a unit test that is currently failing:
> public void testSelectWithAlias() throws Exception {
>         if (!isConfigured()) {
>             System.err.println(getInvalidConfigurationMessage());
>             return;
>         }
>         DBCollection col = db.createCollection(getCollectionName(), new 
> BasicDBObject());
>         // delete if already exists
>         {
>             col.drop();
>             col = db.createCollection(getCollectionName(), new 
> BasicDBObject());
>         }
>         final BasicDBObject dbRow = new BasicDBObject();
>         dbRow.append("name", new BasicDBObject().append("first", 
> "John").append("last", "Doe"));
>         dbRow.append("gender", "MALE");
>         col.insert(dbRow);
>         final MongoDbDataContext dc = new MongoDbDataContext(db, new 
> SimpleTableDef(getCollectionName(), new String[] {
>                 "name.first", "name.last", "gender", "addresses", 
> "addresses[0].city", "addresses[0].country",
>                 "addresses[5].foobar" }));
>         final DataSet ds1 = dc.executeQuery("select gender AS my_gender, 
> name.first AS my_name from my_collection where gender LIKE '%MALE%'");
>         final SelectItem[] selectItems = ds1.getSelectItems();
>         SelectItem firstSelectItem = selectItems[0];
>         SelectItem secondSelectItem = selectItems[1];
>         try {
>             assertNotNull(firstSelectItem.getAlias());
>             assertNotNull(secondSelectItem.getAlias());
>         } finally {
>             ds1.close();
>         }
>     }



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to