-
Notifications
You must be signed in to change notification settings - Fork 28.9k
[SPARK-12457] [SQL] Add ExpressionDescription to collection functions. #10418
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
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.
Maybe it is better to use _FUNC_(array, ascendingOrder) and mention that ascendingOrder is a boolean?
|
I am wondering if we only need to show the SQL usage? For DF version, we have API doc (maybe that is good enough for now). |
|
I see. will add SQL cases. Thank you! |
|
Test build #48124 has finished for PR 10418 at commit
|
|
Test build #48129 has finished for PR 10418 at commit
|
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.
nit: i would use triple quotes for strings that contain quotes
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.
Tried to do it, but realized annotation argument needs to be a constant. A newline marker \n is an issue here. We are unable to call stripMargin after triple quotes. Thus, I called stripMargin when building ExpressionInfo. Do you like it?
|
Test build #48177 has finished for PR 10418 at commit
|
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.
Annotation argument needs to be a constant. Thus, I called stripMargin when building ExpressionInfo. I am not sure if this is a right way. If so, should we call stripMargin for df.usage() too?
If we do not care indenting, there exists another solution:
extended = """> SELECT _FUNC_(array("b", "d", "c", "a"));
4""")Or do you have a better way for adding a newline marker between triple quotes? Thank you! @marmbrus
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.
Why would you want to add a new line character in a raw string?
It would be nice to add stripMargin to df.usage as well.
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.
Add a new line character in a raw string does not work if we use the multi-line string. Thus, I added stripMargin here for avoiding weird indenting.
|
retest this please. |
|
Test build #48205 has finished for PR 10418 at commit
|
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.
This will fail to compile in scala 2.11. Use a multiline string here, see: #10488
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.
Thank you, I will change all of them.
|
Test build #48385 has finished for PR 10418 at commit
|
|
@yhuai Could you take a look at this fix? Thanks! BTW, I added |
…ection Functions #### What changes were proposed in this pull request? #12185 contains the original PR I submitted in #10418 However, it misses one of the extended example, a wrong description and a few typos for collection functions. This PR is fix all these issues. #### How was this patch tested? The existing test cases already cover it. Author: gatorsmile <[email protected]> Closes #12492 from gatorsmile/expressionUpdate.
Feeling a little bit guilty to pick the one with the least functions. : )
One question to @yhuai : when users describe these functions, I think it might be nice to provide them multiple useful examples. For example, for the function
sort_array, I am wondering how to put the following example inextended?So far, the example in
Upperis not very clear when we adding the complex use cases. Could you show us more examples?Thank you!