-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-23930][SQL] Add slice function #21040
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 1 commit
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
5cbbf7a
[SPARK-23930][SQL] Add slice function
mgaido91 367aaf2
fix typo
mgaido91 f2784f1
Merge branch 'master' of github.com:apache/spark into SPARK-23930
mgaido91 b94d067
review comments
mgaido91 dc6cb60
specialize codegen for primitive types
mgaido91 72ed607
Merge branch 'master' of github.com:apache/spark into SPARK-23930
mgaido91 9d65570
fix indent
mgaido91 9f0deec
Merge branch 'master' into SPARK-23930
mgaido91 e2eb21e
add checks for size greater than maxint
mgaido91 07604e0
fix scalastyle
mgaido91 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
specialize codegen for primitive types
- Loading branch information
commit dc6cb60f5bee56473d65e50b500dea694c28d2b3
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
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.
What happens if
sizeInBytesis larger thanInteger.MAX_VALUE? For example,0x7000_0000long elements. In this case,GenericArrayDataorlong[]can hold these elements. WDYT?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 other places (eg
Concat) in such a case we just throw a runtime exception. What about following the same pattern here?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 am not even sure we have to add such a check actually, since here we can only reduce the size of an already existing array... Anyway probably it is ok to add an additional sanity check. WDYT?
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 am curious about the following two cases.
UnsafeArray,long[]may be used. Its size is0x8000_0000 * 4. On the other hand, the size is the allocatedbyte[]is up to0x8000_0000.If GenericArray, which includes a lot of (e.g.0x7F00_0000)LongorDoubleelements, is passed to this operation, the expected allocation size is more than0x8000_0000.While these cases reduce the size of an existing array, does the result array fit into
byte[]? WDYT?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 added the same check which is performed in
ConcatandFlatten. If we want to support also larger arrays of primitives, we probably best have another PR which address the issue on all the functions affected (this one,ConcatandFlatten), especially considering that the issue is much more likely to happen in the other two cases. Do you agree?