Skip to content

Commit

Permalink
Format
Browse files Browse the repository at this point in the history
  • Loading branch information
dhutchis committed Aug 12, 2016
1 parent 4633a08 commit a4385eb
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 11 deletions.
Expand Up @@ -91,7 +91,7 @@ protected final TupleBatch fetchNextReady() throws DbException {
break;
default:
throw new UnsupportedOperationException(
"BinaryFileScan does not support the type "+schema.getColumnType(count));
"BinaryFileScan does not support the type " + schema.getColumnType(count));
}
building = true;
}
Expand Down
3 changes: 1 addition & 2 deletions src/edu/washington/escience/myria/operator/FileScan.java
Expand Up @@ -206,8 +206,7 @@ protected TupleBatch fetchNextReady() throws DbException, IOException {
switch (schema.getColumnType(column)) {
case BOOLEAN_TYPE:
Float f = Floats.tryParse(cell);
if (f != null)
buffer.putBoolean(column, f != 0);
if (f != null) buffer.putBoolean(column, f != 0);
else if (BooleanUtils.toBoolean(cell))
buffer.putBoolean(column, Boolean.parseBoolean(cell));
break;
Expand Down
Expand Up @@ -112,10 +112,15 @@ public void testNumRowsFromCosmo24Star() throws DbException {

@Test
public void testGenerateReadBinary() throws Exception {
Schema schema = new Schema(ImmutableList.of( // one of each
Type.BOOLEAN_TYPE, Type.DOUBLE_TYPE, Type.FLOAT_TYPE, Type.INT_TYPE,
Type.LONG_TYPE, Type.STRING_TYPE
));
Schema schema =
new Schema(
ImmutableList.of( // one of each
Type.BOOLEAN_TYPE,
Type.DOUBLE_TYPE,
Type.FLOAT_TYPE,
Type.INT_TYPE,
Type.LONG_TYPE,
Type.STRING_TYPE));
byte[] buf;
{
ByteArrayOutputStream bos = new ByteArrayOutputStream(1000);
Expand Down Expand Up @@ -147,7 +152,8 @@ private void generateBinaryFile(String filename, Type[] typeAr, int numrows) {
* @param stream The data stream to write data to. Does not close the stream.
*/
@SuppressWarnings("unused")
private void generateBinaryData(DataOutputStream stream, Type[] typeAr, int numrows) throws IOException {
private void generateBinaryData(DataOutputStream stream, Type[] typeAr, int numrows)
throws IOException {
for (int i = 0; i < numrows; i++) {
for (Type element : typeAr) {
switch (element) {
Expand All @@ -167,11 +173,10 @@ private void generateBinaryData(DataOutputStream stream, Type[] typeAr, int numr
stream.writeLong(i);
break;
case STRING_TYPE:
stream.writeUTF("string"+i);
stream.writeUTF("string" + i);
break;
default:
throw new UnsupportedOperationException(
"can only write fix length field to bin file");
throw new UnsupportedOperationException("can only write fix length field to bin file");
}
}
}
Expand Down

0 comments on commit a4385eb

Please sign in to comment.