MCPcopy Create free account
hub / github.com/apache/pig / findType

Method findType

src/org/apache/pig/data/DataType.java:99–138  ·  view source on GitHub ↗

Determine the datatype of an object. @param o Object to test. @return byte code of the type, or ERROR if we don't know.

(Object o)

Source from the content-addressed store, hash-verified

97 * @return byte code of the type, or ERROR if we don't know.
98 */
99 public static byte findType(Object o) {
100 if (o == null) {
101 return NULL;
102 }
103
104 // Try to put the most common first
105 if (o instanceof DataByteArray) {
106 return BYTEARRAY;
107 } else if (o instanceof String) {
108 return CHARARRAY;
109 } else if (o instanceof Tuple) {
110 return TUPLE;
111 } else if (o instanceof DataBag) {
112 return BAG;
113 } else if (o instanceof Integer) {
114 return INTEGER;
115 } else if (o instanceof Long) {
116 return LONG;
117 } else if (o instanceof InternalMap) {
118 return INTERNALMAP;
119 } else if (o instanceof Map) {
120 return MAP;
121 } else if (o instanceof Float) {
122 return FLOAT;
123 } else if (o instanceof Double) {
124 return DOUBLE;
125 } else if (o instanceof Boolean) {
126 return BOOLEAN;
127 } else if (o instanceof DateTime) {
128 return DATETIME;
129 } else if (o instanceof Byte) {
130 return BYTE;
131 } else if (o instanceof BigInteger) {
132 return BIGINTEGER;
133 } else if (o instanceof BigDecimal) {
134 return BIGDECIMAL;
135 } else if (o instanceof WritableComparable) {
136 return GENERIC_WRITABLECOMPARABLE;
137 } else {return ERROR;}
138 }
139
140 /**
141 * Given a Type object determine the data type it represents. This isn't

Callers 15

putFieldMethod · 0.95
putNextMethod · 0.95
writeFieldAsStringMethod · 0.95
compareMethod · 0.95
isValidPigObjectMethod · 0.95
execMethod · 0.95
getFieldSchemaMethod · 0.95
schemaToTypeMethod · 0.95
getMutationsMethod · 0.95
getNextBigIntegerMethod · 0.95
getNextBigDecimalMethod · 0.95
getNextBooleanMethod · 0.95

Calls 1

extractTypeFromClassMethod · 0.95

Tested by 2

isValidPigObjectMethod · 0.76
execMethod · 0.76