Search in sources :

Example 6 with SchemaAware

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

the class ClientTableCommon method writeTuples.

/**
 * Writes multiple tuples.
 *
 * @param packer         Packer.
 * @param tuples         Tuples.
 * @param part           Which part of tuple to write.
 * @param schemaRegistry The registry.
 * @param skipHeader     Whether to skip the tuple header.
 * @throws IgniteException on failed serialization.
 */
public static void writeTuples(ClientMessagePacker packer, Collection<Tuple> tuples, TuplePart part, SchemaRegistry schemaRegistry, boolean skipHeader) {
    if (tuples == null || tuples.isEmpty()) {
        packer.packNil();
        return;
    }
    SchemaDescriptor schema = schemaRegistry.schema();
    packer.packInt(schema.version());
    packer.packInt(tuples.size());
    for (Tuple tuple : tuples) {
        assert tuple != null;
        assert schema.version() == ((SchemaAware) tuple).schema().version();
        writeTuple(packer, tuple, schema, skipHeader, part);
    }
}
Also used : SchemaDescriptor(org.apache.ignite.internal.schema.SchemaDescriptor) SchemaAware(org.apache.ignite.internal.schema.SchemaAware) Tuple(org.apache.ignite.table.Tuple)

Aggregations

SchemaAware (org.apache.ignite.internal.schema.SchemaAware)6 Tuple (org.apache.ignite.table.Tuple)5 ByteBufferRow (org.apache.ignite.internal.schema.ByteBufferRow)3 TupleMarshaller (org.apache.ignite.internal.schema.marshaller.TupleMarshaller)3 TupleMarshallerImpl (org.apache.ignite.internal.schema.marshaller.TupleMarshallerImpl)3 Row (org.apache.ignite.internal.schema.row.Row)3 DummySchemaManagerImpl (org.apache.ignite.internal.table.impl.DummySchemaManagerImpl)3 Test (org.junit.jupiter.api.Test)3 SchemaDescriptor (org.apache.ignite.internal.schema.SchemaDescriptor)2 HashMap (java.util.HashMap)1 Column (org.apache.ignite.internal.schema.Column)1 Columns (org.apache.ignite.internal.schema.Columns)1 SchemaMismatchException (org.apache.ignite.internal.schema.SchemaMismatchException)1 NotNull (org.jetbrains.annotations.NotNull)1