pig-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apache Wiki <wikidi...@apache.org>
Subject [Pig Wiki] Trivial Update of "LoadStoreMigrationGuide" by newacct
Date Sat, 15 May 2010 06:56:58 GMT
Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Pig Wiki" for change notification.

The "LoadStoreMigrationGuide" page has been changed by newacct.
http://wiki.apache.org/pig/LoadStoreMigrationGuide?action=diff&rev1=38&rev2=39

--------------------------------------------------

      long                end            = Long.MAX_VALUE;
      private byte recordDel = '\n';
      private byte fieldDel = '\t';
-     private ByteArrayOutputStream mBuf = null;
+     private ByteArrayOutputStream mBuf;
-     private ArrayList<Object> mProtoTuple = null;
+     private ArrayList<Object> mProtoTuple;
      private static final String UTF8 = "UTF-8";
  
      public SimpleTextLoader() {
@@ -96, +96 @@

              case 'x':
              case 'u':
                  this.fieldDel =
-                     Integer.valueOf(delimiter.substring(2)).byteValue();
+                     (byte)Integer.parseInt(delimiter.substring(2));
                  break;
  
              default:
                  throw new RuntimeException("Unknown delimiter " + delimiter);
              }
          } else {
-             throw new RuntimeException("PigStorage delimeter must be a single character");
+             throw new RuntimeException("PigStorage delimiter must be a single character");
          }
      }
  
@@ -141, +141 @@

          this.end = end;
  
          // Since we are not block aligned we throw away the first
-         // record and cound on a different instance to read it
+         // record and count on a different instance to read it
          if (offset != 0) {
              getNext();
          }
@@ -179, +179 @@

  === New Implementation ===
  {{{
  public class SimpleTextLoader extends LoadFunc {
-     protected RecordReader in = null;
+     protected RecordReader in;
      private byte fieldDel = '\t';
-     private ArrayList<Object> mProtoTuple = null;
+     private ArrayList<Object> mProtoTuple;
      private TupleFactory mTupleFactory = TupleFactory.getInstance();
      private static final int BUFFER_SIZE = 1024;
  
@@ -207, +207 @@

  
              case 'x':
                 fieldDel =
-                     Integer.valueOf(delimiter.substring(2), 16).byteValue();
+                     (byte)Integer.parseInt(delimiter.substring(2), 16);
                 break;
  
              case 'u':
                  this.fieldDel =
-                     Integer.valueOf(delimiter.substring(2)).byteValue();
+                     (byte)Integer.parseInt(delimiter.substring(2));
                  break;
  
              default:
                  throw new RuntimeException("Unknown delimiter " + delimiter);
              }
          } else {
-             throw new RuntimeException("PigStorage delimeter must be a single character");
+             throw new RuntimeException("PigStorage delimiter must be a single character");
          }
      }
  
@@ -313, +313 @@

              case 'x':
              case 'u':
                  this.fieldDel =
-                     Integer.valueOf(delimiter.substring(2)).byteValue();
+                     (byte)Integer.parseInt(delimiter.substring(2));
                  break;
  
              default:
                  throw new RuntimeException("Unknown delimiter " + delimiter);
              }
          } else {
-             throw new RuntimeException("PigStorage delimeter must be a single character");
+             throw new RuntimeException("PigStorage delimiter must be a single character");
          }
      }
  
@@ -496, +496 @@

  
              case 'x':
                 fieldDel =
-                     Integer.valueOf(delimiter.substring(2), 16).byteValue();
+                     (byte)Integer.parseInt(delimiter.substring(2), 16);
                 break;
              case 'u':
                  this.fieldDel =
-                     Integer.valueOf(delimiter.substring(2)).byteValue();
+                     (byte)Integer.parseInt(delimiter.substring(2));
                  break;
  
              default:
                  throw new RuntimeException("Unknown delimiter " + delimiter);
              }
          } else {
-             throw new RuntimeException("PigStorage delimeter must be a single character");
+             throw new RuntimeException("PigStorage delimiter must be a single character");
          }
      }
  

Mime
View raw message