Search in sources :

Example 11 with RowAssembler

use of org.apache.ignite.internal.schema.row.RowAssembler in project ignite-3 by apache.

the class RecordMarshallerImpl method marshalKey.

/**
 * {@inheritDoc}
 */
@Override
public BinaryRow marshalKey(@NotNull R rec) throws MarshallerException {
    assert recClass.isInstance(rec);
    final RowAssembler asm = createAssembler(Objects.requireNonNull(rec), null);
    keyMarsh.writeObject(rec, asm);
    return new ByteBufferRow(asm.toBytes());
}
Also used : ByteBufferRow(org.apache.ignite.internal.schema.ByteBufferRow) RowAssembler(org.apache.ignite.internal.schema.row.RowAssembler)

Example 12 with RowAssembler

use of org.apache.ignite.internal.schema.row.RowAssembler in project ignite-3 by apache.

the class PartitionCommandListenerTest method getTestRow.

/**
 * Prepares a test row which contains key and value fields.
 *
 * @return Row.
 */
@NotNull
private Row getTestRow(int key, int val) {
    RowAssembler rowBuilder = new RowAssembler(SCHEMA, 0, 0);
    rowBuilder.appendInt(key);
    rowBuilder.appendInt(val);
    return new Row(SCHEMA, rowBuilder.build());
}
Also used : RowAssembler(org.apache.ignite.internal.schema.row.RowAssembler) Row(org.apache.ignite.internal.schema.row.Row) BinaryRow(org.apache.ignite.internal.schema.BinaryRow) NotNull(org.jetbrains.annotations.NotNull) Assertions.assertNotNull(org.junit.jupiter.api.Assertions.assertNotNull)

Example 13 with RowAssembler

use of org.apache.ignite.internal.schema.row.RowAssembler in project ignite-3 by apache.

the class KvMarshallerImpl method marshal.

/**
 * {@inheritDoc}
 */
@Override
public BinaryRow marshal(@NotNull K key, V val) throws MarshallerException {
    assert keyClass.isInstance(key);
    assert val == null || valClass.isInstance(val);
    final RowAssembler asm = createAssembler(key, val);
    keyMarsh.writeObject(key, asm);
    valMarsh.writeObject(val, asm);
    return new ByteBufferRow(asm.toBytes());
}
Also used : ByteBufferRow(org.apache.ignite.internal.schema.ByteBufferRow) RowAssembler(org.apache.ignite.internal.schema.row.RowAssembler)

Example 14 with RowAssembler

use of org.apache.ignite.internal.schema.row.RowAssembler in project ignite-3 by apache.

the class RecordMarshallerImpl method marshal.

/**
 * {@inheritDoc}
 */
@Override
public BinaryRow marshal(@NotNull R rec) throws MarshallerException {
    assert recClass.isInstance(rec);
    final RowAssembler asm = createAssembler(Objects.requireNonNull(rec), rec);
    recMarsh.writeObject(rec, asm);
    return new ByteBufferRow(asm.toBytes());
}
Also used : ByteBufferRow(org.apache.ignite.internal.schema.ByteBufferRow) RowAssembler(org.apache.ignite.internal.schema.row.RowAssembler)

Example 15 with RowAssembler

use of org.apache.ignite.internal.schema.row.RowAssembler in project ignite-3 by apache.

the class PartitionCommandListenerTest method getTestKey.

/**
 * Prepares a test row which contains only key field.
 *
 * @return Row.
 */
@NotNull
private Row getTestKey(int key) {
    RowAssembler rowBuilder = new RowAssembler(SCHEMA, 0, 0);
    rowBuilder.appendInt(key);
    return new Row(SCHEMA, rowBuilder.build());
}
Also used : RowAssembler(org.apache.ignite.internal.schema.row.RowAssembler) Row(org.apache.ignite.internal.schema.row.Row) BinaryRow(org.apache.ignite.internal.schema.BinaryRow) NotNull(org.jetbrains.annotations.NotNull) Assertions.assertNotNull(org.junit.jupiter.api.Assertions.assertNotNull)

Aggregations

RowAssembler (org.apache.ignite.internal.schema.row.RowAssembler)34 Test (org.junit.jupiter.api.Test)16 Row (org.apache.ignite.internal.schema.row.Row)13 Column (org.apache.ignite.internal.schema.Column)10 ByteBufferRow (org.apache.ignite.internal.schema.ByteBufferRow)6 BinaryRow (org.apache.ignite.internal.schema.BinaryRow)5 TestSimpleObject (org.apache.ignite.internal.schema.testobjects.TestSimpleObject)4 BigInteger (java.math.BigInteger)3 RelReferentialConstraint (org.apache.calcite.rel.RelReferentialConstraint)3 SchemaDescriptor (org.apache.ignite.internal.schema.SchemaDescriptor)3 NotNull (org.jetbrains.annotations.NotNull)3 Columns (org.apache.ignite.internal.schema.Columns)2 Object2IntOpenHashMap (it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap)1 ManagementFactory (java.lang.management.ManagementFactory)1 ThreadInfo (java.lang.management.ThreadInfo)1 ThreadMXBean (java.lang.management.ThreadMXBean)1 BigDecimal (java.math.BigDecimal)1 Instant (java.time.Instant)1 LocalDate (java.time.LocalDate)1 LocalDateTime (java.time.LocalDateTime)1