Uploaded image for project: 'Calcite'
  1. Calcite
  2. CALCITE-286

Error casting MongoDB date

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • None
    • None

    Description

      I was able to install and test out the latest version of optiq and mongodb using the test zips model you have, and even managed to test direct JDBC access programatically and through Quantum DB in eclipse. I setup a basic mapping for my own schema and simple queries seemed to work. However, I've hit a snag while mapping a Date column/property.

      While testing from SQLine I'm getting a java.lang.ClassCastException: java.util.Date cannot be cast to java.lang.Integer.

      I'm using Spring Data's Mongo driver to persist data, and it seems the Date property is recognized as type java.util.Date and JSON encoded properly as ISODate.

      {
      "_id" : ObjectId("53655599e4b0c980df0a8c27"),
      "_class" : "com.ericblue.Test",
      "date" : ISODate("2012-09-05T07:00:00Z"),
      "value" : 1231,
      "ownerId" : "531e7789e4b0853ddb861313"
      }

      and in the model I'm doing cast(_map[\'date\'] AS DATE) AS \"date\"

      Is this an issue with the date format? I'm tried casting as TIMESTAMP as well, and get a similar issue but it's casting as a Float rather than an Integer.

      ---------------- Imported from GitHub ----------------
      Url: https://github.com/julianhyde/optiq/issues/286
      Created by: ericblue
      Labels:
      Created at: Thu May 22 01:33:15 CEST 2014
      State: closed

      Attachments

        Activity

          People

            Unassigned Unassigned
            github-import GitHub Import
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: