22 template <
class Input,
class Visitor>
static decltype(
auto)
select(Input & in, Visitor && visitor) {
23 return dispatch_sort<Registry>(in, std::forward<Visitor>(visitor));
25 template <
class S,
class Output>
static void write(Output & out) { write_sort_code<Registry, S>(out); }
34 static constexpr bool front_coded =
true;
38 if (key.size() & 7)
throw std::invalid_argument(
"string order key ends inside byte");
39 std::string result(
static_cast<std::size_t
>(key.size() >> 3),
'\0');
44 auto literal = in.
take_bits(in.template read_count<C>());
45 if ((retained + literal.size()) & 7)
throw std::invalid_argument(
"string key ends inside byte");
46 return {retained, literal};
48 template <
class Output>
static void header(Output & out, std::uint64_t retained, std::uint64_t suffix_bits) {
49 if ((retained + suffix_bits) & 7)
throw std::invalid_argument(
"string key ends inside byte");
50 out.template write_count<C>(suffix_bits);
52 template <
class Output>
static void write(Output & out, std::uint64_t retained,
bit_view suffix) {
53 header(out, retained, suffix.
size()); out.append(suffix);
57 static constexpr bool front_coded =
true;
62 return {retained, in.
take_bits(in.template read_count<C>())};
64 template <
class Output>
static void header(Output & out, std::uint64_t, std::uint64_t suffix_bits) {
65 out.template write_count<C>(suffix_bits);
67 template <
class Output>
static void write(Output & out, std::uint64_t retained,
bit_view suffix) {
68 header(out, retained, suffix.
size()); out.append(suffix);
72 static constexpr bool front_coded =
false;
77 if (key.size() != N)
throw std::invalid_argument(
"integer order key width");
81 if (retained)
throw std::invalid_argument(
"raw integer has an inherited prefix");
84 template <
class Output>
static void header(Output &, std::uint64_t retained, std::uint64_t suffix_bits) {
85 if (retained || suffix_bits != N)
throw std::invalid_argument(
"raw integer frame width");
87 template <
class Output>
static void write(Output & out, std::uint64_t retained,
bit_view suffix) {
88 header(out, retained, suffix.
size()); out.append(suffix);
92 static constexpr bool front_coded =
false;
96 if (key.size() & 7)
throw std::invalid_argument(
"string order key ends inside byte");
97 std::string result(
static_cast<std::size_t
>(key.size() >> 3),
'\0');
102 if (retained)
throw std::invalid_argument(
"raw string has an inherited prefix");
105 template <
class Output>
static void header(Output & out, std::uint64_t retained, std::uint64_t suffix_bits) {
106 if (retained || (suffix_bits & 7))
throw std::invalid_argument(
"raw string frame width");
107 out.template write_count<C>(suffix_bits >> 3);
109 template <
class Output>
static void write(Output & out, std::uint64_t retained,
bit_view suffix) {
110 header(out, retained, suffix.
size()); out.append(suffix);
114 namespace sort_profile_detail {
115 template <simd::architecture Arch = simd::scalar>
117 std::uint64_t first_a = 0, std::uint64_t first_b = 0) {
118 std::size_t i = 0, j = 0;
119 while (i != a.size() && first_a >= a[i].size()) first_a -= a[i++].size();
120 while (j != b.size() && first_b >= b[j].size()) first_b -= b[j++].size();
121 std::uint64_t common = 0;
122 while (i != a.size() && j != b.size()) {
123 auto width = std::min(a[i].size() - first_a, b[j].size() - first_b);
124 auto cmp = compare_common_bits<Arch>(a[i].subview(first_a, width), b[j].subview(first_b, width));
125 common += cmp.common_bits;
126 if (cmp.order)
return {common, cmp.order};
127 first_a += width; first_b += width;
128 if (first_a == a[i].size()) { ++i; first_a = 0; }
129 if (first_b == b[j].size()) { ++j; first_b = 0; }
131 while (i != a.size() && !a[i].size()) ++i;
132 while (j != b.size() && !b[j].size()) ++j;
133 return {common, i == a.size() ? j == b.size() ? 0 : -1 : 1};
136 template <
class S,
class... Rest>
struct visit<registry_detail::sorts<S, Rest...>> {
137 template <
class F>
static decltype(
auto)
at(std::size_t index, F && f) {
138 if (!index)
return f(std::type_identity<S>{});
140 else throw std::invalid_argument(
"sort profile leaf index");
143 template <
class List,
class S>
struct ordinal;
144 template <
class S,
class... Rest>
struct ordinal<registry_detail::sorts<S, Rest...>, S>
145 : std::integral_constant<std::size_t, 0> {};
146 template <
class T,
class... Rest,
class S>
struct ordinal<registry_detail::sorts<T, Rest...>, S>
147 : std::integral_constant<std::size_t, 1 + ordinal<registry_detail::sorts<Rest...>, S>::value> {};
153 template <
class P,
class Selector = registry_selector<
typename P::registry_type>>
struct sort_profile_array;
154 template <
class P,
class Selector = registry_selector<
typename P::registry_type>>
struct sort_profile_view;
155 template <
class P,
class Selector = registry_selector<
typename P::registry_type>>
struct sort_profile_cursor;
156 template <
class P,
class Selector = registry_selector<
typename P::registry_type>>
struct sort_profile_writer;
157 namespace sort_profile_detail {
template <
class P,
class Selector>
struct encoder; }
190 throw std::invalid_argument(
"sort profile metadata mismatch");
198 throw std::invalid_argument(
"noncanonical sort profile metadata");
204 throw std::invalid_argument(
"sort profile section shape mismatch");
207 std::uint64_t
block_count() const noexcept {
return size() / P::codec_block_size + (
size() % P::codec_block_size != 0); }
211 if (block >
block_count())
throw std::out_of_range(
"sort profile block");
212 auto ordinal = block ==
block_count() ?
size() : block * P::codec_block_size;
223 if (ordinal >=
size())
throw std::out_of_range(
"sort profile ordinal");
224 auto block = ordinal / P::codec_block_size;
226 while (result.ordinal < ordinal) result =
next(result);
230 auto ordinal = previous.
ordinal + 1;
231 if (ordinal >=
size())
throw std::out_of_range(
"sort profile successor");
232 if (!(ordinal % P::codec_block_size)) {
234 throw std::invalid_argument(
"sort profile block offset mismatch");
235 return start_block(ordinal / P::codec_block_size, &previous);
238 auto backspace = profile_detail::read_backspace<P>(
data_, at);
239 if (backspace > previous.
continuation())
throw std::invalid_argument(
"sort profile backspace exceeds cursor");
246 bool same = retained >= previous.
path.
size();
251 Selector::select(prefix, [&]<
class S>(std::type_identity<S>,
auto &) {
254 if (prefix.at != retained)
throw std::invalid_argument(
"sort profile prefix crosses selector leaf");
259 if (first > last || last >
dictionary_.
size())
throw std::invalid_argument(
"sort profile dictionary range");
261 if (!compare_bits<typename P::architecture>(candidate, path.
view())) { result.
path = candidate; found =
true;
break; }
263 if (!found)
throw std::invalid_argument(
"sort transition absent from dictionary");
265 return payload(at, retained, std::move(result), same);
269 if (first > last || last >
size() || last - first > P::group_size)
270 throw std::out_of_range(
"sort profile query window");
271 if (first == last)
return;
273 if (work) work->skipped_headers += first % P::codec_block_size;
274 for (
auto i = first; i != last; ++i) {
275 auto count = context.
advance_parts(record.retained, record.key_units, record.literal);
276 if (work) { ++work->visited_headers; work->compared_bits += count; }
278 if (i + 1 != last) record =
next(record);
284 throw std::invalid_argument(
"sort profile section endpoints");
288 auto comparison = c.advance_comparison();
289 if (comparison && comparison->order >= 0)
throw std::invalid_argument(
"unsorted sort profile");
301 if (
id >=
dictionary_size())
throw std::invalid_argument(
"sort profile seed ID");
303 if (first > last || last >
dictionary_.
size())
throw std::invalid_argument(
"sort profile dictionary range");
307 if (previous && previous->path.storage().data() == path.storage().data() &&
308 previous->path.offset() == path.offset() && previous->path.size() == path.size()) {
309 result.
leaf = previous->leaf; result.
parse = previous->parse; result.
front_coded = previous->front_coded;
311 Selector::select(code, [&]<
class S>(std::type_identity<S>,
auto &) { select<S>(result); });
312 if (!code.
empty())
throw std::invalid_argument(
"trailing selector code bits");
316 auto retained = profile_detail::read_count<P>(
data_, at);
317 result.
ordinal = block * P::codec_block_size;
318 return payload(at, retained, std::move(result),
true,
true);
331 auto local = same ? retained : result.
path.
size();
332 if (local < result.
path.
size())
throw std::invalid_argument(
"sort profile retained position precedes leaf");
336 auto frame = parsed.
key;
337 bool inherit = same && (frame.retained_bits || !restart);
338 result.
retained = inherit ? retained : same ? 0 : retained;
342 result.
value =
data_.
subview(at + parsed.value_start, parsed.end - parsed.value_start);
344 throw std::invalid_argument(
"sort profile fixed value width mismatch");
355 if (ordinal > view.
size())
throw std::out_of_range(
"sort profile cursor ordinal");
358 if (
frame_.
retained > query.
size())
throw std::invalid_argument(
"sort cursor missing query prefix");
365 if (
done())
throw std::out_of_range(
"sort profile cursor end");
369 if (
done())
throw std::out_of_range(
"sort profile cursor end");
374 if (
done())
throw std::out_of_range(
"sort profile cursor end");
378 throw std::invalid_argument(
"sort profile terminal framing mismatch");
383 std::array<bit_view, 1> before{
key_.
view()};
440 namespace sort_profile_detail {
443 template <
class P,
class Selector>
struct encoder {
444 static_assert(P::unit ==
profile_unit::bit,
"sort profile framing uses bit addresses");
446 profile_metadata metadata = [] {
auto m = profile_detail::initial_metadata<P, stream_role::native>(); m.version = 3;
return m; }();
452 std::span<bit_view const> spans, std::uint64_t common,
bit_view value) {
454 append<S>(out, frame.path, frame.key_units - frame.path.size(), spans, value, common, frame.retained_limit_bits);
457 template <
class S,
class Output>
void append(Output & out,
bit_view path, std::uint64_t key_bits,
458 std::span<bit_view const> key,
bit_view value, std::uint64_t common,
459 std::optional<std::uint64_t> retained_limit_bits = {}) {
463 if (!validate.empty())
throw std::invalid_argument(
"trailing sort profile value bits");
464 auto total = std::uint64_t{0};
465 for (
auto part : key) total = profile_detail::add(total, part.
size());
467 throw std::invalid_argument(
"sort merge key spans");
468 constexpr auto leaf = ordinal<leaves, S>::value;
469 auto found = std::find(
ids_.begin(),
ids_.end(), leaf);
470 auto id = std::size_t(found -
ids_.begin());
471 if (found ==
ids_.end()) {
476 auto retained = same && codec::front_coded ? common : path.
size();
477 if (retained < path.
size() || retained > total)
throw std::invalid_argument(
"sort retained prefix outside key");
478 if (retained_limit_bits)
479 retained = std::min(retained, std::max(path.
size(), *retained_limit_bits));
480 if (!(
size() % P::codec_block_size)) {
482 out.template write_count<exponential_golomb<0>>(retained);
484 auto joint = same ? retained : compare_common_bits<typename P::architecture>(
previous_path_.
view(), path).common_bits;
487 if (!same) out.append(path.
subview(joint, path.
size() - joint));
489 auto local = retained - path.
size();
490 codec::header(out, local, key_bits - local);
491 auto skip = retained;
492 for (
auto part :
key) {
493 auto prefix = std::min(skip, part.size()); skip -=
prefix;
494 out.append(part.subview(prefix, part.size() - prefix));
507 for (std::size_t i = 0; i !=
raw_offsets_.size(); ++i) {
512 auto width =
ids_.size() < 2 ? 0u : std::bit_width(
ids_.size() - 1);
536 std::optional<std::uint64_t> retained_limit_bits = {}) {
538 if (
encoded_only_)
throw std::logic_error(
"typed append after encoded sort frames");
539 sort_codec_detail::validate_value_width<S>();
542 Selector::template write<S>(path_out);
546 auto comparison = compare_common_bits<typename P::architecture>(
previous_.
view(), logical.view());
547 if (
size() && comparison.order >= 0)
throw std::invalid_argument(
"sort profile requires unique sorted keys");
548 std::array<bit_view, 1> spans{logical.view()};
550 sort_bit_writer out(
data_);
551 encoder_.template append<S>(out, path.
view(), bits.bit_size, spans, encoded_value.
view(), comparison.common_bits, retained_limit_bits);
553 }
catch (...) {
failed_ =
true;
throw; }
558 std::uint64_t common,
bit_view value) {
562 encoder_.append_frame(out, frame, spans, common, value);
564 }
catch (...) {
failed_ =
true;
throw; }
575 }
catch (...) {
failed_ =
true;
throw; }
583 if (
failed_ ||
finished_)
throw std::logic_error(
"inactive sort profile writer");
587 template <
class P,
class S,
class Selector = registry_selector<
typename P::registry_type>>
593 if constexpr (
requires {
typename std::integral_constant<std::uint64_t, Selector::template code_size<S>>; }) {
596 if (bytes > result.
bytes.max_size())
throw std::length_error(
"sort query key too large");
597 result.
bytes.reserve(
static_cast<std::size_t
>(bytes));
600 Selector::template write<S>(out);
604 if constexpr (
requires { key_codec::order_view(key); })
return encode(key_codec::order_view(key));
606 auto bits = key_codec::order(key);
607 return encode(bits.view());
Declares dual-target main/secondary fractional indexes for COLA.
std::uint64_t add(std::uint64_t a, std::uint64_t b)
Definition profile.h:39
std::uint64_t multiply(std::uint64_t a, std::uint64_t b)
Definition profile.h:44
void resize(bit_string &value, std::uint64_t bits)
Definition profile.h:465
void copy_bits(std::byte *target, std::uint64_t first, bit_view source) noexcept
Definition profile.h:123
std::uint64_t load_bits(bit_view data, std::uint64_t first, unsigned width) noexcept
Definition profile.h:93
void append(bit_string &target, bit_view source)
Definition profile.h:480
unsigned prefix(std::uint64_t const *words, unsigned count) noexcept
Definition rank_groups.h:113
bit_view string_bits(std::string const &value)
Definition sort_codec.h:31
bit_string concatenate(bit_view a, bit_view b)
Definition sort_profile.h:148
bit_comparison compare_spans(std::span< bit_view const > a, std::span< bit_view const > b, std::uint64_t first_a=0, std::uint64_t first_b=0)
Definition sort_profile.h:116
bit_string value(arrow_t< S > const &value)
Definition typed_world.h:99
bit_string key(key_t< S > const &value)
Definition typed_world.h:89
Definition active_engine.h:18
bit_string sort_profile_query(typename sort_codec< S >::key_codec::value_type const &key)
Definition sort_profile.h:588
Encodes typed bit records with inherited sort prefixes and sort-owned grammars.
std::vector< std::byte > bytes
Definition profile.h:167
bit_view view() const &
Definition profile.h:178
static bit_string copy(bit_view source)
Definition profile.h:181
std::uint64_t bit_size
Definition profile.h:168
std::uint64_t size() const noexcept
Definition profile.h:64
bit_view subview(std::uint64_t first, std::uint64_t count) const
Definition profile.h:73
bit_view prefix(std::uint64_t count) const
Definition profile.h:80
Definition elias_fano.h:195
Definition elias_fano.h:212
std::uint64_t size() const noexcept
Definition elias_fano.h:256
std::uint64_t universe() const noexcept
Definition elias_fano.h:254
Definition elias_fano.h:397
std::vector< std::uint64_t > sparse
Definition elias_fano.h:445
std::vector< std::uint64_t > high
Definition elias_fano.h:443
std::vector< std::uint64_t > low
Definition elias_fano.h:442
std::vector< elias_fano_sample > samples
Definition elias_fano.h:444
elias_fano_view view() const &
Definition elias_fano.h:434
Definition sort_codec.h:257
Definition sort_codec.h:186
Definition sort_codec.h:228
static profile_anchor complete(bit_view key)
Definition profile.h:253
Definition profile.h:1280
std::uint64_t advance_parts(std::uint64_t retained_bits, std::uint64_t full_bits, std::span< bit_view const > literal)
Definition profile.h:357
Definition sort_codec.h:330
Definition registry.h:122
Definition sort_profile.h:20
static decltype(auto) select(Input &in, Visitor &&visitor)
Definition sort_profile.h:22
static void write(Output &out)
Definition sort_profile.h:25
static constexpr std::uint64_t code_size
Definition sort_profile.h:21
Definition sort_codec.h:56
bool empty() const noexcept
Definition sort_codec.h:60
std::uint64_t read_bits(unsigned width)
Definition sort_codec.h:61
std::uint64_t position() const noexcept
Definition sort_codec.h:58
bit_view take_bits(std::uint64_t count)
Definition sort_codec.h:81
Definition sort_codec.h:38
void append(bit_view bits)
Definition sort_codec.h:48
void write_bits(std::uint64_t value, unsigned width)
Definition sort_codec.h:41
Definition sort_codec.h:426
Definition sort_codec.h:463
Definition sort_codec.h:401
Definition sort_profile.h:405
auto const & data() const &noexcept
Definition sort_profile.h:417
std::uint64_t size() const noexcept
Definition sort_profile.h:414
auto view() const &&=delete
bit_string data_
Definition sort_profile.h:430
std::vector< std::uint64_t > dictionary_offsets_
Definition sort_profile.h:431
bit_string seeds_
Definition sort_profile.h:430
std::span< std::uint64_t const > dictionary_offsets() const noexcept
Definition sort_profile.h:419
std::size_t retained_bytes() const noexcept
Definition sort_profile.h:422
auto view() const &
Definition sort_profile.h:409
P policy_type
Definition sort_profile.h:406
elias_fano offsets_
Definition sort_profile.h:432
sort_profile_array(bit_string data, bit_string dictionary, bit_string seeds, std::vector< std::uint64_t > dictionary_offsets, elias_fano offsets, profile_metadata metadata)
Definition sort_profile.h:434
auto const & metadata() const noexcept
Definition sort_profile.h:415
auto const & dictionary() const &noexcept
Definition sort_profile.h:418
auto const & seeds() const &noexcept
Definition sort_profile.h:420
profile_metadata metadata_
Definition sort_profile.h:433
sort_profile_array()=default
bit_string dictionary_
Definition sort_profile.h:430
auto const & group_offsets() const &noexcept
Definition sort_profile.h:416
Definition sort_profile.h:350
bool done() const noexcept
Definition sort_profile.h:363
profile_item< P > peek() const
Definition sort_profile.h:364
std::uint64_t retained_bits() const
Definition sort_profile.h:368
sort_profile_view< P, Selector > view_
Definition sort_profile.h:391
sort_profile_cursor(sort_profile_view< P, Selector > view, std::uint64_t ordinal, bit_view query)
Definition sort_profile.h:353
sort_profile_cursor(sort_profile_view< P, Selector > view)
Definition sort_profile.h:351
std::uint64_t ordinal_
Definition sort_profile.h:394
sort_profile_frame frame_
Definition sort_profile.h:392
void advance()
Definition sort_profile.h:372
bit_string key_
Definition sort_profile.h:393
std::optional< bit_comparison > advance_comparison()
Definition sort_profile.h:373
Definition sort_profile.h:443
void finish(std::uint64_t extent)
Definition sort_profile.h:504
bit_string dictionary
Definition sort_profile.h:447
profile_metadata metadata
Definition sort_profile.h:446
typename registry_detail::info< typename P::registry_type >::leaves leaves
Definition sort_profile.h:445
void append_frame(Output &out, sort_profile_frame const &frame, std::span< bit_view const > spans, std::uint64_t common, bit_view value)
Definition sort_profile.h:451
std::vector< std::uint64_t > raw_offsets_
Definition sort_profile.h:526
std::vector< std::uint64_t > dictionary_offsets
Definition sort_profile.h:448
elias_fano offsets
Definition sort_profile.h:449
bit_string previous_path_
Definition sort_profile.h:524
bit_string seeds
Definition sort_profile.h:447
std::vector< std::size_t > ids_
Definition sort_profile.h:525
std::uint64_t size() const noexcept
Definition sort_profile.h:450
std::uint64_t previous_continuation_
Definition sort_profile.h:527
std::vector< std::uint64_t > block_seeds_
Definition sort_profile.h:526
void append(Output &out, bit_view path, std::uint64_t key_bits, std::span< bit_view const > key, bit_view value, std::uint64_t common, std::optional< std::uint64_t > retained_limit_bits={})
Definition sort_profile.h:457
sort_profile_array< P, Selector > take(bit_string data)
Definition sort_profile.h:519
Definition sort_profile.h:143
static decltype(auto) at(std::size_t index, F &&f)
Definition sort_profile.h:137
Definition sort_profile.h:135
Definition sort_profile.h:397
Selector selector_type
Definition sort_profile.h:398
Definition sort_profile.h:163
std::array< bit_view, 2 > literal
Definition sort_profile.h:165
std::uint64_t next_offset
Definition sort_profile.h:164
std::uint64_t key_units
Definition sort_profile.h:164
bool front_coded
Definition sort_profile.h:169
std::uint64_t continuation() const noexcept
Definition sort_profile.h:173
std::uint64_t retained
Definition sort_profile.h:164
sort_profile_payload(* parse)(sort_bit_reader &, std::uint64_t)
Definition sort_profile.h:172
std::size_t leaf
Definition sort_profile.h:168
bit_view path
Definition sort_profile.h:167
std::optional< std::uint64_t > retained_limit_bits
Definition sort_profile.h:171
bit_view value
Definition sort_profile.h:166
std::uint64_t ordinal
Definition sort_profile.h:164
static bit_string order(bit_string const &key)
Definition sort_profile.h:59
static bit_string decode_order(bit_view key)
Definition sort_profile.h:60
static bit_view order_view(bit_string const &key)
Definition sort_profile.h:58
static void header(Output &out, std::uint64_t, std::uint64_t suffix_bits)
Definition sort_profile.h:64
static fc_key_frame read(sort_bit_reader &in, std::uint64_t retained)
Definition sort_profile.h:61
static void write(Output &out, std::uint64_t retained, bit_view suffix)
Definition sort_profile.h:67
static bit_view order_view(std::string const &key)
Definition sort_profile.h:35
static bit_string order(std::string const &key)
Definition sort_profile.h:36
static fc_key_frame read(sort_bit_reader &in, std::uint64_t retained)
Definition sort_profile.h:43
static void header(Output &out, std::uint64_t retained, std::uint64_t suffix_bits)
Definition sort_profile.h:48
static void write(Output &out, std::uint64_t retained, bit_view suffix)
Definition sort_profile.h:52
static std::string decode_order(bit_view key)
Definition sort_profile.h:37
static bit_view order_view(std::string const &key)
Definition sort_profile.h:93
static bit_string order(std::string const &key)
Definition sort_profile.h:94
static std::string decode_order(bit_view key)
Definition sort_profile.h:95
static void header(Output &out, std::uint64_t retained, std::uint64_t suffix_bits)
Definition sort_profile.h:105
static fc_key_frame read(sort_bit_reader &in, std::uint64_t retained)
Definition sort_profile.h:101
static void write(Output &out, std::uint64_t retained, bit_view suffix)
Definition sort_profile.h:109
static std::uint64_t decode_order(bit_view key)
Definition sort_profile.h:76
static void write(Output &out, std::uint64_t retained, bit_view suffix)
Definition sort_profile.h:87
static bit_string order(std::uint64_t key)
Definition sort_profile.h:73
static fc_key_frame read(sort_bit_reader &in, std::uint64_t retained)
Definition sort_profile.h:80
static void header(Output &, std::uint64_t retained, std::uint64_t suffix_bits)
Definition sort_profile.h:84
Definition sort_profile.h:32
Definition sort_profile.h:159
fc_key_frame key
Definition sort_profile.h:160
std::uint64_t end
Definition sort_profile.h:161
std::uint64_t value_start
Definition sort_profile.h:161
Definition sort_profile.h:176
void scan() const
Definition sort_profile.h:281
std::uint64_t size() const noexcept
Definition sort_profile.h:206
P policy_type
Definition sort_profile.h:178
sort_profile_frame payload(std::uint64_t at, std::uint64_t retained, sort_profile_frame result, bool same, bool restart=false) const
Definition sort_profile.h:329
sort_profile_view(bit_view data, elias_fano_view offsets, profile_metadata metadata, bit_view dictionary, word_view dictionary_offsets, bit_view seeds)
Definition sort_profile.h:183
typename registry_detail::info< typename P::registry_type >::leaves leaves
Definition sort_profile.h:179
bit_view data_
Definition sort_profile.h:293
bit_view dictionary_
Definition sort_profile.h:296
std::uint64_t dictionary_size() const noexcept
Definition sort_profile.h:208
sort_profile_frame encoded_at(std::uint64_t ordinal) const
Definition sort_profile.h:222
profile_metadata metadata_
Definition sort_profile.h:295
profile_metadata const & metadata() const noexcept
Definition sort_profile.h:215
sort_profile_frame next(sort_profile_frame const &previous) const
Definition sort_profile.h:229
static void select(sort_profile_frame &frame)
Definition sort_profile.h:320
bit_view seeds() const noexcept
Definition sort_profile.h:219
bit_view seeds_
Definition sort_profile.h:298
std::uint64_t block_offset(std::uint64_t block) const
Definition sort_profile.h:210
void compare_window(std::uint64_t first, std::uint64_t last, profile_query_context< P > context, F &&callback, profile_comparison_work *work=nullptr) const
Definition sort_profile.h:267
cursor_type cursor() const
Definition sort_profile.h:221
word_view dictionary_offsets_
Definition sort_profile.h:297
unsigned seed_width() const noexcept
Definition sort_profile.h:209
sort_profile_frame start_block(std::uint64_t block, sort_profile_frame const *previous=nullptr) const
Definition sort_profile.h:299
elias_fano_view group_offsets() const noexcept
Definition sort_profile.h:220
std::uint64_t block_count() const noexcept
Definition sort_profile.h:207
word_view dictionary_offsets() const noexcept
Definition sort_profile.h:218
elias_fano_view offsets_
Definition sort_profile.h:294
bit_view data() const noexcept
Definition sort_profile.h:216
bit_view dictionary() const noexcept
Definition sort_profile.h:217
sort_profile_cursor< P, Selector > cursor_type
Definition sort_profile.h:180
Definition sort_profile.h:531
bool finished() const noexcept
Definition sort_profile.h:568
P policy_type
Definition sort_profile.h:532
void require_active() const
Definition sort_profile.h:582
bit_string previous_
Definition sort_profile.h:580
sort_profile_detail::encoder< P, Selector > encoder_
Definition sort_profile.h:579
void append(typename sort_codec< S >::key_codec::value_type const &key, typename sort_codec< S >::value_codec::value_type const &value, std::optional< std::uint64_t > retained_limit_bits={})
Definition sort_profile.h:534
array_type finish()
Definition sort_profile.h:569
bool failed_
Definition sort_profile.h:581
bool finished_
Definition sort_profile.h:581
bool encoded_only_
Definition sort_profile.h:581
void append_frame(sort_profile_frame const &frame, std::span< bit_view const > spans, std::uint64_t common, bit_view value)
Definition sort_profile.h:557
bit_string data_
Definition sort_profile.h:578
bool failed() const noexcept
Definition sort_profile.h:567
std::uint64_t size() const noexcept
Definition sort_profile.h:566
Definition sort_codec.h:348
Definition word_view.h:31
std::size_t size() const noexcept
Definition word_view.h:41