Michael Diep created METAMODEL-232:
--------------------------------------

             Summary: Incorrect Select Count Using Where Clause with Type 
Conversion
                 Key: METAMODEL-232
                 URL: https://issues.apache.org/jira/browse/METAMODEL-232
             Project: Apache MetaModel
          Issue Type: Bug
    Affects Versions: 4.5.0
            Reporter: Michael Diep
            Priority: Minor


I've found an issue where using select count in a query where columns have been 
converted from a String does not return the correct result. However, when 
running the same query with a select *, the correct number of Rows will be in 
the DataSet.

In other words, the number of Rows from the following:
{code}
Query selectAllQuery = dataContext.query()
                .from(TABLE)
                .selectAll()
                .where(FunctionType.TO_NUMBER, COLUMN).lessThan(lessThanNumber)
                .toQuery();
{code}

... may not equal the count from the following:
{code}
Query selectCountQuery = dataContext.query()
                .from(TABLE)
                .selectCount()
                .where(FunctionType.TO_NUMBER, COLUMN).lessThan(lessThanNumber)
                .toQuery();
{code}

The issue seems to be due to the select count query making comparisons based on 
the actual column type (a String) against a given operand (a non-String).

I've only tested this with Excel, but I imagine it could happen with any 
DataContext where all of the data types are read as Strings (e.g. CSV).

I will attach a test with a sample file that showcases the issue.



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

Reply via email to