Class BarrageUtil
java.lang.Object
io.deephaven.extensions.barrage.util.BarrageUtil
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe deephaven metadata tag to indicate the deephaven column component type.static final StringThe Apache Arrow metadata prefix for Deephaven attributes.static final StringThe deephaven metadata tag to indicate the deephaven column type.static final BarrageSnapshotOptionsstatic final BarrageSubscriptionOptionsstatic final longstatic final longstatic final longstatic final org.apache.arrow.vector.types.pojo.ArrowType.DurationBy default we'll use nanosecond resolution for Duration columns.static final org.apache.arrow.vector.types.pojo.ArrowType.TimestampNote that arrow's wire format states that Timestamps without timezones are not UTC -- that they are no timezone at all.static final StringThe name of the attribute that indicates that a table is flat.static final double -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic org.apache.arrow.vector.types.pojo.FieldarrowFieldFor(String name, Class<?> type, Class<?> componentType, Map<String, String> metadata, boolean columnAsList) attributesToMetadata(@NotNull Map<String, Object> attributes) attributesToMetadata(@NotNull Map<String, Object> attributes, boolean isFlat) static Stream<org.apache.arrow.vector.types.pojo.Field>columnDefinitionsToFields(@NotNull Map<String, String> columnDescriptions, @Nullable InputTableUpdater inputTableUpdater, @NotNull TableDefinition tableDefinition, @NotNull Collection<ColumnDefinition<?>> columnDefinitions, @NotNull Function<String, Map<String, String>> fieldMetadataFactory, @NotNull Map<String, Object> attributes) static Stream<org.apache.arrow.vector.types.pojo.Field>columnDefinitionsToFields(@NotNull Map<String, String> columnDescriptions, @Nullable InputTableUpdater inputTableUpdater, @NotNull TableDefinition tableDefinition, @NotNull Collection<ColumnDefinition<?>> columnDefinitions, @NotNull Function<String, Map<String, String>> fieldMetadataFactory, @NotNull Map<String, Object> attributes, boolean columnsAsList) convertArrowSchema(@NotNull ExportedTableCreationResponse response) convertArrowSchema(org.apache.arrow.flatbuf.Schema schema) convertArrowSchema(org.apache.arrow.flatbuf.Schema schema, @Nullable BarrageOptions options) convertArrowSchema(org.apache.arrow.vector.types.pojo.Schema schema) convertArrowSchema(org.apache.arrow.vector.types.pojo.Schema schema, BarrageOptions options) static TableDefinitionconvertTableDefinition(@NotNull ExportedTableCreationResponse response) static voidcreateAndSendSnapshot(BarrageMessageWriter.Factory bwmFactory, BaseTable<?> table, BitSet columns, RowSet viewport, boolean reverseViewport, BarrageSnapshotOptions options, io.grpc.stub.StreamObserver<BarrageMessageWriter.MessageView> listener, BarragePerformanceLog.SnapshotMetricsHelper metrics) static voidcreateAndSendStaticSnapshot(BarrageMessageWriter.Factory bmwFactory, BaseTable<?> table, BitSet columns, RowSet viewport, boolean reverseViewport, BarrageSnapshotOptions snapshotRequestOptions, io.grpc.stub.StreamObserver<BarrageMessageWriter.MessageView> listener, BarragePerformanceLog.SnapshotMetricsHelper metrics) static byte[]createSerializationOptionsMetadataBytes(@org.jetbrains.annotations.NotNull byte[] ticketId, @Nullable BarrageSubscriptionOptions options) Create a snapshot request payload to be sent via DoExchange.static byte[]createSnapshotRequestMetadataBytes(@org.jetbrains.annotations.NotNull byte[] ticketId, @Nullable BarrageSnapshotOptions options) Create a snapshot request payload to be sent via DoExchange.static byte[]createSnapshotRequestMetadataBytes(@org.jetbrains.annotations.NotNull byte[] ticketId, @Nullable BarrageSnapshotOptions options, @Nullable RowSet viewport, @Nullable BitSet columns, boolean reverseViewport) Create a subscription request payload to be sent via DoExchange.static byte[]createSubscriptionRequestMetadataBytes(@org.jetbrains.annotations.NotNull byte[] ticketId, @Nullable BarrageSubscriptionOptions options) Create a subscription request payload to be sent via DoExchange.static byte[]createSubscriptionRequestMetadataBytes(@org.jetbrains.annotations.NotNull byte[] ticketId, @Nullable BarrageSubscriptionOptions options, @Nullable RowSet viewport, @Nullable BitSet columns, boolean reverseViewport) Create a subscription request payload to be sent via DoExchange.static byte[]createSubscriptionRequestMetadataBytes(@org.jetbrains.annotations.NotNull byte[] ticketId, @Nullable BarrageSubscriptionOptions options, @Nullable ByteBuffer viewportBuffer, @org.jetbrains.annotations.Nullable byte[] columns, boolean reverseViewport, byte requestType) Create a subscription request payload to be sent via DoExchange.static org.apache.arrow.flatbuf.FieldflatbufFieldFor(ColumnDefinition<?> columnDefinition, Map<String, String> metadata) static org.apache.arrow.flatbuf.Fieldstatic BarrageTypeInfo<org.apache.arrow.vector.types.pojo.Field>getDefaultType(@NotNull org.apache.arrow.vector.types.pojo.Field field) static org.apache.arrow.vector.types.pojo.SchemamakeSchema(@NotNull BarrageOptions options, @NotNull TableDefinition tableDefinition, @NotNull Map<String, Object> attributes, boolean isFlat) static intmakeTableSchemaPayload(@NotNull com.google.flatbuffers.FlatBufferBuilder builder, @NotNull BarrageOptions options, @NotNull TableDefinition tableDefinition, @NotNull Map<String, Object> attributes, boolean isFlat) static voidstatic com.google.protobuf.ByteStringschemaBytes(@NotNull ToIntFunction<com.google.flatbuffers.FlatBufferBuilder> schemaPayloadWriter) static com.google.protobuf.ByteStringschemaBytesFromTable(@NotNull Table table) static com.google.protobuf.ByteStringschemaBytesFromTableDefinition(@NotNull TableDefinition tableDefinition, @NotNull Map<String, Object> attributes, boolean isFlat) static org.apache.arrow.vector.types.pojo.SchemaschemaFromTable(@NotNull Table table) static org.apache.arrow.vector.types.pojo.SchematoSchema(TableDefinition definition, Map<String, Object> attributes, boolean isFlat)
-
Field Details
-
DEFAULT_SUBSCRIPTION_OPTIONS
-
DEFAULT_SNAPSHOT_OPTIONS
-
FLATBUFFER_MAGIC
public static final long FLATBUFFER_MAGIC- See Also:
-
TARGET_SNAPSHOT_PERCENTAGE
public static final double TARGET_SNAPSHOT_PERCENTAGE -
MIN_SNAPSHOT_CELL_COUNT
public static final long MIN_SNAPSHOT_CELL_COUNT -
MAX_SNAPSHOT_CELL_COUNT
public static final long MAX_SNAPSHOT_CELL_COUNT -
NANO_SINCE_EPOCH_TYPE
public static final org.apache.arrow.vector.types.pojo.ArrowType.Timestamp NANO_SINCE_EPOCH_TYPENote that arrow's wire format states that Timestamps without timezones are not UTC -- that they are no timezone at all. It's very important that we mark these times as UTC. -
NANO_DURATION_TYPE
public static final org.apache.arrow.vector.types.pojo.ArrowType.Duration NANO_DURATION_TYPEBy default we'll use nanosecond resolution for Duration columns. -
TABLE_ATTRIBUTE_IS_FLAT
The name of the attribute that indicates that a table is flat.- See Also:
-
ATTR_DH_PREFIX
The Apache Arrow metadata prefix for Deephaven attributes.- See Also:
-
ATTR_TYPE_TAG
The deephaven metadata tag to indicate the deephaven column type.- See Also:
-
ATTR_COMPONENT_TYPE_TAG
The deephaven metadata tag to indicate the deephaven column component type.- See Also:
-
-
Constructor Details
-
BarrageUtil
public BarrageUtil()
-
-
Method Details
-
createSubscriptionRequestMetadataBytes
public static byte[] createSubscriptionRequestMetadataBytes(@NotNull @org.jetbrains.annotations.NotNull byte[] ticketId, @Nullable @Nullable BarrageSubscriptionOptions options) Create a subscription request payload to be sent via DoExchange.- Parameters:
ticketId- the ticket id of the table to subscribe tooptions- the barrage options- Returns:
- the subscription request payload
-
createSubscriptionRequestMetadataBytes
public static byte[] createSubscriptionRequestMetadataBytes(@NotNull @org.jetbrains.annotations.NotNull byte[] ticketId, @Nullable @Nullable BarrageSubscriptionOptions options, @Nullable @Nullable RowSet viewport, @Nullable @Nullable BitSet columns, boolean reverseViewport) Create a subscription request payload to be sent via DoExchange.- Parameters:
ticketId- the ticket id of the table to subscribe tooptions- the barrage optionsviewport- the viewport to subscribe tocolumns- the columns to subscribe toreverseViewport- whether to reverse the viewport- Returns:
- the subscription request payload
-
createSubscriptionRequestMetadataBytes
public static byte[] createSubscriptionRequestMetadataBytes(@NotNull @org.jetbrains.annotations.NotNull byte[] ticketId, @Nullable @Nullable BarrageSubscriptionOptions options, @Nullable @Nullable ByteBuffer viewportBuffer, @Nullable @org.jetbrains.annotations.Nullable byte[] columns, boolean reverseViewport, byte requestType) Create a subscription request payload to be sent via DoExchange.- Parameters:
ticketId- the ticket id of the table to subscribe tooptions- the barrage optionsviewportBuffer- the viewport to subscribe to, already converted to a ByteBuffercolumns- the columns to subscribe toreverseViewport- whether to reverse the viewportrequestType- the type of the request- Returns:
- the subscription request payload
-
createSnapshotRequestMetadataBytes
public static byte[] createSnapshotRequestMetadataBytes(@NotNull @org.jetbrains.annotations.NotNull byte[] ticketId, @Nullable @Nullable BarrageSnapshotOptions options) Create a snapshot request payload to be sent via DoExchange.- Parameters:
ticketId- the ticket id of the table to subscribe tooptions- the barrage options- Returns:
- the subscription request payload
-
createSnapshotRequestMetadataBytes
public static byte[] createSnapshotRequestMetadataBytes(@NotNull @org.jetbrains.annotations.NotNull byte[] ticketId, @Nullable @Nullable BarrageSnapshotOptions options, @Nullable @Nullable RowSet viewport, @Nullable @Nullable BitSet columns, boolean reverseViewport) Create a subscription request payload to be sent via DoExchange.- Parameters:
ticketId- the ticket id of the table to subscribe tooptions- the barrage optionsviewport- the viewport to subscribe tocolumns- the columns to subscribe toreverseViewport- whether to reverse the viewport- Returns:
- the subscription request payload
-
createSerializationOptionsMetadataBytes
public static byte[] createSerializationOptionsMetadataBytes(@NotNull @org.jetbrains.annotations.NotNull byte[] ticketId, @Nullable @Nullable BarrageSubscriptionOptions options) Create a snapshot request payload to be sent via DoExchange.- Parameters:
ticketId- the ticket id of the table to subscribe tooptions- the barrage options- Returns:
- the subscription request payload
-
schemaBytesFromTable
-
schemaBytesFromTableDefinition
public static com.google.protobuf.ByteString schemaBytesFromTableDefinition(@NotNull @NotNull TableDefinition tableDefinition, @NotNull @NotNull Map<String, Object> attributes, boolean isFlat) -
schemaFromTable
public static org.apache.arrow.vector.types.pojo.Schema schemaFromTable(@NotNull @NotNull Table table) -
toSchema
public static org.apache.arrow.vector.types.pojo.Schema toSchema(TableDefinition definition, Map<String, Object> attributes, boolean isFlat) -
schemaBytes
public static com.google.protobuf.ByteString schemaBytes(@NotNull @NotNull ToIntFunction<com.google.flatbuffers.FlatBufferBuilder> schemaPayloadWriter) -
makeTableSchemaPayload
public static int makeTableSchemaPayload(@NotNull @NotNull com.google.flatbuffers.FlatBufferBuilder builder, @NotNull @NotNull BarrageOptions options, @NotNull @NotNull TableDefinition tableDefinition, @NotNull @NotNull Map<String, Object> attributes, boolean isFlat) -
makeSchema
public static org.apache.arrow.vector.types.pojo.Schema makeSchema(@NotNull @NotNull BarrageOptions options, @NotNull @NotNull TableDefinition tableDefinition, @NotNull @NotNull Map<String, Object> attributes, boolean isFlat) -
attributesToMetadata
-
attributesToMetadata
-
columnDefinitionsToFields
public static Stream<org.apache.arrow.vector.types.pojo.Field> columnDefinitionsToFields(@NotNull @NotNull Map<String, String> columnDescriptions, @Nullable @Nullable InputTableUpdater inputTableUpdater, @NotNull @NotNull TableDefinition tableDefinition, @NotNull @NotNull Collection<ColumnDefinition<?>> columnDefinitions, @NotNull @NotNull Function<String, Map<String, String>> fieldMetadataFactory, @NotNull @NotNull Map<String, Object> attributes) -
columnDefinitionsToFields
public static Stream<org.apache.arrow.vector.types.pojo.Field> columnDefinitionsToFields(@NotNull @NotNull Map<String, String> columnDescriptions, @Nullable @Nullable InputTableUpdater inputTableUpdater, @NotNull @NotNull TableDefinition tableDefinition, @NotNull @NotNull Collection<ColumnDefinition<?>> columnDefinitions, @NotNull @NotNull Function<String, Map<String, String>> fieldMetadataFactory, @NotNull @NotNull Map<String, Object> attributes, boolean columnsAsList) -
putMetadata
-
getDefaultType
public static BarrageTypeInfo<org.apache.arrow.vector.types.pojo.Field> getDefaultType(@NotNull @NotNull org.apache.arrow.vector.types.pojo.Field field) -
convertTableDefinition
public static TableDefinition convertTableDefinition(@NotNull @NotNull ExportedTableCreationResponse response) -
convertArrowSchema
public static BarrageUtil.ConvertedArrowSchema convertArrowSchema(@NotNull @NotNull ExportedTableCreationResponse response) -
convertArrowSchema
public static BarrageUtil.ConvertedArrowSchema convertArrowSchema(@NotNull org.apache.arrow.flatbuf.Schema schema) -
convertArrowSchema
public static BarrageUtil.ConvertedArrowSchema convertArrowSchema(@NotNull org.apache.arrow.flatbuf.Schema schema, @Nullable @Nullable BarrageOptions options) -
convertArrowSchema
public static BarrageUtil.ConvertedArrowSchema convertArrowSchema(org.apache.arrow.vector.types.pojo.Schema schema) -
convertArrowSchema
public static BarrageUtil.ConvertedArrowSchema convertArrowSchema(org.apache.arrow.vector.types.pojo.Schema schema, BarrageOptions options) -
arrowFieldFor
-
flatbufFieldFor
public static org.apache.arrow.flatbuf.Field flatbufFieldFor(ColumnDefinition<?> columnDefinition, Map<String, String> metadata) -
flatbufFieldFor
-
createAndSendStaticSnapshot
public static void createAndSendStaticSnapshot(BarrageMessageWriter.Factory bmwFactory, BaseTable<?> table, BitSet columns, RowSet viewport, boolean reverseViewport, BarrageSnapshotOptions snapshotRequestOptions, io.grpc.stub.StreamObserver<BarrageMessageWriter.MessageView> listener, BarragePerformanceLog.SnapshotMetricsHelper metrics) -
createAndSendSnapshot
public static void createAndSendSnapshot(BarrageMessageWriter.Factory bwmFactory, BaseTable<?> table, BitSet columns, RowSet viewport, boolean reverseViewport, BarrageSnapshotOptions options, io.grpc.stub.StreamObserver<BarrageMessageWriter.MessageView> listener, BarragePerformanceLog.SnapshotMetricsHelper metrics)
-