Skip to content

Commit

Permalink
Fix checkstyle errors
Browse files Browse the repository at this point in the history
  • Loading branch information
shnapz committed Dec 5, 2024
1 parent 439fe89 commit 01d9cc5
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,7 @@ static SqlFunction<ResultSet, Object> computeMapping(
return resultSet -> nullableBytes(resultSet.getBytes(column));
}
case ARRAY:
return resultSet -> {
// java.sql.Array arr = resultSet.getArray(column);
return resultSet.getArray(column);
};
return resultSet -> resultSet.getArray(column);
case BINARY:
case VARBINARY:
case LONGVARBINARY:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,8 @@ public ByteBuffer convertResultSetIntoAvroBytes() throws SQLException, IOExcepti
return ByteBuffer.wrap(out.getBufffer(), 0, out.size());
}

private void writeValue(Object value, BinaryEncoder binaryEncoder) throws SQLException, IOException {
private void writeValue(Object value, BinaryEncoder binaryEncoder)
throws SQLException, IOException {
if (value instanceof String) {
binaryEncoder.writeString((String) value);
} else if (value instanceof Long) {
Expand All @@ -121,7 +122,7 @@ private void writeValue(Object value, BinaryEncoder binaryEncoder) throws SQLExc
binaryEncoder.writeFloat((Float) value);
} else if (value instanceof java.sql.Array) {
binaryEncoder.writeArrayStart();
Object[] array = (Object[])((java.sql.Array)value).getArray();
Object[] array = (Object[]) ((java.sql.Array) value).getArray();
binaryEncoder.setItemCount(array.length);
for (Object arrayItem : array) {
binaryEncoder.startItem();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,8 @@ private static SchemaBuilder.FieldAssembler<Schema> createAvroFields(
SchemaBuilder.UnionAccumulator<SchemaBuilder.NullDefault<Schema>>>
fieldSchemaBuilder = field.type().unionOf().nullBuilder().endNull().and();

Integer arrayItemType = resultSet.isFirst() && columnType == ARRAY ?
resultSet.getArray(i).getBaseType() : null;
Integer arrayItemType = resultSet.isFirst() && columnType == ARRAY
? resultSet.getArray(i).getBaseType() : null;

final SchemaBuilder.UnionAccumulator<SchemaBuilder.NullDefault<Schema>> schemaFieldAssembler =
setAvroColumnType(
Expand Down
9 changes: 6 additions & 3 deletions dbeam-core/src/test/java/com/spotify/dbeam/Coffee.java
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public String insertStatement() {
updated().orElse(null),
uid(),
rownum(),
String.join(",", intArr().stream().map(x -> (CharSequence)x.toString())::iterator),
String.join(",", intArr().stream().map(x -> (CharSequence) x.toString())::iterator),
String.join("','", textArr()));
}

Expand Down Expand Up @@ -156,7 +156,9 @@ public static String ddl() {
add("rock");
add("scissors");
add("paper");
}});
}}
);

public static Coffee COFFEE2 =
create(
"colombian caffee",
Expand All @@ -180,5 +182,6 @@ public static String ddl() {
add("scissors");
add("paper");
add("rock");
}});
}}
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ public void shouldEncodeResultSetToValidAvro()
Assert.assertEquals(14, record.getSchema().getFields().size());
Assert.assertEquals(schema, record.getSchema());
List<String> actualTxtArray =
((GenericData.Array<Utf8>)record.get(13)).stream().map(x -> x.toString()).collect(
((GenericData.Array<Utf8>) record.get(13)).stream().map(x -> x.toString()).collect(
Collectors.toList());
final Coffee actual =
Coffee.create(
Expand All @@ -223,7 +223,7 @@ public void shouldEncodeResultSetToValidAvro()
Optional.ofNullable((Long) record.get(9)).map(Timestamp::new),
TestHelper.byteBufferToUuid((ByteBuffer) record.get(10)),
(Long) record.get(11),
new ArrayList<>((GenericData.Array<Integer>)record.get(12)),
new ArrayList<>((GenericData.Array<Integer>) record.get(12)),
actualTxtArray);
Assert.assertEquals(Coffee.COFFEE1, actual);
}
Expand Down

0 comments on commit 01d9cc5

Please sign in to comment.