Skip to content
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

Closed
wants to merge 9 commits into from

Conversation

tianchen92
Copy link
Contributor

Related to ARROW-5918.

Object index = indices.getObject(i);
if (index != null) {
int indexAsInt = ((Number) index).intValue();
if (!baseIntVector.isNull(i)) {
Copy link
Contributor

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

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.

@@ -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);
Copy link
Contributor

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?

Copy link
Contributor Author

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 :)

Copy link
Contributor

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.

Copy link
Contributor

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.

Copy link
Contributor Author

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"

Copy link
Contributor Author

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.

@emkornfield
Copy link
Contributor

Took a quick pass and LGTM, I think this can be merged once Ci is green. Thanks.

@codecov-io
Copy link

Codecov Report

Merging #4859 into master will increase coverage by 2.16%.
The diff coverage is n/a.

Impacted file tree graph

@@            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
Impacted Files Coverage Δ
python/pyarrow/tests/test_orc.py 95.45% <0%> (-1.52%) ⬇️
cpp/src/arrow/util/thread-pool-test.cc 97.66% <0%> (-0.94%) ⬇️
cpp/src/parquet/arrow/writer.cc 96.71% <0%> (-0.04%) ⬇️
cpp/src/gandiva/precompiled/arithmetic_ops_test.cc 100% <0%> (ø) ⬆️
cpp/src/gandiva/function_registry_arithmetic.cc 100% <0%> (ø) ⬆️
cpp/src/arrow/type.h 92.69% <0%> (ø) ⬆️
cpp/src/arrow/buffer-builder.h 100% <0%> (ø) ⬆️
cpp/src/gandiva/precompiled/decimal_ops.cc 97.17% <0%> (ø) ⬆️
cpp/src/gandiva/precompiled/decimal_ops_test.cc 97.43% <0%> (ø) ⬆️
python/pyarrow/pandas-shim.pxi 65.26% <0%> (ø) ⬆️
... and 336 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c350bba...3732a78. Read the comment docs.

@emkornfield
Copy link
Contributor

+1

kszucs pushed a commit that referenced this pull request Jul 22, 2019
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
pprudhvi pushed a commit to pprudhvi/arrow that referenced this pull request Aug 11, 2019
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants