The jsonify_document function is used in several places (including other odc packages) to convert certain value types to strings - notably, it is part of the json serializer function passed to create_engine for both the postgres and postgis drivers. Per the comment in _to_json, this seems to be due to postgres<=9.5 not supporting nan and infinite values, and so should no longer be necessary as part of indexing.
However, removing these string conversions will create an issue with the use of orjson, which serialises nan and +/-inf as null and does not provide any option to alter this behaviour, so it will need to be replaced with a different json library such as rapidjson. This would be slower than orjson, but it may very well be that any performance benefits provided by orjson are currently being offset by the performance hit of jsonify_document anyway.
It is also worth noting that jsonify_document is used to compare existing metadata type/product/dataset definition/metadata documents with new ones, so we would need to update the affected entries or implement some extra comparison logic.
The
jsonify_documentfunction is used in several places (including other odc packages) to convert certain value types to strings - notably, it is part of the json serializer function passed tocreate_enginefor both the postgres and postgis drivers. Per the comment in_to_json, this seems to be due to postgres<=9.5 not supporting nan and infinite values, and so should no longer be necessary as part of indexing.However, removing these string conversions will create an issue with the use of
orjson, which serialises nan and +/-inf as null and does not provide any option to alter this behaviour, so it will need to be replaced with a different json library such asrapidjson. This would be slower thanorjson, but it may very well be that any performance benefits provided byorjsonare currently being offset by the performance hit ofjsonify_documentanyway.It is also worth noting that
jsonify_documentis used to compare existing metadata type/product/dataset definition/metadata documents with new ones, so we would need to update the affected entries or implement some extra comparison logic.