-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-24324][PYTHON] Pandas Grouped Map UDF should assign result columns by name #21427
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
BryanCutler
wants to merge
15
commits into
apache:master
from
BryanCutler:arrow-grouped-map-mixesup-cols-SPARK-24324
Closed
Changes from 1 commit
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
21e0c3e
added test for diff column order
BryanCutler bbe3587
needed to adjust expected values to compare results
BryanCutler a653e9b
for grouped map results, get columns based on name instead of position
BryanCutler 88e2aa3
added test for positional columns
BryanCutler 7cc0c49
adjust positional test
BryanCutler d4b5da1
add fallback to positional assignment
BryanCutler 63c3963
added test for col name typo
BryanCutler 9bbf014
fix test for py3
BryanCutler 74c5d8e
added tests for integer index, incorrect field type with range index
BryanCutler b2d0966
documented behavior of column labels
BryanCutler 5a7edb2
passing conf map to runner, tests pass
BryanCutler 59972d6
added conf for assignment by position, passing general map of conf to…
BryanCutler 27b4cad
fix some typos
BryanCutler c593650
address nits
BryanCutler 2d2ced6
changed from catching KeyError to explicit check for string labels
BryanCutler 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
passing conf map to runner, tests pass
- Loading branch information
commit 5a7edb2bc30dc7fe93d19504e78fbf83c1f525d9
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -45,7 +45,7 @@ class ArrowPythonRunner( | |
| argOffsets: Array[Array[Int]], | ||
| schema: StructType, | ||
| timeZoneId: String, | ||
| respectTimeZone: Boolean) | ||
| conf: Map[String, String]) | ||
| extends BasePythonRunner[Iterator[InternalRow], ColumnarBatch]( | ||
| funcs, bufferSize, reuseWorker, evalType, argOffsets) { | ||
|
|
||
|
|
@@ -59,17 +59,17 @@ class ArrowPythonRunner( | |
|
|
||
| protected override def writeCommand(dataOut: DataOutputStream): Unit = { | ||
| PythonUDFRunner.writeUDFs(dataOut, funcs, argOffsets) | ||
| if (respectTimeZone) { | ||
| PythonRDD.writeUTF(timeZoneId, dataOut) | ||
| } else { | ||
| dataOut.writeInt(SpecialLengths.NULL) | ||
| dataOut.writeInt(conf.size) | ||
| for ((k, v) <- conf) { | ||
| PythonRDD.writeUTF(k, dataOut) | ||
| PythonRDD.writeUTF(v, dataOut) | ||
| } | ||
| } | ||
|
|
||
| protected override def writeIteratorToStream(dataOut: DataOutputStream): Unit = { | ||
| val arrowSchema = ArrowUtils.toArrowSchema(schema, timeZoneId) | ||
| val allocator = ArrowUtils.rootAllocator.newChildAllocator( | ||
| s"stdout writer for $pythonExec", 0, Long.MaxValue) | ||
| val arrowSchema = ArrowUtils.toArrowSchema(schema, timeZoneId) | ||
|
||
| val root = VectorSchemaRoot.create(arrowSchema, allocator) | ||
|
|
||
| Utils.tryWithSafeFinally { | ||
|
|
||
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
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.
Uh oh!
There was an error while loading. Please reload this page.
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 put this in a
writeConfmethod to be more specific?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 think it's fine, but I will add some comments
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.
Ok, SGTM.