metamodel-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ashish Mukherjee <ashish.mukher...@gmail.com>
Subject Re: Bug in filter query execution
Date Sun, 29 Mar 2015 04:09:21 GMT
Well, I am using a CsvDataContext with an id column. Hence, data type is
not really defined in a meta-data schema (which it would be for a RDBMS).
Hence, the expected behaviour would be to use the data type of the value
provided. If the column meta-data mentions that it is a different type,
then the expected behaviour would be to cast the value and do a comparison
IMO.

eg. if id was a string field in a db table and I provide an Integer filter
(say, 1). Then, the value of the id field should be cast to int and
compared against 1.

Other way to look at it is that the field meta-data should override the
type that is passed. This is not how RDBMS works though, so may not be the
expected behaviour.

Shall I report this as an issue?

On Sat, Mar 28, 2015 at 11:57 PM, Kasper Sørensen <
i.am.kasper.sorensen@gmail.com> wrote:

> Hmm not really sure. It's a good cause for discussion maybe. I am guessing
> that your "id" column is of some String type and not a number type. So when
> doing a filter on it MetaModel recognizes that you have passed a different
> type (Integer). In this case it "solves" the issue by using the
> ToStringComparator. Whether it's a feature, a bug or a place for
> improvement ... I am not sure. What do you think?
>
> 2015-03-27 13:24 GMT+01:00 Ashish Mukherjee <ashish.mukherjee@gmail.com>:
>
> > Hello,
> >
> > I am running a query with the following code snippet -
> >
> > ....
> >
> > Table[] tables = schema.getTables();
> >
> > DataSet ds =
> >
> >
> dataContext.query().from(tables[0]).select("id").where("id").greaterThan(new
> > Integer(1)).execute();
> >
> > while (ds.next()) {
> > Row row = ds.getRow();
> > System.out.println(row.getValue(0));
> > }
> >
> > However, I see this log message -
> >
> > 54 [main] INFO org.apache.metamodel.util.ObjectComparator - Using
> > ToStringComparator because no better comparison method could be found
> >
> > Is this issue being looked at or should it be reported/fixed?
> >
> > Regards,
> > Ashish
> >
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message