-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
ARROW-5918: [Java] Add get to BaseIntVector interface #4859
Conversation
Object index = indices.getObject(i); | ||
if (index != null) { | ||
int indexAsInt = ((Number) index).intValue(); | ||
if (!baseIntVector.isNull(i)) { |
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.
encoded value can never be null?
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.
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 see. The benefit of not encoding null is efficient storage. However, the benefit of encoding null is efficient computation (no if branch in the encoding/decoding logic, which makes the CPU pipeline/prefetch more efficient).
We may need some investigation on this. For this particular case, it may be OK to stick to the original assumption.
java/vector/src/main/java/org/apache/arrow/vector/BaseIntVector.java
Outdated
Show resolved
Hide resolved
@@ -23,7 +23,13 @@ | |||
public interface BaseIntVector extends ValueVector { | |||
|
|||
/** | |||
* set value at specific index, note this value may need to be need truncated. | |||
* Sets the value at index, note this value may need to be need truncated. | |||
*/ | |||
void setWithPossibleTruncate(int index, long value); |
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.
Do we also need a setSafe method 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.
Thanks, this method is implemented with setSafe in sub classes :)
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 see. Thanks. I am not sure if we should use separate APIs for set and setSafe methods.
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.
Lets update the javadoc to indicate this is the safe version. Unfortuantely, I think this made it into the 0.14.0, so we should try not to rename it. We can always add an unsafe version 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.
Sure, thanks, will also add a method like "setUnsafeWithPossibleTruncate"
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 for your efforts, PR updated.
java/vector/src/main/java/org/apache/arrow/vector/BigIntVector.java
Outdated
Show resolved
Hide resolved
java/vector/src/main/java/org/apache/arrow/vector/BigIntVector.java
Outdated
Show resolved
Hide resolved
Took a quick pass and LGTM, I think this can be merged once Ci is green. Thanks. |
Codecov Report
@@ Coverage Diff @@
## master #4859 +/- ##
==========================================
+ Coverage 87.42% 89.58% +2.16%
==========================================
Files 994 661 -333
Lines 140102 96636 -43466
Branches 1418 0 -1418
==========================================
- Hits 122481 86572 -35909
+ Misses 17259 10064 -7195
+ Partials 362 0 -362
Continue to review full report at Codecov.
|
+1 |
Related to [ARROW-5918](https://issues.apache.org/jira/browse/ARROW-5918). Author: tianchen <[email protected]> Closes #4859 from tianchen92/ARROW-5918 and squashes the following commits: 3732a78 <tianchen> update javadoc and add unsafe method in BaseIntVector 1562ae1 <tianchen> fix 2 7ddce12 <tianchen> fix 26d30be <tianchen> fix e65473c <tianchen> fix comments fe9c2ec <tianchen> fix 9b8afa6 <tianchen> enable null checking 9f2fc09 <tianchen> fix 5739cc4 <tianchen> ARROW-5918: Add get to BaseIntVector interface
Related to [ARROW-5918](https://issues.apache.org/jira/browse/ARROW-5918). Author: tianchen <[email protected]> Closes apache#4859 from tianchen92/ARROW-5918 and squashes the following commits: 3732a78 <tianchen> update javadoc and add unsafe method in BaseIntVector 1562ae1 <tianchen> fix 2 7ddce12 <tianchen> fix 26d30be <tianchen> fix e65473c <tianchen> fix comments fe9c2ec <tianchen> fix 9b8afa6 <tianchen> enable null checking 9f2fc09 <tianchen> fix 5739cc4 <tianchen> ARROW-5918: Add get to BaseIntVector interface
Related to ARROW-5918.