Rafael Garrote created METAMODEL-186:
----------------------------------------
Summary: CSV filters in where clause always apply to first file
column
Key: METAMODEL-186
URL: https://issues.apache.org/jira/browse/METAMODEL-186
Project: Apache MetaModel
Issue Type: Bug
Affects Versions: 4.3.2
Reporter: Rafael Garrote
The filters added into where clause always apply to first file column.
I made a test to reproduce the bug:
"CSV Metamodel" should {
"Filter test" in new Scope {
val context = DataContextFactory.createCsvDataContext(new
File("test/resources/csv_people.csv"), ',',
DataContextFactory.DEFAULT_CSV_QUOTE_CHAR)
val queryParser = new QueryParser(context, "SELECT * FROM csv_people.csv")
val filter = new FilterItem(new SelectItem(new MutableColumn("age",
ColumnType.STRING)), OperatorType.GREATER_THAN, 8)
val query = queryParser.parse()
val result = context.executeQuery(query.where(filter))
result.toRows.size() mustEqual 9
}
}
It must return 9 rows but returns 2 because the filter is applying to the firs
column id.
If replace filter object by this other one:
val filter = new FilterItem(new SelectItem(new MutableColumn("id",
ColumnType.STRING)), OperatorType.GREATER_THAN, 8)
The result is the same.
I have used the csv_people.csv included in test resources for csv module.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)