-
Notifications
You must be signed in to change notification settings - Fork 6
Make CleanInt CleanNumeric parallel safe #2
Conversation
nyurik
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good, thanks! two minor cleanups, and this is good to go.
|
@klokan could you enable https://travis-ci.org/openmaptiles/postgis-vt-util to run this? Thanks! |
Co-Authored-By: Yuri Astrakhan <yuriastrakhan@gmail.com>
|
@nyurik thanks for your feedback 🤗 @eva-j @MartinMikita let me know if there's anything else I can do to improve this PR. After this, we can update the function in the OpenMapTiles repo as a simple |
nyurik
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks, awesome work!
|
Out of curiosity: Which query / function uses CleanInt(text)? |
|
@sfkeller this is a generic library of SQL functions. In the context of OpenMapTiles |
I realized that I skipped
CleanIntandCleanNumericon my last PR 😞. These two functions implemented the same approach as theas_numericon OpenMapTiles repo, with the only difference being that these returnNULLinstead of-1. The approach of using an exception avoids running them in parallel.Hence, I decided to bring the regular expression approach to these functions I proposed on openmaptiles/openmaptiles#728. Here there is already a testing mechanism, so I added more checks to ensure more cases are covered. I also improved a bit the tests to allow compare rounded results against a given number of decimals, instead of using
floor.Finally, I updated the Travis configuration, since the current one was not working properly. This took more than expected (in fact ended up almost using the same configuration used at CartoDB/cartodb-postgresql, but the outcome is good in my opinion, since we now can test all the functions in PostGIS 2.5 on Postgres 9.6, 10, 11, and 12 and PostGIS 3 on 12. You can see the build execution in my Travis account.
I also found another issue, the function
OrientedEnvelope, equivalent to PostGIS 3ST_OrientedEnvelopebut implemented in SQL, yields different results in PostGIS 2.5 and 3. I haven't put time debugging the algorithm, we may want to open a new issue for this, but not sure about how much is worth, being PostGIS 3 the current stable release.If this PR is merged, we can then make OpenMapTiles
as_numericto be just a wrapper to return a-1, or if it makes more sense, just replace the function to useCleanNumericI actually prefer a function like this to return anullvalue instead of a value that is a valid input.cc. @nyurik