-
Notifications
You must be signed in to change notification settings - Fork 28.9k
[SPARK-25068][SQL] Add exists function. #22052
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
Conversation
|
Test build #94483 has finished for PR 22052 at commit
|
| while (i < arr.numElements) { | ||
| elementVar.value.set(arr.get(i, elementVar.dataType)) | ||
| if (f.eval(inputRow).asInstanceOf[Boolean]) { | ||
| return true |
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.
shall we use a var exists = false to keep the result, and stop the loop when result is true while (i < arr.numElements & !exists)?
IIUC return in Scala is implemented by throwing an exception, which may have performance issue.
|
LGTM |
hvanhovell
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.
LGTM
|
Test build #94510 has finished for PR 22052 at commit
|
gatorsmile
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! Merged to master.
What changes were proposed in this pull request?
This pr adds
existsfunction which tests whether a predicate holds for one or more elements in the array.How was this patch tested?
Added tests.