Kasper Sørensen created METAMODEL-87:
----------------------------------------

             Summary: ElasticSearch module does not return Date objects for 
columns with DATE type
                 Key: METAMODEL-87
                 URL: https://issues.apache.org/jira/browse/METAMODEL-87
             Project: Metamodel
          Issue Type: Bug
    Affects Versions: 4.3.0-incubating
            Reporter: Kasper Sørensen


It seems that the ElasticSearch module returns Strings instead of 
java.util.Date objects when you query a DATE type field. That's IMO 
inconsistent and should be fixed.

To reproduce, add this to ElasticSearchDataContextTest:

{code}
    @Test
    public void testDateIsHandledAsDate() throws Exception {
        Table table = dataContext.getDefaultSchema().getTableByName("tweet1");
        Column column = table.getColumnByName("postDate");
        ColumnType type = column.getType();
        assertEquals(ColumnType.DATE, type);

        DataSet dataSet = 
dataContext.query().from(table).select(column).execute();
        while (dataSet.next()) {
            Object value = dataSet.getRow().getValue(column);
            assertTrue("Got class: " + value.getClass() + ", expected Date (or 
subclass)", value instanceof Date);
        }
    }
{code}



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

Reply via email to