apache / apache/parquet-java

Binary tests check conditions not part of the API contract

Open
#1,919 0 comments 0 reactions 0 assignees View on GitHub
Component: Java Component: Parquet Priority: Major Type: bug
Dominant language
Java
Stars
3.1k
Forks
1.6k
Avg merge
3d 12h
Merged PRs (30d)
33

Description

`TestBinary#testConstantCopy` validates that when the backing buffer for a `Binary` is changed, the changes can be seen when calling either `Binary#getBytes` or `Binary#getBytesUnsafe`. This is not a part of the API contract for constant binary. The API guarantees the opposite: that if a reused buffer changes then those changes won't affect the value already returned by `getBytes`.

`ByteBufferBackedBinary` caches the value returned by `getBytes`, which is allowed in the API. This causes tests to fail when it is expected that a change to the underlying buffer changes the value of the binary, when the contract for constant buffers is that the underlying buffer will not be changed.

**Reporter**: [Ryan Blue](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=rdblue) / @rdblue

**Note**: *This issue was originally created as [PARQUET-414](https://issues.apache.org/jira/browse/PARQUET-414). Please see the [migration documentation](https://issues.apache.org/jira/browse/PARQUET-2502) for further details.*

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.