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

Method format

src/org/apache/pig/impl/util/TupleFormat.java:46–79  ·  view source on GitHub ↗

Default implementation of format of tuple (each filed is delimited by tab) @param tuple @return Default format of Tuple

(Tuple tuple)

Source from the content-addressed store, hash-verified

44 * @return Default format of Tuple
45 */
46 @SuppressWarnings("unchecked")
47 public static String format(Tuple tuple) {
48 StringBuilder sb = new StringBuilder();
49 sb.append('(');
50 for (int i = 0; i < tuple.size(); ++i) {
51 try {
52 Object d = tuple.get(i);
53 if (d != null) {
54 if (d instanceof Map) {
55 sb.append(DataType.mapToString((Map<String, Object>) d));
56 } else if (d instanceof Tuple) {
57 Tuple t = (Tuple) d;
58 sb.append(TupleFormat.format(t));
59 } else if (d instanceof DataBag){
60 DataBag bag=(DataBag)d;
61 sb.append(BagFormat.format(bag));
62 }
63 else {
64 sb.append(d.toString());
65 }
66 } else {
67 sb.append("");
68 }
69 if (i != tuple.size() - 1)
70 sb.append(",");
71 } catch (ExecException e) {
72 e.printStackTrace();
73 mLog.warn("Exception when format tuple", e);
74 }
75
76 }
77 sb.append(')');
78 return sb.toString();
79 }
80}

Callers 7

testTupleFormatMethod · 0.95
serializeMethod · 0.95
testTupleWriteRead1Method · 0.95
serializeMethod · 0.95
processDumpMethod · 0.95
toStringMethod · 0.95
formatMethod · 0.95

Calls 7

mapToStringMethod · 0.95
formatMethod · 0.95
appendMethod · 0.65
sizeMethod · 0.65
getMethod · 0.65
warnMethod · 0.65
toStringMethod · 0.45

Tested by 4

testTupleFormatMethod · 0.76
serializeMethod · 0.76
testTupleWriteRead1Method · 0.76
serializeMethod · 0.76