org.apache.hadoop.record.RecordInput Java Examples
The following examples show how to use
org.apache.hadoop.record.RecordInput.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: StructTypeID.java From hadoop with Apache License 2.0 | 5 votes |
void read(RecordInput rin, String tag) throws IOException { // number of elements int numElems = rin.readInt(tag); for (int i=0; i<numElems; i++) { typeInfos.add(genericReadTypeInfo(rin, tag)); } }
Example #2
Source File: StructTypeID.java From hadoop-gpu with Apache License 2.0 | 5 votes |
void read(RecordInput rin, String tag) throws IOException { // number of elements int numElems = rin.readInt(tag); for (int i=0; i<numElems; i++) { typeInfos.add(genericReadTypeInfo(rin, tag)); } }
Example #3
Source File: RecordTypeInfo.java From hadoop-gpu with Apache License 2.0 | 5 votes |
/** * Deserialize the type information for a record */ public void deserialize(RecordInput rin, String tag) throws IOException { // read in any header, version info rin.startRecord(tag); // name this.name = rin.readString(tag); sTid.read(rin, tag); rin.endRecord(tag); }
Example #4
Source File: StructTypeID.java From RDFS with Apache License 2.0 | 5 votes |
void read(RecordInput rin, String tag) throws IOException { // number of elements int numElems = rin.readInt(tag); for (int i=0; i<numElems; i++) { typeInfos.add(genericReadTypeInfo(rin, tag)); } }
Example #5
Source File: RecordTypeInfo.java From RDFS with Apache License 2.0 | 5 votes |
/** * Deserialize the type information for a record */ public void deserialize(RecordInput rin, String tag) throws IOException { // read in any header, version info rin.startRecord(tag); // name this.name = rin.readString(tag); sTid.read(rin, tag); rin.endRecord(tag); }
Example #6
Source File: StructTypeID.java From big-c with Apache License 2.0 | 5 votes |
void read(RecordInput rin, String tag) throws IOException { // number of elements int numElems = rin.readInt(tag); for (int i=0; i<numElems; i++) { typeInfos.add(genericReadTypeInfo(rin, tag)); } }
Example #7
Source File: RecordTypeInfo.java From big-c with Apache License 2.0 | 5 votes |
/** * Deserialize the type information for a record */ @Override public void deserialize(RecordInput rin, String tag) throws IOException { // read in any header, version info rin.startRecord(tag); // name this.name = rin.readString(tag); sTid.read(rin, tag); rin.endRecord(tag); }
Example #8
Source File: RecordTypeInfo.java From hadoop with Apache License 2.0 | 5 votes |
/** * Deserialize the type information for a record */ @Override public void deserialize(RecordInput rin, String tag) throws IOException { // read in any header, version info rin.startRecord(tag); // name this.name = rin.readString(tag); sTid.read(rin, tag); rin.endRecord(tag); }
Example #9
Source File: StructTypeID.java From big-c with Apache License 2.0 | 4 votes |
private FieldTypeInfo genericReadTypeInfo(RecordInput rin, String tag) throws IOException { String fieldName = rin.readString(tag); TypeID id = genericReadTypeID(rin, tag); return new FieldTypeInfo(fieldName, id); }
Example #10
Source File: StructTypeID.java From big-c with Apache License 2.0 | 4 votes |
private TypeID genericReadTypeID(RecordInput rin, String tag) throws IOException { byte typeVal = rin.readByte(tag); switch (typeVal) { case TypeID.RIOType.BOOL: return TypeID.BoolTypeID; case TypeID.RIOType.BUFFER: return TypeID.BufferTypeID; case TypeID.RIOType.BYTE: return TypeID.ByteTypeID; case TypeID.RIOType.DOUBLE: return TypeID.DoubleTypeID; case TypeID.RIOType.FLOAT: return TypeID.FloatTypeID; case TypeID.RIOType.INT: return TypeID.IntTypeID; case TypeID.RIOType.LONG: return TypeID.LongTypeID; case TypeID.RIOType.MAP: { TypeID tIDKey = genericReadTypeID(rin, tag); TypeID tIDValue = genericReadTypeID(rin, tag); return new MapTypeID(tIDKey, tIDValue); } case TypeID.RIOType.STRING: return TypeID.StringTypeID; case TypeID.RIOType.STRUCT: { StructTypeID stID = new StructTypeID(); int numElems = rin.readInt(tag); for (int i=0; i<numElems; i++) { stID.add(genericReadTypeInfo(rin, tag)); } return stID; } case TypeID.RIOType.VECTOR: { TypeID tID = genericReadTypeID(rin, tag); return new VectorTypeID(tID); } default: // shouldn't be here throw new IOException("Unknown type read"); } }
Example #11
Source File: Utils.java From big-c with Apache License 2.0 | 4 votes |
/** * read/skip bytes from stream based on a type */ public static void skip(RecordInput rin, String tag, TypeID typeID) throws IOException { switch (typeID.typeVal) { case TypeID.RIOType.BOOL: rin.readBool(tag); break; case TypeID.RIOType.BUFFER: rin.readBuffer(tag); break; case TypeID.RIOType.BYTE: rin.readByte(tag); break; case TypeID.RIOType.DOUBLE: rin.readDouble(tag); break; case TypeID.RIOType.FLOAT: rin.readFloat(tag); break; case TypeID.RIOType.INT: rin.readInt(tag); break; case TypeID.RIOType.LONG: rin.readLong(tag); break; case TypeID.RIOType.MAP: org.apache.hadoop.record.Index midx1 = rin.startMap(tag); MapTypeID mtID = (MapTypeID) typeID; for (; !midx1.done(); midx1.incr()) { skip(rin, tag, mtID.getKeyTypeID()); skip(rin, tag, mtID.getValueTypeID()); } rin.endMap(tag); break; case TypeID.RIOType.STRING: rin.readString(tag); break; case TypeID.RIOType.STRUCT: rin.startRecord(tag); // read past each field in the struct StructTypeID stID = (StructTypeID) typeID; Iterator<FieldTypeInfo> it = stID.getFieldTypeInfos().iterator(); while (it.hasNext()) { FieldTypeInfo tInfo = it.next(); skip(rin, tag, tInfo.getTypeID()); } rin.endRecord(tag); break; case TypeID.RIOType.VECTOR: org.apache.hadoop.record.Index vidx1 = rin.startVector(tag); VectorTypeID vtID = (VectorTypeID) typeID; for (; !vidx1.done(); vidx1.incr()) { skip(rin, tag, vtID.getElementTypeID()); } rin.endVector(tag); break; default: // shouldn't be here throw new IOException("Unknown typeID when skipping bytes"); } }
Example #12
Source File: Utils.java From hadoop with Apache License 2.0 | 4 votes |
/** * read/skip bytes from stream based on a type */ public static void skip(RecordInput rin, String tag, TypeID typeID) throws IOException { switch (typeID.typeVal) { case TypeID.RIOType.BOOL: rin.readBool(tag); break; case TypeID.RIOType.BUFFER: rin.readBuffer(tag); break; case TypeID.RIOType.BYTE: rin.readByte(tag); break; case TypeID.RIOType.DOUBLE: rin.readDouble(tag); break; case TypeID.RIOType.FLOAT: rin.readFloat(tag); break; case TypeID.RIOType.INT: rin.readInt(tag); break; case TypeID.RIOType.LONG: rin.readLong(tag); break; case TypeID.RIOType.MAP: org.apache.hadoop.record.Index midx1 = rin.startMap(tag); MapTypeID mtID = (MapTypeID) typeID; for (; !midx1.done(); midx1.incr()) { skip(rin, tag, mtID.getKeyTypeID()); skip(rin, tag, mtID.getValueTypeID()); } rin.endMap(tag); break; case TypeID.RIOType.STRING: rin.readString(tag); break; case TypeID.RIOType.STRUCT: rin.startRecord(tag); // read past each field in the struct StructTypeID stID = (StructTypeID) typeID; Iterator<FieldTypeInfo> it = stID.getFieldTypeInfos().iterator(); while (it.hasNext()) { FieldTypeInfo tInfo = it.next(); skip(rin, tag, tInfo.getTypeID()); } rin.endRecord(tag); break; case TypeID.RIOType.VECTOR: org.apache.hadoop.record.Index vidx1 = rin.startVector(tag); VectorTypeID vtID = (VectorTypeID) typeID; for (; !vidx1.done(); vidx1.incr()) { skip(rin, tag, vtID.getElementTypeID()); } rin.endVector(tag); break; default: // shouldn't be here throw new IOException("Unknown typeID when skipping bytes"); } }
Example #13
Source File: StructTypeID.java From hadoop with Apache License 2.0 | 4 votes |
private TypeID genericReadTypeID(RecordInput rin, String tag) throws IOException { byte typeVal = rin.readByte(tag); switch (typeVal) { case TypeID.RIOType.BOOL: return TypeID.BoolTypeID; case TypeID.RIOType.BUFFER: return TypeID.BufferTypeID; case TypeID.RIOType.BYTE: return TypeID.ByteTypeID; case TypeID.RIOType.DOUBLE: return TypeID.DoubleTypeID; case TypeID.RIOType.FLOAT: return TypeID.FloatTypeID; case TypeID.RIOType.INT: return TypeID.IntTypeID; case TypeID.RIOType.LONG: return TypeID.LongTypeID; case TypeID.RIOType.MAP: { TypeID tIDKey = genericReadTypeID(rin, tag); TypeID tIDValue = genericReadTypeID(rin, tag); return new MapTypeID(tIDKey, tIDValue); } case TypeID.RIOType.STRING: return TypeID.StringTypeID; case TypeID.RIOType.STRUCT: { StructTypeID stID = new StructTypeID(); int numElems = rin.readInt(tag); for (int i=0; i<numElems; i++) { stID.add(genericReadTypeInfo(rin, tag)); } return stID; } case TypeID.RIOType.VECTOR: { TypeID tID = genericReadTypeID(rin, tag); return new VectorTypeID(tID); } default: // shouldn't be here throw new IOException("Unknown type read"); } }
Example #14
Source File: StructTypeID.java From RDFS with Apache License 2.0 | 4 votes |
private FieldTypeInfo genericReadTypeInfo(RecordInput rin, String tag) throws IOException { String fieldName = rin.readString(tag); TypeID id = genericReadTypeID(rin, tag); return new FieldTypeInfo(fieldName, id); }
Example #15
Source File: StructTypeID.java From RDFS with Apache License 2.0 | 4 votes |
private TypeID genericReadTypeID(RecordInput rin, String tag) throws IOException { byte typeVal = rin.readByte(tag); switch (typeVal) { case TypeID.RIOType.BOOL: return TypeID.BoolTypeID; case TypeID.RIOType.BUFFER: return TypeID.BufferTypeID; case TypeID.RIOType.BYTE: return TypeID.ByteTypeID; case TypeID.RIOType.DOUBLE: return TypeID.DoubleTypeID; case TypeID.RIOType.FLOAT: return TypeID.FloatTypeID; case TypeID.RIOType.INT: return TypeID.IntTypeID; case TypeID.RIOType.LONG: return TypeID.LongTypeID; case TypeID.RIOType.MAP: { TypeID tIDKey = genericReadTypeID(rin, tag); TypeID tIDValue = genericReadTypeID(rin, tag); return new MapTypeID(tIDKey, tIDValue); } case TypeID.RIOType.STRING: return TypeID.StringTypeID; case TypeID.RIOType.STRUCT: { StructTypeID stID = new StructTypeID(); int numElems = rin.readInt(tag); for (int i=0; i<numElems; i++) { stID.add(genericReadTypeInfo(rin, tag)); } return stID; } case TypeID.RIOType.VECTOR: { TypeID tID = genericReadTypeID(rin, tag); return new VectorTypeID(tID); } default: // shouldn't be here throw new IOException("Unknown type read"); } }
Example #16
Source File: Utils.java From RDFS with Apache License 2.0 | 4 votes |
/** * read/skip bytes from stream based on a type */ public static void skip(RecordInput rin, String tag, TypeID typeID) throws IOException { switch (typeID.typeVal) { case TypeID.RIOType.BOOL: rin.readBool(tag); break; case TypeID.RIOType.BUFFER: rin.readBuffer(tag); break; case TypeID.RIOType.BYTE: rin.readByte(tag); break; case TypeID.RIOType.DOUBLE: rin.readDouble(tag); break; case TypeID.RIOType.FLOAT: rin.readFloat(tag); break; case TypeID.RIOType.INT: rin.readInt(tag); break; case TypeID.RIOType.LONG: rin.readLong(tag); break; case TypeID.RIOType.MAP: org.apache.hadoop.record.Index midx1 = rin.startMap(tag); MapTypeID mtID = (MapTypeID) typeID; for (; !midx1.done(); midx1.incr()) { skip(rin, tag, mtID.getKeyTypeID()); skip(rin, tag, mtID.getValueTypeID()); } rin.endMap(tag); break; case TypeID.RIOType.STRING: rin.readString(tag); break; case TypeID.RIOType.STRUCT: rin.startRecord(tag); // read past each field in the struct StructTypeID stID = (StructTypeID) typeID; Iterator<FieldTypeInfo> it = stID.getFieldTypeInfos().iterator(); while (it.hasNext()) { FieldTypeInfo tInfo = it.next(); skip(rin, tag, tInfo.getTypeID()); } rin.endRecord(tag); break; case TypeID.RIOType.VECTOR: org.apache.hadoop.record.Index vidx1 = rin.startVector(tag); VectorTypeID vtID = (VectorTypeID) typeID; for (; !vidx1.done(); vidx1.incr()) { skip(rin, tag, vtID.getElementTypeID()); } rin.endVector(tag); break; default: // shouldn't be here throw new IOException("Unknown typeID when skipping bytes"); } }
Example #17
Source File: StructTypeID.java From hadoop with Apache License 2.0 | 4 votes |
private FieldTypeInfo genericReadTypeInfo(RecordInput rin, String tag) throws IOException { String fieldName = rin.readString(tag); TypeID id = genericReadTypeID(rin, tag); return new FieldTypeInfo(fieldName, id); }
Example #18
Source File: StructTypeID.java From hadoop-gpu with Apache License 2.0 | 4 votes |
private FieldTypeInfo genericReadTypeInfo(RecordInput rin, String tag) throws IOException { String fieldName = rin.readString(tag); TypeID id = genericReadTypeID(rin, tag); return new FieldTypeInfo(fieldName, id); }
Example #19
Source File: StructTypeID.java From hadoop-gpu with Apache License 2.0 | 4 votes |
private TypeID genericReadTypeID(RecordInput rin, String tag) throws IOException { byte typeVal = rin.readByte(tag); switch (typeVal) { case TypeID.RIOType.BOOL: return TypeID.BoolTypeID; case TypeID.RIOType.BUFFER: return TypeID.BufferTypeID; case TypeID.RIOType.BYTE: return TypeID.ByteTypeID; case TypeID.RIOType.DOUBLE: return TypeID.DoubleTypeID; case TypeID.RIOType.FLOAT: return TypeID.FloatTypeID; case TypeID.RIOType.INT: return TypeID.IntTypeID; case TypeID.RIOType.LONG: return TypeID.LongTypeID; case TypeID.RIOType.MAP: { TypeID tIDKey = genericReadTypeID(rin, tag); TypeID tIDValue = genericReadTypeID(rin, tag); return new MapTypeID(tIDKey, tIDValue); } case TypeID.RIOType.STRING: return TypeID.StringTypeID; case TypeID.RIOType.STRUCT: { StructTypeID stID = new StructTypeID(); int numElems = rin.readInt(tag); for (int i=0; i<numElems; i++) { stID.add(genericReadTypeInfo(rin, tag)); } return stID; } case TypeID.RIOType.VECTOR: { TypeID tID = genericReadTypeID(rin, tag); return new VectorTypeID(tID); } default: // shouldn't be here throw new IOException("Unknown type read"); } }
Example #20
Source File: Utils.java From hadoop-gpu with Apache License 2.0 | 4 votes |
/** * read/skip bytes from stream based on a type */ public static void skip(RecordInput rin, String tag, TypeID typeID) throws IOException { switch (typeID.typeVal) { case TypeID.RIOType.BOOL: rin.readBool(tag); break; case TypeID.RIOType.BUFFER: rin.readBuffer(tag); break; case TypeID.RIOType.BYTE: rin.readByte(tag); break; case TypeID.RIOType.DOUBLE: rin.readDouble(tag); break; case TypeID.RIOType.FLOAT: rin.readFloat(tag); break; case TypeID.RIOType.INT: rin.readInt(tag); break; case TypeID.RIOType.LONG: rin.readLong(tag); break; case TypeID.RIOType.MAP: org.apache.hadoop.record.Index midx1 = rin.startMap(tag); MapTypeID mtID = (MapTypeID) typeID; for (; !midx1.done(); midx1.incr()) { skip(rin, tag, mtID.getKeyTypeID()); skip(rin, tag, mtID.getValueTypeID()); } rin.endMap(tag); break; case TypeID.RIOType.STRING: rin.readString(tag); break; case TypeID.RIOType.STRUCT: rin.startRecord(tag); // read past each field in the struct StructTypeID stID = (StructTypeID) typeID; Iterator<FieldTypeInfo> it = stID.getFieldTypeInfos().iterator(); while (it.hasNext()) { FieldTypeInfo tInfo = it.next(); skip(rin, tag, tInfo.getTypeID()); } rin.endRecord(tag); break; case TypeID.RIOType.VECTOR: org.apache.hadoop.record.Index vidx1 = rin.startVector(tag); VectorTypeID vtID = (VectorTypeID) typeID; for (; !vidx1.done(); vidx1.incr()) { skip(rin, tag, vtID.getElementTypeID()); } rin.endVector(tag); break; default: // shouldn't be here throw new IOException("Unknown typeID when skipping bytes"); } }