AMashenkov commented on code in PR #1191:
URL: https://github.com/apache/ignite-3/pull/1191#discussion_r1000327527
##########
modules/table/src/integrationTest/java/org/apache/ignite/distributed/ItInternalTableScanTest.java:
##########
@@ -349,18 +349,18 @@ public void
testNullPointerExceptionIsThrownInCaseOfNullSubscription() {
* @param entryKey Key.
* @param entryVal Value
* @return {@link BinaryRow} based on given key and value.
- * @throws java.io.IOException If failed to close output stream that was
used to convertation.
*/
- private static @NotNull BinaryRow prepareRow(@NotNull String entryKey,
- @NotNull String entryVal) throws IOException {
- byte[] keyBytes = ByteUtils.toBytes(entryKey);
-
- try (ByteArrayOutputStream outputStream = new ByteArrayOutputStream())
{
- outputStream.write(keyBytes);
- outputStream.write(ByteUtils.toBytes(entryVal));
-
- return new ByteBufferRow(keyBytes);
- }
+ private static BinaryRow prepareRow(String entryKey, String entryVal) {
+ return new RowAssembler(
+ new SchemaDescriptor(
+ 1,
+ new Column[]{new Column("key",
NativeTypes.stringOf(100), false)},
+ new Column[]{new Column("val",
NativeTypes.stringOf(100), false)}
+ ), 1, 1
+ )
+ .appendString(Objects.requireNonNull(entryKey, "entryKey"))
+ .appendString(Objects.requireNonNull(entryVal, "entryVal"))
+ .build();
Review Comment:
Let's move schema to upper level.
```suggestion
private static BinaryRow prepareRow(SchemaDescriptor desc, Object...
values) {
assert values.length == desc.length();
RowAssembler asm = new RowAssembler(desc , 1, 1);
for (int i=0; i<values.length; i++){
assert values[i] != null || desc.column(i).nullable();
RowAssembler.writeValue(asm, desc.column(i), values[i]);
}
return asm.build();
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]