-
Notifications
You must be signed in to change notification settings - Fork 244
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 lower/upper/strip/contains to StringExpression #3199
Conversation
@@ -2048,6 +2048,75 @@ def split(self, delim, n=None): | |||
else: | |||
return self._method("split", tarray(tstr), delim, n) | |||
|
|||
def lower(self): | |||
"""Returns a string of only lower-case characters. |
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.
can this be something like "Returns a string with all letters converted to lowercase." or something? (Basically making it more clear that it's performing an action on the given string---I got a little confused because s
is defined quite a ways up.) Ditto for upper.
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.
how about this (copied from Python stdlib docs):
Return a copy of s, but with upper case letters converted to lower case.
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.
sounds good! I don't have strong feelings about exact verbiage.
registerMethod("lower", (s: String) => s.toLowerCase) | ||
registerMethod("upper", (s: String) => s.toUpperCase) | ||
registerMethod("strip", (s: String) => s.trim()) | ||
registerMethod("contains", (s: String, t: String) => s.contains(t)) |
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.
I want to be difficult: no new FunctionRegistry methods without corresponding IR methods.
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.
can you point me to the code to mimic?
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.
in is.hail.expr.ir.functions. You probably want a StringFunctions to mimic MathFunctions, and then you need to call registerAll in IRFunctionRegistry.
* Add lower/upper/strip/contains to StringExpression * added StringFunctions IR
* Add lower/upper/strip/contains to StringExpression * added StringFunctions IR
* Add lower/upper/strip/contains to StringExpression * added StringFunctions IR
No description provided.