python-pinot-dbapi / pinot-dbapi

Python DB-API and SQLAlchemy dialect for Pinot
MIT License
20 stars 33 forks source link

Enhancement: Parse string results #9

Open MrNeocore opened 3 years ago

MrNeocore commented 3 years ago

Proposition: Enhancement

In some cases, the Pinot Broker REST API returns string values [e.g. "Infinity"] as results (as part of rows) when the value cannot be represented as a JSON "number".

To improve predictability from the Python client, should we parse this output string(s) as a Python native numeric type ?

Simply parsing with float should cover many cases and allow for more "natural" handling of Pinot's results from Python.

Should we apply a similar approach to parsing for other types ? (which ones ?)

xiangfu0 commented 3 years ago

Agreed. We should handle this case base on the python type and value.

MrNeocore commented 3 years ago

@xiangfu0 Alright, I'll have a deeper look at the code and ready a PR !