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

Method genDataSetFile

test/org/apache/pig/test/TestMapReduce2.java:135–179  ·  view source on GitHub ↗

For generating a sample dataset

(boolean hasNulls, int dataLength )

Source from the content-addressed store, hash-verified

133 * For generating a sample dataset
134 */
135 private File genDataSetFile(boolean hasNulls, int dataLength ) throws IOException {
136
137 String[][] data = new String[dataLength][] ;
138
139 DecimalFormat formatter = new DecimalFormat("0000000");
140
141 if ( hasNulls == true ) {
142
143 for (int i = 0; i < dataLength; i++) {
144
145 data[i] = new String[2] ;
146 if ( i % 7 == 0 ) {
147 data[i][0] = "";
148 data[i][1] = formatter.format(dataLength - i);
149
150 } else if ( i % 10 ==0 ) {
151
152 data[i][0] = formatter.format(i % 10);
153 data[i][1] = "";
154
155 } else if ( i % 13 == 0 ) {
156
157 data[i][0] = "";
158 data[i][1] = "";
159
160 } else {
161 data[i][0] = formatter.format(i % 10);
162 data[i][1] = formatter.format(dataLength - i);
163 }
164 }
165
166 } else {
167
168
169 for (int i = 0; i < dataLength; i++) {
170 data[i] = new String[2] ;
171 data[i][0] = formatter.format(i % 10);
172 data[i][1] = formatter.format(dataLength - i);
173 }
174
175 }
176 File tmpFile = TestHelper.createTempFile(data) ;
177 tmpFile.deleteOnExit();
178 return tmpFile;
179 }
180}

Callers 4

testUnion1Method · 0.95
testUnion1WithNullsMethod · 0.95
testUnion2Method · 0.95
testUnion2WithNullsMethod · 0.95

Calls 2

createTempFileMethod · 0.95
formatMethod · 0.45

Tested by

no test coverage detected