fiware-cygnus icon indicating copy to clipboard operation
fiware-cygnus copied to clipboard

CKAN gives an error on attrValue of integer 0

Open reitsma opened this issue 4 years ago • 1 comments

When using row aggregation, CKAN (v2.8.5) does not accept a integer value of 0 as primitive json value. Other values are OK, so I think it is actually an issue in the datastore of CKAN due to a a lack of proper coercing. I don't speak Python very well and I don't understand the CKAN datastore, so it was easier for me to fix the problem in Cygnus: Converting integer 0 to string "0" fixes the problem. In Postgres the log message is: 2020-10-07 09:41:40 UTC ERROR: column "attrValue" is of type nested but expression is of type integer at character 335 2020-10-07 09:41:40 UTC HINT: You will need to rewrite or cast the expression. 2020-10-07 09:41:40 UTC STATEMENT: INSERT INTO "b1c48c57-0294-42d0-bb1d-0d1c00948d9b" ("recvTimeTs", "recvTime", "fiwareServicePath", "entityId", "entityType", "attrName", "attrType", "attrValue", "attrMd") VALUES ('1602063603', '2020-10-07T09:40:03.335Z', '/nl', '9a73e022-45e4-411f-8883-e0c4ce8834d1', 'OffStreetParking', 'availableSpotNumber', 'Number', 0, ('[{"type": "DateTime", "name": "timestamp", "value": "2020-10-07T09:39:20.00Z"}]', ''));

The issue occurred with the latest Cygnus code at commit 29e1d95fe483e748ada52656f1b2783460c609f5.

So, this is an issue, but it is either a bug in the CKAN datastore or in Cygnus. It all depends on the precise specs of the interface.

reitsma avatar Oct 07 '20 12:10 reitsma

.... , so it was easier for me to fix the problem in Cygnus

Do you mean you solved it in the Cygnus code? Maybe you could share the modification (in the form of pull request to this repository), please?

Thanks for the report!

fgalan avatar Nov 19 '20 12:11 fgalan