-
Notifications
You must be signed in to change notification settings - Fork 590
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FEAT: Add support for Postgres UDFs #1871
Conversation
|
It appears that some of the failures were due to...
|
|
Figured out why it's probably failing on the conda build. The conda build doesn't spin up the backends and is supposed to exclude tests that rely on them. It excludes things marked with |
|
Aha, I figured out that the Windows tests use a different installation of Postgres, one which does not include any extensions (neither PostGIS nor pl/python). The Windows pipeline was already excluding postgis tests. I tweaked my tests to not try enabling PL/Python by default, and I added I included the updated I am eager to hear feedback from the community. |
|
@scottcode Wow, this is really interesting, thanks for doing this. I'm going to review a bit today, and then the rest over the weekend. |
|
Hmm, this is frustrating. I fixed the Windows issues, rebased on Master, and now the linux stuff fails, but only for geospatial-related stuff (not my new UDF code). I'll try to figure this out, but I'm certainly confused at the moment. |
|
@scottcode Don't spend any time on fixing the geospatial stuff, I'm about to merge #1872 which should fix it. |
|
Thanks @cpcloud for all the great feedback! I just wanted to call out separately how much I appreciate it. I'm starting to make my way through all of it. |
|
@cpcloud I've addressed most of your comments and pushed a new version. The |
|
@cpcloud Looks like there's some problem with the Azure pipeline setup. Looking at the logs it says
|
91f22bc
to
774f201
Compare
|
@cpcloud All the CI tests passed, and I believe I've addressed all the changes you've requested so far. Are there any others you'd like me to make? |
1426d28
to
62c2751
Compare
|
The only errors at this point are in the Lint step (only in Windows Python 3.6 and 3.7). It is unclear to me why it is erroring out; the logs don't give any hints. Running the lint locally everything checks out. |
* Includes helpers for removing decorators from function definition
Usage:
```
@ibis_postgres_client.udf([dt.int32], dt.int32)
def my_square(x):
return x ** 2
```
...using a SEQUENCE object in the database
* For type mapping, use simple dictionaries and stop even trying to support type lookup from anything except ibis DataTypes
* don't store all non-decorator line numbers, just the min * give better names to temporary field and node variables
* remove UDF decorator API and supporting decorator utilities * add an exception if user tries to define a UDF with a function that has decorator(s) * utilize ibis' and sqlalchemy's existing type translation for defining ibis type to Postgres datatype string conversion
* removed placeholder conditionals + NotImplementedError's. This can be a future feature request
* Point to a postgres docker image based directly on an "Official Image" (see https://docs.docker.com/docker-hub/official_images/) * previously had a two-step process in which one repo created an intermediate image, and a second repo used that intermediate image to create the final image. * The image is currently hosted on shajekpivotal/ibis-docker-postgres-9.5 and based on https://github.com/autoscott/ibis-docker-postgres, but this can easily be migrated to ibis-project-controlled accounts.
Azure test pipelines keep unpredictably failing due to timeout waiting for the various backends to be available. Increasing the timeout from 5 minutes to 10 minutes in the hopes that will prevent failures. Another avenue to pursue in the future might be to look for ways to speed up the instantiation of the backends.
|
Only error at this point is backend waiter timeout on LInux Python 3.5 after 10 minutes. |
|
Yeah I just kicked it off again to see if it was a transient error. |
|
Looking at logs from several builds that timed out at that step, it's always only Impala that it's still waiting on. I wonder if there's a way to speed up Impala's load time. |
|
It looks like the current image for Impala includes unnecessarily installing and starting up Kudu (since in our ibis-project/docker-impala/etc/supervisord.conf |
The impala service actually relies on there being an instance of postgres available to use as its metadata store. It has a timer to check up to 120 seconds and then impala startup hangs indefinitely or fails. When we switched to a new image for postgres that includes PL/Python, this pushed the startup time just long enough to cause impala startup to sometimes fail (unpredictably). Instead of increasing the wait time hard-coded in the Impala image, it seems better/easier to enforce the dependency with the `docker-compose.yml`. See https://github.com/ibis-project/docker-impala/blob/master/bin/start-impala.sh line 21 at revision dcb7388 `/wait-for-it.sh postgres:5432 -t 120`
|
Think I've figured out why this still sometimes fails while waiting for backends. Just pushed my fix. Fingers crossed that it passes the Azure pipelines. Below is my commit message explanation.
|
|
@cpcloud I got it all green 😃 |
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.
Small API nit/question. Once that's addressed this is ready for merge. @scottcode Can you create a follow up issue for moving the dockerfiles you're using here to the ibis-project if you haven't already?
* rename `func_to_udf` to `udf` and change its signature to take an ibis client instead of a sqlalchemy connection
|
Phillip, I know you already saw this, but for others' reference the issue for the Postgres Docker image is #1853. |
|
Kaboom. Merge time. |
|
Thanks @scottcode, keep 'em coming! |
The following functionality is included:
The current API looks like this. Comments and feedback are welcome.