Details
-
Bug
-
Status: Open
-
Minor
-
Resolution: Unresolved
-
4.5.0
-
None
-
None
Description
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:
Query selectAllQuery = dataContext.query() .from(TABLE) .selectAll() .where(FunctionType.TO_NUMBER, COLUMN).lessThan(lessThanNumber) .toQuery();
... may not equal the count from the following:
Query selectCountQuery = dataContext.query() .from(TABLE) .selectCount() .where(FunctionType.TO_NUMBER, COLUMN).lessThan(lessThanNumber) .toQuery();
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.