-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-8407][SQL]complex type constructors: struct and named_struct #6874
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
Closed
Closed
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
0acb7be
Add CreateNamedStruct in both DataFrame function API and FunctionRegi…
yjshen 4bd75ad
loosen struct method in functions.scala to take Expression children
yjshen 917e680
Fix reviews
yjshen 47da332
remove nameStruct API from DataFrame
yjshen ccbbd86
Fix reviews
yjshen 7a71255
tiny fix
yjshen fd3cd8e
remove type check from eval
yjshen 828d694
remove unnecessary resolved assertion inside dataType method
yjshen 60812a7
Fix type check
yjshen 7fef712
Fix checkInputTypes' implementation using foldable and nullable
yjshen 9613be9
review fix
yjshen f07e114
tiny fix
yjshen b487354
replace assert using checkAnswer
yjshen 9a7039e
fix reviews and regenerate golden answers
yjshen d599d0b
rebase code
yjshen 4cd3375
change struct documentation
yjshen File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -739,17 +739,18 @@ object functions { | |
| def sqrt(colName: String): Column = sqrt(Column(colName)) | ||
|
|
||
| /** | ||
| * Creates a new struct column. The input column must be a column in a [[DataFrame]], or | ||
| * a derived column expression that is named (i.e. aliased). | ||
| * Creates a new struct column. | ||
| * If the input column is a column in a [[DataFrame]], or a derived column expression | ||
| * that is named (i.e. aliased), its name would be remained as the StructField's name, | ||
| * otherwise, the newly generated StructField's name would be auto generated as col${index + 1}, | ||
| * i.e. col1, col2, col3, ... | ||
| * | ||
| * @group normal_funcs | ||
| * @since 1.4.0 | ||
| */ | ||
| @scala.annotation.varargs | ||
| def struct(cols: Column*): Column = { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The documentation above needs to be updated and should specify what happens when the columns are unnamed. |
||
| require(cols.forall(_.expr.isInstanceOf[NamedExpression]), | ||
| s"struct input columns must all be named or aliased ($cols)") | ||
| CreateStruct(cols.map(_.expr.asInstanceOf[NamedExpression])) | ||
| CreateStruct(cols.map(_.expr)) | ||
| } | ||
|
|
||
| /** | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
@cloud-fan, is this what you mean?
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.
ah yes.