33#include < date/date.h>
44
55#include < cstdint>
6+ #include < optional>
67#include < ostream>
78#include < string>
89#include < vector>
@@ -37,12 +38,10 @@ struct Metadata {
3738 std::uint8_t version;
3839 // The dataset code.
3940 std::string dataset;
40- // Indicates the DBN stream may contain multiple record types and data
41- // schemas. If true, the schema field should be ignored.
42- bool has_mixed_schema;
43- // The data record schema which affects the type record of present. If
44- // has_mixed_schema is true, this field should be ignored.
45- Schema schema;
41+ // The data record schema which affects the type record of present. Will be
42+ // nullopt for live where there can be a mix of `schema`s across
43+ // subscriptions.
44+ std::optional<Schema> schema;
4645 // The UNIX timestamp of the query start, or the first record if the file was
4746 // split.
4847 UnixNanos start;
@@ -51,12 +50,9 @@ struct Metadata {
5150 UnixNanos end;
5251 // The maximum number of records for the query.
5352 std::uint64_t limit;
54- // Indicates the DBN stream may been create with a mix of stype_in. This
55- // will always be the case for live data where stype_in is specified per
56- // subscription.
57- bool has_mixed_stype_in;
58- // The input symbology type. Should be ignored if has_mixed_schemas is true.
59- SType stype_in;
53+ // The input symbology type. Will be nullopt for live data where there can be
54+ // a mix of `stype_in`s across subscriptions.
55+ std::optional<SType> stype_in;
6056 // The output symbology type.
6157 SType stype_out;
6258 // Whether the records contain an appended send timestamp.
@@ -105,13 +101,10 @@ inline bool operator!=(const SymbolMapping& lhs, const SymbolMapping& rhs) {
105101
106102inline bool operator ==(const Metadata& lhs, const Metadata& rhs) {
107103 return lhs.version == rhs.version && lhs.dataset == rhs.dataset &&
108- (lhs.has_mixed_schema ? rhs.has_mixed_schema
109- : lhs.schema == rhs.schema ) &&
110- lhs.start == rhs.start && lhs.end == rhs.end &&
111- lhs.limit == rhs.limit &&
112- (lhs.has_mixed_stype_in ? rhs.has_mixed_stype_in
113- : lhs.stype_in == rhs.stype_in ) &&
114- lhs.stype_out == rhs.stype_out && lhs.ts_out == rhs.ts_out &&
104+ lhs.schema == rhs.schema && lhs.start == rhs.start &&
105+ lhs.end == rhs.end && lhs.limit == rhs.limit &&
106+ lhs.stype_in == rhs.stype_in && lhs.stype_out == rhs.stype_out &&
107+ lhs.ts_out == rhs.ts_out &&
115108 lhs.symbol_cstr_len == rhs.symbol_cstr_len &&
116109 lhs.symbols == rhs.symbols && lhs.partial == rhs.partial &&
117110 lhs.not_found == rhs.not_found && lhs.mappings == rhs.mappings ;
0 commit comments