metamodel-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hans Drexler (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (METAMODEL-251) MetaModel should fail when accessing a column that is not a select item
Date Mon, 23 May 2016 14:37:12 GMT

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

Hans Drexler commented on METAMODEL-251:
----------------------------------------

I am getting unit test errors now, because MM code is relying on MM returning null for missing
SelectItem objects in some cases. In MetaModelHelper.getLeftJoin(...), when ds2 is empty,
MM uses a shortcut

{code}
if (ds2data.isEmpty()) {
            // no need to join, simply return a new view (with null values) on
            // the previous dataset.
            return getSelection(selectItems, ds1);
}
{code}

This shortcut is no longer valid, as it returns a DataSet that does not have header entries
for the columns of ds2 (the empty dataset). That used to work, but no longer... I'll try to
constriuct a dataset that correctly holds header items for all select items in the joined
DataSet.

> MetaModel should fail when accessing a column that is not a select item
> -----------------------------------------------------------------------
>
>                 Key: METAMODEL-251
>                 URL: https://issues.apache.org/jira/browse/METAMODEL-251
>             Project: Apache MetaModel
>          Issue Type: Bug
>    Affects Versions: 4.5.2
>         Environment: Postgres
>            Reporter: Hans Drexler
>         Attachments: MetaModel251Sample.java
>
>
> In our software, we create a query with SelectItems for 6 out of the 7 columns of a postgres
data base table. We actually forgot to add the seventh column as a SelectItem.
> {code}
>         query.select(selectItems)
>              .from(someTable)
> {code}
> When consuming the rows returned by this query, the code actually fetches the column
that was not a select item, using a construct like:
> {code}
> row.getValue(table.getColumnByName('foo'));
> {code}
> This returns null values most of the time. But under stress, the code starts to throw
exceptions. 
> It would be much better if MetaModel throws an exception when the code attempts to access
a column that is not part of the query (fail fast).



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

Mime
View raw message