hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hashut...@apache.org
Subject svn commit: r1597698 - in /hive/trunk/contrib/src/java/org/apache/hadoop/hive/contrib/util/typedbytes: TypedBytesInput.java TypedBytesOutput.java TypedBytesRecordInput.java TypedBytesRecordOutput.java TypedBytesWritableOutput.java
Date Tue, 27 May 2014 04:27:35 GMT
Author: hashutosh
Date: Tue May 27 04:27:34 2014
New Revision: 1597698

URL: http://svn.apache.org/r1597698
Log:
HIVE-7077 : Hive contrib compilation maybe broken with removal of org.apache.hadoop.record
(Ashutosh Chauhan via Navis)

Modified:
    hive/trunk/contrib/src/java/org/apache/hadoop/hive/contrib/util/typedbytes/TypedBytesInput.java
    hive/trunk/contrib/src/java/org/apache/hadoop/hive/contrib/util/typedbytes/TypedBytesOutput.java
    hive/trunk/contrib/src/java/org/apache/hadoop/hive/contrib/util/typedbytes/TypedBytesRecordInput.java
    hive/trunk/contrib/src/java/org/apache/hadoop/hive/contrib/util/typedbytes/TypedBytesRecordOutput.java
    hive/trunk/contrib/src/java/org/apache/hadoop/hive/contrib/util/typedbytes/TypedBytesWritableOutput.java

Modified: hive/trunk/contrib/src/java/org/apache/hadoop/hive/contrib/util/typedbytes/TypedBytesInput.java
URL: http://svn.apache.org/viewvc/hive/trunk/contrib/src/java/org/apache/hadoop/hive/contrib/util/typedbytes/TypedBytesInput.java?rev=1597698&r1=1597697&r2=1597698&view=diff
==============================================================================
--- hive/trunk/contrib/src/java/org/apache/hadoop/hive/contrib/util/typedbytes/TypedBytesInput.java
(original)
+++ hive/trunk/contrib/src/java/org/apache/hadoop/hive/contrib/util/typedbytes/TypedBytesInput.java
Tue May 27 04:27:34 2014
@@ -26,7 +26,6 @@ import java.util.List;
 import java.util.TreeMap;
 
 import org.apache.hadoop.io.WritableUtils;
-import org.apache.hadoop.record.Buffer;
 
 /**
  * Provides functionality for reading typed bytes.
@@ -51,7 +50,7 @@ public class TypedBytesInput {
 
   /**
    * Get a thread-local typed bytes input for the supplied {@link DataInput}.
-   * 
+   *
    * @param in
    *          data input object
    * @return typed bytes input corresponding to the supplied {@link DataInput}.
@@ -71,7 +70,7 @@ public class TypedBytesInput {
    * Reads a typed bytes sequence and converts it to a Java object. The first
    * byte is interpreted as a type code, and then the right number of subsequent
    * bytes are read depending on the obtained type.
-   * 
+   *
    * @return the obtained object or null when the end of the file is reached
    * @throws IOException
    */
@@ -82,9 +81,7 @@ public class TypedBytesInput {
     } catch (EOFException eof) {
       return null;
     }
-    if (code == Type.BYTES.code) {
-      return new Buffer(readBytes());
-    } else if (code == Type.BYTE.code) {
+    if (code == Type.BYTE.code) {
       return readByte();
     } else if (code == Type.BOOL.code) {
       return readBool();
@@ -108,8 +105,6 @@ public class TypedBytesInput {
       return readMap();
     } else if (code == Type.MARKER.code) {
       return null;
-    } else if (50 <= code && code <= 200) { // application-specific typecodes
-      return new Buffer(readBytes());
     } else {
       throw new RuntimeException("unknown type");
     }
@@ -119,7 +114,7 @@ public class TypedBytesInput {
    * Reads a typed bytes sequence. The first byte is interpreted as a type code,
    * and then the right number of subsequent bytes are read depending on the
    * obtained type.
-   * 
+   *
    * @return the obtained typed bytes sequence or null when the end of the file
    *         is reached
    * @throws IOException
@@ -147,12 +142,6 @@ public class TypedBytesInput {
       return readRawDouble();
     } else if (code == Type.STRING.code) {
       return readRawString();
-    } else if (code == Type.VECTOR.code) {
-      return readRawVector();
-    } else if (code == Type.LIST.code) {
-      return readRawList();
-    } else if (code == Type.MAP.code) {
-      return readRawMap();
     } else if (code == Type.MARKER.code) {
       return null;
     } else if (50 <= code && code <= 200) { // application-specific typecodes
@@ -164,7 +153,7 @@ public class TypedBytesInput {
 
   /**
    * Reads a type byte and returns the corresponding {@link Type}.
-   * 
+   *
    * @return the obtained Type or null when the end of the file is reached
    * @throws IOException
    */
@@ -185,7 +174,7 @@ public class TypedBytesInput {
 
   /**
    * Skips a type byte.
-   * 
+   *
    * @return true iff the end of the file was not reached
    * @throws IOException
    */
@@ -200,7 +189,7 @@ public class TypedBytesInput {
 
   /**
    * Reads the bytes following a <code>Type.BYTES</code> code.
-   * 
+   *
    * @return the obtained bytes sequence
    * @throws IOException
    */
@@ -213,7 +202,7 @@ public class TypedBytesInput {
 
   /**
    * Reads the raw bytes following a <code>Type.BYTES</code> code.
-   * 
+   *
    * @return the obtained bytes sequence
    * @throws IOException
    */
@@ -231,7 +220,7 @@ public class TypedBytesInput {
 
   /**
    * Reads the byte following a <code>Type.BYTE</code> code.
-   * 
+   *
    * @return the obtained byte
    * @throws IOException
    */
@@ -241,7 +230,7 @@ public class TypedBytesInput {
 
   /**
    * Reads the raw byte following a <code>Type.BYTE</code> code.
-   * 
+   *
    * @return the obtained byte
    * @throws IOException
    */
@@ -254,7 +243,7 @@ public class TypedBytesInput {
 
   /**
    * Reads the boolean following a <code>Type.BOOL</code> code.
-   * 
+   *
    * @return the obtained boolean
    * @throws IOException
    */
@@ -264,7 +253,7 @@ public class TypedBytesInput {
 
   /**
    * Reads the raw bytes following a <code>Type.BOOL</code> code.
-   * 
+   *
    * @return the obtained bytes sequence
    * @throws IOException
    */
@@ -277,7 +266,7 @@ public class TypedBytesInput {
 
   /**
    * Reads the integer following a <code>Type.INT</code> code.
-   * 
+   *
    * @return the obtained integer
    * @throws IOException
    */
@@ -287,7 +276,7 @@ public class TypedBytesInput {
 
   /**
    * Reads the short following a <code>Type.SHORT</code> code.
-   * 
+   *
    * @return the obtained short
    * @throws IOException
    */
@@ -297,7 +286,7 @@ public class TypedBytesInput {
 
   /**
    * Reads the raw bytes following a <code>Type.INT</code> code.
-   * 
+   *
    * @return the obtained bytes sequence
    * @throws IOException
    */
@@ -310,7 +299,7 @@ public class TypedBytesInput {
 
   /**
    * Reads the long following a <code>Type.LONG</code> code.
-   * 
+   *
    * @return the obtained long
    * @throws IOException
    */
@@ -320,7 +309,7 @@ public class TypedBytesInput {
 
   /**
    * Reads the raw bytes following a <code>Type.LONG</code> code.
-   * 
+   *
    * @return the obtained bytes sequence
    * @throws IOException
    */
@@ -333,7 +322,7 @@ public class TypedBytesInput {
 
   /**
    * Reads the float following a <code>Type.FLOAT</code> code.
-   * 
+   *
    * @return the obtained float
    * @throws IOException
    */
@@ -343,7 +332,7 @@ public class TypedBytesInput {
 
   /**
    * Reads the raw bytes following a <code>Type.FLOAT</code> code.
-   * 
+   *
    * @return the obtained bytes sequence
    * @throws IOException
    */
@@ -356,7 +345,7 @@ public class TypedBytesInput {
 
   /**
    * Reads the double following a <code>Type.DOUBLE</code> code.
-   * 
+   *
    * @return the obtained double
    * @throws IOException
    */
@@ -366,7 +355,7 @@ public class TypedBytesInput {
 
   /**
    * Reads the raw bytes following a <code>Type.DOUBLE</code> code.
-   * 
+   *
    * @return the obtained bytes sequence
    * @throws IOException
    */
@@ -379,7 +368,7 @@ public class TypedBytesInput {
 
   /**
    * Reads the string following a <code>Type.STRING</code> code.
-   * 
+   *
    * @return the obtained string
    * @throws IOException
    */
@@ -389,7 +378,7 @@ public class TypedBytesInput {
 
   /**
    * Reads the raw bytes following a <code>Type.STRING</code> code.
-   * 
+   *
    * @return the obtained bytes sequence
    * @throws IOException
    */
@@ -407,7 +396,7 @@ public class TypedBytesInput {
 
   /**
    * Reads the vector following a <code>Type.VECTOR</code> code.
-   * 
+   *
    * @return the obtained vector
    * @throws IOException
    */
@@ -422,26 +411,8 @@ public class TypedBytesInput {
   }
 
   /**
-   * Reads the raw bytes following a <code>Type.VECTOR</code> code.
-   * 
-   * @return the obtained bytes sequence
-   * @throws IOException
-   */
-  public byte[] readRawVector() throws IOException {
-    Buffer buffer = new Buffer();
-    int length = readVectorHeader();
-    buffer.append(new byte[] {(byte) Type.VECTOR.code,
-        (byte) (0xff & (length >> 24)), (byte) (0xff & (length >> 16)),
-        (byte) (0xff & (length >> 8)), (byte) (0xff & length)});
-    for (int i = 0; i < length; i++) {
-      buffer.append(readRaw());
-    }
-    return buffer.get();
-  }
-
-  /**
    * Reads the header following a <code>Type.VECTOR</code> code.
-   * 
+   *
    * @return the number of elements in the vector
    * @throws IOException
    */
@@ -451,7 +422,7 @@ public class TypedBytesInput {
 
   /**
    * Reads the list following a <code>Type.LIST</code> code.
-   * 
+   *
    * @return the obtained list
    * @throws IOException
    */
@@ -467,25 +438,8 @@ public class TypedBytesInput {
   }
 
   /**
-   * Reads the raw bytes following a <code>Type.LIST</code> code.
-   * 
-   * @return the obtained bytes sequence
-   * @throws IOException
-   */
-  public byte[] readRawList() throws IOException {
-    Buffer buffer = new Buffer(new byte[] {(byte) Type.LIST.code});
-    byte[] bytes = readRaw();
-    while (bytes != null) {
-      buffer.append(bytes);
-      bytes = readRaw();
-    }
-    buffer.append(new byte[] {(byte) Type.MARKER.code});
-    return buffer.get();
-  }
-
-  /**
    * Reads the map following a <code>Type.MAP</code> code.
-   * 
+   *
    * @return the obtained map
    * @throws IOException
    */
@@ -502,27 +456,8 @@ public class TypedBytesInput {
   }
 
   /**
-   * Reads the raw bytes following a <code>Type.MAP</code> code.
-   * 
-   * @return the obtained bytes sequence
-   * @throws IOException
-   */
-  public byte[] readRawMap() throws IOException {
-    Buffer buffer = new Buffer();
-    int length = readMapHeader();
-    buffer.append(new byte[] {(byte) Type.MAP.code,
-        (byte) (0xff & (length >> 24)), (byte) (0xff & (length >> 16)),
-        (byte) (0xff & (length >> 8)), (byte) (0xff & length)});
-    for (int i = 0; i < length; i++) {
-      buffer.append(readRaw());
-      buffer.append(readRaw());
-    }
-    return buffer.get();
-  }
-
-  /**
    * Reads the header following a <code>Type.MAP</code> code.
-   * 
+   *
    * @return the number of key-value pairs in the map
    * @throws IOException
    */

Modified: hive/trunk/contrib/src/java/org/apache/hadoop/hive/contrib/util/typedbytes/TypedBytesOutput.java
URL: http://svn.apache.org/viewvc/hive/trunk/contrib/src/java/org/apache/hadoop/hive/contrib/util/typedbytes/TypedBytesOutput.java?rev=1597698&r1=1597697&r2=1597698&view=diff
==============================================================================
--- hive/trunk/contrib/src/java/org/apache/hadoop/hive/contrib/util/typedbytes/TypedBytesOutput.java
(original)
+++ hive/trunk/contrib/src/java/org/apache/hadoop/hive/contrib/util/typedbytes/TypedBytesOutput.java
Tue May 27 04:27:34 2014
@@ -27,7 +27,6 @@ import java.util.Set;
 import java.util.Map.Entry;
 
 import org.apache.hadoop.io.WritableUtils;
-import org.apache.hadoop.record.Buffer;
 
 /**
  * Provides functionality for writing typed bytes.
@@ -77,9 +76,7 @@ public class TypedBytesOutput {
    * @throws IOException
    */
   public void write(Object obj) throws IOException {
-    if (obj instanceof Buffer) {
-      writeBytes(((Buffer) obj).get());
-    } else if (obj instanceof Byte) {
+    if (obj instanceof Byte) {
       writeByte((Byte) obj);
     } else if (obj instanceof Boolean) {
       writeBool((Boolean) obj);

Modified: hive/trunk/contrib/src/java/org/apache/hadoop/hive/contrib/util/typedbytes/TypedBytesRecordInput.java
URL: http://svn.apache.org/viewvc/hive/trunk/contrib/src/java/org/apache/hadoop/hive/contrib/util/typedbytes/TypedBytesRecordInput.java?rev=1597698&r1=1597697&r2=1597698&view=diff
==============================================================================
--- hive/trunk/contrib/src/java/org/apache/hadoop/hive/contrib/util/typedbytes/TypedBytesRecordInput.java
(original)
+++ hive/trunk/contrib/src/java/org/apache/hadoop/hive/contrib/util/typedbytes/TypedBytesRecordInput.java
Tue May 27 04:27:34 2014
@@ -21,14 +21,10 @@ package org.apache.hadoop.hive.contrib.u
 import java.io.DataInput;
 import java.io.IOException;
 
-import org.apache.hadoop.record.Buffer;
-import org.apache.hadoop.record.Index;
-import org.apache.hadoop.record.RecordInput;
-
 /**
  * Serializer for records that writes typed bytes.
  */
-public class TypedBytesRecordInput implements RecordInput {
+public class TypedBytesRecordInput {
 
   private TypedBytesInput in;
 
@@ -49,7 +45,7 @@ public class TypedBytesRecordInput imple
   /**
    * Get a thread-local typed bytes record input for the supplied
    * {@link TypedBytesInput}.
-   * 
+   *
    * @param in
    *          typed bytes input object
    * @return typed bytes record input corresponding to the supplied
@@ -64,7 +60,7 @@ public class TypedBytesRecordInput imple
   /**
    * Get a thread-local typed bytes record input for the supplied
    * {@link DataInput}.
-   * 
+   *
    * @param in
    *          data input object
    * @return typed bytes record input corresponding to the supplied
@@ -89,11 +85,6 @@ public class TypedBytesRecordInput imple
     return in.readBool();
   }
 
-  public Buffer readBuffer(String tag) throws IOException {
-    in.skipType();
-    return new Buffer(in.readBytes());
-  }
-
   public byte readByte(String tag) throws IOException {
     in.skipType();
     return in.readByte();
@@ -128,16 +119,6 @@ public class TypedBytesRecordInput imple
     in.skipType();
   }
 
-  public Index startVector(String tag) throws IOException {
-    in.skipType();
-    return new TypedBytesIndex(in.readVectorHeader());
-  }
-
-  public Index startMap(String tag) throws IOException {
-    in.skipType();
-    return new TypedBytesIndex(in.readMapHeader());
-  }
-
   public void endRecord(String tag) throws IOException {
   }
 
@@ -146,21 +127,4 @@ public class TypedBytesRecordInput imple
 
   public void endMap(String tag) throws IOException {
   }
-
-  private static final class TypedBytesIndex implements Index {
-    private int nelems;
-
-    private TypedBytesIndex(int nelems) {
-      this.nelems = nelems;
-    }
-
-    public boolean done() {
-      return (nelems <= 0);
-    }
-
-    public void incr() {
-      nelems--;
-    }
-  }
-
 }

Modified: hive/trunk/contrib/src/java/org/apache/hadoop/hive/contrib/util/typedbytes/TypedBytesRecordOutput.java
URL: http://svn.apache.org/viewvc/hive/trunk/contrib/src/java/org/apache/hadoop/hive/contrib/util/typedbytes/TypedBytesRecordOutput.java?rev=1597698&r1=1597697&r2=1597698&view=diff
==============================================================================
--- hive/trunk/contrib/src/java/org/apache/hadoop/hive/contrib/util/typedbytes/TypedBytesRecordOutput.java
(original)
+++ hive/trunk/contrib/src/java/org/apache/hadoop/hive/contrib/util/typedbytes/TypedBytesRecordOutput.java
Tue May 27 04:27:34 2014
@@ -23,14 +23,10 @@ import java.io.IOException;
 import java.util.ArrayList;
 import java.util.TreeMap;
 
-import org.apache.hadoop.record.Buffer;
-import org.apache.hadoop.record.Record;
-import org.apache.hadoop.record.RecordOutput;
-
 /**
  * Deserialized for records that reads typed bytes.
  */
-public class TypedBytesRecordOutput implements RecordOutput {
+public class TypedBytesRecordOutput {
 
   private TypedBytesOutput out;
 
@@ -51,7 +47,7 @@ public class TypedBytesRecordOutput impl
   /**
    * Get a thread-local typed bytes record input for the supplied
    * {@link TypedBytesOutput}.
-   * 
+   *
    * @param out
    *          typed bytes output object
    * @return typed bytes record output corresponding to the supplied
@@ -66,7 +62,7 @@ public class TypedBytesRecordOutput impl
   /**
    * Get a thread-local typed bytes record output for the supplied
    * {@link DataOutput}.
-   * 
+   *
    * @param out
    *          data output object
    * @return typed bytes record output corresponding to the supplied
@@ -90,10 +86,6 @@ public class TypedBytesRecordOutput impl
     out.writeBool(b);
   }
 
-  public void writeBuffer(Buffer buf, String tag) throws IOException {
-    out.writeBytes(buf.get());
-  }
-
   public void writeByte(byte b, String tag) throws IOException {
     out.writeByte(b);
   }
@@ -118,10 +110,6 @@ public class TypedBytesRecordOutput impl
     out.writeString(s);
   }
 
-  public void startRecord(Record r, String tag) throws IOException {
-    out.writeListHeader();
-  }
-
   public void startVector(ArrayList v, String tag) throws IOException {
     out.writeVectorHeader(v.size());
   }
@@ -130,10 +118,6 @@ public class TypedBytesRecordOutput impl
     out.writeMapHeader(m.size());
   }
 
-  public void endRecord(Record r, String tag) throws IOException {
-    out.writeListFooter();
-  }
-
   public void endVector(ArrayList v, String tag) throws IOException {
   }
 

Modified: hive/trunk/contrib/src/java/org/apache/hadoop/hive/contrib/util/typedbytes/TypedBytesWritableOutput.java
URL: http://svn.apache.org/viewvc/hive/trunk/contrib/src/java/org/apache/hadoop/hive/contrib/util/typedbytes/TypedBytesWritableOutput.java?rev=1597698&r1=1597697&r2=1597698&view=diff
==============================================================================
--- hive/trunk/contrib/src/java/org/apache/hadoop/hive/contrib/util/typedbytes/TypedBytesWritableOutput.java
(original)
+++ hive/trunk/contrib/src/java/org/apache/hadoop/hive/contrib/util/typedbytes/TypedBytesWritableOutput.java
Tue May 27 04:27:34 2014
@@ -44,7 +44,6 @@ import org.apache.hadoop.io.VLongWritabl
 import org.apache.hadoop.io.Writable;
 import org.apache.hadoop.io.WritableComparable;
 import org.apache.hadoop.io.WritableUtils;
-import org.apache.hadoop.record.Record;
 
 /**
  * Provides functionality for writing Writable objects as typed bytes.
@@ -139,8 +138,6 @@ public class TypedBytesWritableOutput {
       writeMap((MapWritable) w);
     } else if (w instanceof SortedMapWritable) {
       writeSortedMap((SortedMapWritable) w);
-    } else if (w instanceof Record) {
-      writeRecord((Record) w);
     } else if (w instanceof NullWritable || w == null) {
       writeNull();
     } else {
@@ -221,10 +218,6 @@ public class TypedBytesWritableOutput {
     }
   }
 
-  public void writeRecord(Record r) throws IOException {
-    r.serialize(TypedBytesRecordOutput.get(out));
-  }
-
   public void writeNull() throws IOException {
     out.writeNull();
   }



Mime
View raw message