Search in sources :

Example 1 with SimpleDataRow

use of org.apache.ignite.internal.storage.basic.SimpleDataRow in project ignite-3 by apache.

the class ItInternalTableScanTest method prepareDataRow.

/**
 * Helper method to convert key and value to {@link DataRow}.
 *
 * @param entryKey Key.
 * @param entryVal Value
 * @return {@link DataRow} based on given key and value.
 * @throws java.io.IOException If failed to close output stream that was used to convertation.
 */
@NotNull
private static DataRow prepareDataRow(@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 SimpleDataRow(keyBytes, outputStream.toByteArray());
    }
}
Also used : SimpleDataRow(org.apache.ignite.internal.storage.basic.SimpleDataRow) ByteArrayOutputStream(java.io.ByteArrayOutputStream) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 SimpleDataRow (org.apache.ignite.internal.storage.basic.SimpleDataRow)1 NotNull (org.jetbrains.annotations.NotNull)1