metamodel-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hans Drexler (JIRA)" <>
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


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

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

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

> MetaModel should fail when accessing a column that is not a select item
> -----------------------------------------------------------------------
>                 Key: METAMODEL-251
>                 URL:
>             Project: Apache MetaModel
>          Issue Type: Bug
>    Affects Versions: 4.5.2
>         Environment: Postgres
>            Reporter: Hans Drexler
>         Attachments:
> 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}
>              .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
> 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

View raw message