Skip to content
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

Add initial support for ibis.random function #2060

Merged
merged 9 commits into from
Mar 14, 2020

Conversation

jrbourbeau
Copy link
Contributor

@jrbourbeau jrbourbeau commented Jan 29, 2020

This PR adds an ibis.random function which returns a random number between 0 (inclusive) and 1 (exclusive). I've started with initial support for the postgresql and mysql backends

Closes #1450

xmnlab pushed a commit that referenced this pull request Jan 31, 2020
This PR fixes a couple of issues with the documentation CI build that
I noticed over in #2060 which are related to the recent Pandas 1.0
release (see https://dev.azure.com/ibis-project/ibis/_build/results?bu
ildId=1791&view=logs&j=8f09edc2-e3b7-52de-126a-0225c4f3efa1&t=78a72aec
-b398-558e-7c0d-2d33604b9e53&l=129)
Author: James Bourbeau <jrbourbeau@gmail.com>

Closes #2061 from jrbourbeau/doc-fixup and squashes the following commits:

0f5f128 [James Bourbeau] Update release note to reflect new PR title
cfcc962 [James Bourbeau] Add entry to release notes
ba9c5ca [James Bourbeau] Explicilty set strict=False to override default in setup.cfg
3825b5b [James Bourbeau] Remove strict=True in xfail
bb58b8a [James Bourbeau] xfail remaining test failures
2c385e5 [James Bourbeau] Add year param back to test_datatypes.py
939a6df [James Bourbeau] Update makeDataFrame location
3445ce3 [James Bourbeau] Some pandas 1.0 compat fixups
@jrbourbeau jrbourbeau changed the title Add ibis.random function Add initial support for ibis.random function Jan 31, 2020
ibis/expr/api.py Outdated
@@ -1344,6 +1345,11 @@ def clip(arg, lower=None, upper=None):
return op.to_expr()


def random():
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's create a ibis.expr.random; the goal is to produce a random scalar yes? reference the documentation https://docs.python.org/3/library/random.html, which i assume is the goal here.

@@ -2450,6 +2450,11 @@ def output_type(self):
return dt.timestamp.scalar_type()


class Random(Constant):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this could be RandomScalar. you could eventually expand this to a column op as well.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jrbourbeau do you still have any interesting on moving this forward? let me know if you need any help! thanks for having been working on that.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apologies for the delayed response. I've made updates in response to @jreback's initial feedback, please let me know if there's anything else you'd like me to include in this PR

@jreback jreback added the feature Features or general enhancements label Feb 2, 2020
@jrbourbeau
Copy link
Contributor Author

The LinuxBuildConda CI failure seems unrelated to the changes here. Can I get a restart for that build?

@xmnlab
Copy link
Contributor

xmnlab commented Mar 4, 2020

@jrbourbeau the PR #2104 will fix this problem.

@xmnlab xmnlab requested a review from jreback March 4, 2020 15:23
@jrbourbeau
Copy link
Contributor Author

I see, thanks for info!

@xmnlab
Copy link
Contributor

xmnlab commented Mar 5, 2020

@jrbourbeau also would be good to have this new operation into the documentation.
maybe the best place to add that would be https://docs.ibis-project.org/api.html#top-level-expression-apis

thanks for working on that!

@xmnlab
Copy link
Contributor

xmnlab commented Mar 5, 2020

CI windows issues probably related to conda-forge/python-feedstock#325

@jrbourbeau
Copy link
Contributor Author

Good to know, thanks for investigating. It's been a few hours since the fix was merged, would you mind restarting the CI build here to see if things are fixed?

@jrbourbeau
Copy link
Contributor Author

Sweet, thanks for the restart. Looks like the Windows CI failures have been resolved

@xmnlab
Copy link
Contributor

xmnlab commented Mar 10, 2020

LinuxBuildConda should be fixed now. @jrbourbeau could you rebase your code on top of master pls? thanks!

@jrbourbeau
Copy link
Contributor Author

Thanks for the heads up @xmnlab! Just updated this PR

@jreback jreback added this to the Next Feature Release milestone Mar 12, 2020
Copy link
Contributor

@jreback jreback left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you merge master. looks good. ping on green.

@jreback
Copy link
Contributor

jreback commented Mar 12, 2020

cc @toryhaavik @icexelloss if you have comments.

@jrbourbeau
Copy link
Contributor Author

Thanks for taking a look @jreback. Merged master and CI is green

@jreback jreback merged commit ae0ced4 into ibis-project:master Mar 14, 2020
@jreback
Copy link
Contributor

jreback commented Mar 14, 2020

thanks @jrbourbeau

a followup could be to add this to the pandas back end (easy)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Features or general enhancements
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support for RANDOM-like function
3 participants