public class TupleDesc
extends java.lang.Object
implements java.io.Serializable
Modifier and Type | Class and Description |
---|---|
static class |
TupleDesc.TDItem
A help class to facilitate organizing the information of each field
|
Modifier and Type | Field and Description |
---|---|
private static long |
serialVersionUID |
Constructor and Description |
---|
TupleDesc(Type[] typeAr)
Constructor.
|
TupleDesc(Type[] typeAr,
java.lang.String[] fieldAr)
Create a new TupleDesc with typeAr.length fields with fields of the
specified types, with associated named fields.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object o)
Compares the specified object with this TupleDesc for equality.
|
int |
fieldNameToIndex(java.lang.String name)
Find the index of the field with a given name.
|
java.lang.String |
getFieldName(int i)
Gets the (possibly null) field name of the ith field of this TupleDesc.
|
Type |
getFieldType(int i)
Gets the type of the ith field of this TupleDesc.
|
int |
getSize() |
int |
hashCode() |
java.util.Iterator<TupleDesc.TDItem> |
iterator() |
static TupleDesc |
merge(TupleDesc td1,
TupleDesc td2)
Merge two TupleDescs into one, with td1.numFields + td2.numFields fields,
with the first td1.numFields coming from td1 and the remaining from td2.
|
int |
numFields() |
java.lang.String |
toString()
Returns a String describing this descriptor.
|
private static final long serialVersionUID
public TupleDesc(Type[] typeAr, java.lang.String[] fieldAr)
typeAr
- array specifying the number of and types of fields in this
TupleDesc. It must contain at least one entry.fieldAr
- array specifying the names of the fields. Note that names may
be null.public TupleDesc(Type[] typeAr)
typeAr
- array specifying the number of and types of fields in this
TupleDesc. It must contain at least one entry.public java.util.Iterator<TupleDesc.TDItem> iterator()
public int numFields()
public java.lang.String getFieldName(int i) throws java.util.NoSuchElementException
i
- index of the field name to return. It must be a valid index.java.util.NoSuchElementException
- if i is not a valid field reference.public Type getFieldType(int i) throws java.util.NoSuchElementException
i
- The index of the field to get the type of. It must be a valid
index.java.util.NoSuchElementException
- if i is not a valid field reference.public int fieldNameToIndex(java.lang.String name) throws java.util.NoSuchElementException
name
- name of the field.java.util.NoSuchElementException
- if no field with a matching name is found.public int getSize()
public static TupleDesc merge(TupleDesc td1, TupleDesc td2)
td1
- The TupleDesc with the first fields of the new TupleDesctd2
- The TupleDesc with the last fields of the TupleDescpublic boolean equals(java.lang.Object o)
equals
in class java.lang.Object
o
- the Object to be compared for equality with this TupleDesc.public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object