io.deephaven.client.impl.SchemaBytesImpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of deephaven-java-client-flight Show documentation
Show all versions of deephaven-java-client-flight Show documentation
The Deephaven client flight library
//
// Copyright (c) 2016-2024 Deephaven Data Labs and Patent Pending
//
package io.deephaven.client.impl;
import com.google.auto.service.AutoService;
import com.google.flatbuffers.FlatBufferBuilder;
import io.deephaven.proto.flight.util.MessageHelper;
import io.deephaven.qst.table.TableHeader;
import org.apache.arrow.flatbuf.MessageHeader;
import org.apache.arrow.vector.types.pojo.Schema;
@AutoService(SchemaBytes.class)
public final class SchemaBytesImpl implements SchemaBytes {
@Override
public byte[] toSchemaBytes(TableHeader header) {
final Schema schema = SchemaAdapter.of(header);
final FlatBufferBuilder builder = new FlatBufferBuilder();
final int schemaOffset = schema.getSchema(builder);
final int messageOffset = MessageHelper.wrapInMessage(builder, schemaOffset, MessageHeader.Schema);
builder.finish(messageOffset);
return MessageHelper.toIpcBytes(builder);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy