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 2015/07/29 02:10:05 UTC

[jira] [Resolved] (PIG-4643) variables could be reused

     [ https://issues.apache.org/jira/browse/PIG-4643?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Rohini Palaniswamy resolved PIG-4643.
-------------------------------------
    Resolution: Invalid

   byte dt1 = bb1.get() fetches the datatype byte. bb1.get() fetch needs to be called again as it reads the next byte which is the size. 

> variables could be reused 
> --------------------------
>
>                 Key: PIG-4643
>                 URL: https://issues.apache.org/jira/browse/PIG-4643
>             Project: Pig
>          Issue Type: Improvement
>            Reporter: songwanging
>            Priority: Trivial
>
> In method "compareBinInterSedesDatum" of Class : pig-0.15.0\src\org\apache\pig\data\BinInterSedes.java
> In this method, variables "dt1" and "dt2" could be reused, as shown below, in switch block "case BinInterSedes.BIGINTEGER", "bb1.get()" and "bb2.get()" should be reused "dt1", "dt2" as all other cases did.
>  private int compareBinInterSedesDatum(ByteBuffer bb1, ByteBuffer bb2, boolean[] asc) throws IOException {
> byte dt1 = bb1.get();
> byte dt2 = bb2.get();
> 	…
>    switch (dt1) { 
> …
> case BinInterSedes.BIGINTEGER: {
>     if(...){
>    int sz1 = readSize(bb1, bb1.get());
>    int sz2 = readSize(bb2, bb2.get());
> …
>         } 
>  case BinInterSedes.BYTEARRAY: {
>     if(...){
>    int sz1 = readSize(bb1, dt1);
>    int sz2 = readSize(bb2, dt2);
> …
>         } 
>  case BinInterSedes.CHARARRAY: {
>     if(...){
>    int sz1 = readSize(bb1, dt1);
>    int sz2 = readSize(bb2, dt2);
> …
>         }
> }



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)