You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pig.apache.org by "Rohini Palaniswamy (JIRA)" <ji...@apache.org> on 2016/01/30 01:26:39 UTC
[jira] [Resolved] (PIG-3068) Wrong length is used into
DataByteArray to load data
[ https://issues.apache.org/jira/browse/PIG-3068?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Rohini Palaniswamy resolved PIG-3068.
-------------------------------------
Resolution: Invalid
Function works as per javadoc which mentions that it excludes end.
{code}
/**
* Construct a byte array using a portion of the provided bytes as content.
* @param b byte array to read from. A copy of the underlying bytes will be
* made.
* @param start starting point to copy from
* @param end ending point to copy to, exclusive.
*/
public DataByteArray(byte[] b, int start, int end) {
System.arraycopy(b, start, mData = new byte[end - start], 0, end-start);
}
{code}
> Wrong length is used into DataByteArray to load data
> ----------------------------------------------------
>
> Key: PIG-3068
> URL: https://issues.apache.org/jira/browse/PIG-3068
> Project: Pig
> Issue Type: Bug
> Affects Versions: 0.10.0
> Reporter: Anatoliy Bazko
>
> Hi. I've investigated your code
> {code}
> public DataByteArray(byte[] b, int start, int end) {
>
> System.arraycopy(b, start, mData = new byte[end - start], 0, end-start);
> }
> {code}
> The correct length should be
> {code}
> end-start+1
> {code}
> otherwise the last character is omitted
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)