typhon-project / typhonql

Typhon Query Language
Eclipse Public License 2.0
4 stars 1 forks source link

Prepared statements Float/DateTime (Document stores) insert failure [BUG] #103

Closed barmpis closed 3 years ago

barmpis commented 3 years ago

Describe the bug

Inserting floats or datetimes in prepared statements fails for document stores.

Query

{
 "query": "insert VehicleWeatherData { VIN:??VIN, timestamp:??timestamp, temperature:??temperature }",
 "parameterNames": ["VIN", "timestamp", "temperature"],
 "parameterTypes": ["int", "datetime", "float"],
 "boundRows": [
   ["123", "2020-10-30T14:28:00Z", "3.0"]
 ]
}

Model

entity VehicleWeatherData {
    VIN: int    
    timeStamp : datetime
    temperature: float
}

documentdb DocumentDB {
    collections {
        vehicleWeatherData : VehicleWeatherData 
    }
}

Expected behavior

Insertion of the entity.

Screenshots

n/a

IDE

n/a

REST API

If the bug happens when calling the REST API:

query sent normally, error reported (detailed below)

Additional context

server errors:

typhonql-server_1 | org.bson.json.JsonParseException: JSON reader expected a string but found '1604068141000'. typhonql-server_1 | (internal error) typhonql-server_1 | at $typhonql$(|main://$typhonql$|) typhonql-server_1 | typhonql-server_1 | org.bson.json.JsonParseException: JSON reader expected a string but found '1604068141000'. typhonql-server_1 | at org.bson.json.JsonReader.readStringFromExtendedJson(JsonReader.java:1178)

typhonql-server_1 | java.lang.RuntimeException: Query executor does not know how to serialize object of type class java.lang.Float typhonql-server_1 | (internal error) typhonql-server_1 | at $typhonql$(|main://$typhonql$|) typhonql-server_1 | typhonql-server_1 | java.lang.RuntimeException: Query executor does not know how to serialize object of type class java.lang.Float typhonql-server_1 | at nl.cwi.swat.typhonql.backend.mongodb.MongoDBEngine.serialize(MongoDBEngine.java:143)

DavyLandman commented 3 years ago

Thanks for reporting, I've just pushed the fix for this issue.