Skip to content

[k2] f$prepare_search_query#1461

Open
T-y-c-o-o-n wants to merge 26 commits intomasterfrom
k2/prepare_search_query
Open

[k2] f$prepare_search_query#1461
T-y-c-o-o-n wants to merge 26 commits intomasterfrom
k2/prepare_search_query

Conversation

@T-y-c-o-o-n
Copy link
Contributor

implemented f$prepare_search_query

@T-y-c-o-o-n T-y-c-o-o-n changed the title [k2] f$prepare_search_query DRAFT [k2] f$prepare_search_query Nov 24, 2025
@T-y-c-o-o-n T-y-c-o-o-n changed the title DRAFT [k2] f$prepare_search_query [k2] f$prepare_search_query Nov 25, 2025
@Danil42Russia Danil42Russia added the k2 k2 related label Nov 25, 2025
@T-y-c-o-o-n T-y-c-o-o-n force-pushed the k2/prepare_search_query branch 2 times, most recently from 95d216c to 3e38a8a Compare November 27, 2025 17:04
@T-y-c-o-o-n T-y-c-o-o-n self-assigned this Nov 27, 2025
@T-y-c-o-o-n T-y-c-o-o-n requested a review from apolyakov December 1, 2025 12:58
@T-y-c-o-o-n T-y-c-o-o-n force-pushed the k2/prepare_search_query branch from 5b83862 to 2217549 Compare March 12, 2026 17:24
@T-y-c-o-o-n T-y-c-o-o-n force-pushed the k2/prepare_search_query branch from 1b8a952 to d221bd8 Compare March 13, 2026 13:44
#include "runtime-light/stdlib/diagnostics/logs.h"

inline string f$prepare_search_query(const string& query) noexcept {
// TODO no problem if std::function allocate?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see std::function here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed comment

#include "runtime-common/stdlib/string/string-context.h"
#include "runtime-common/stdlib/string/string-functions.h"
#include "runtime-light/k2-platform/k2-api.h"
#include "runtime-light/stdlib/diagnostics/logs.h"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, remove unused includes

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed


inline string f$prepare_search_query(const string& query) noexcept {
// TODO no problem if std::function allocate?
return prepare_search_query_impl_::prepare_search_query(query, [](bool condition) { kphp::log::assertion(condition); });
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing noexcept for lambda

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added


#include <cstddef>
#include <cstdint>
#include <functional>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, remove unused include

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed

#include <algorithm>
#include <assert.h>
#include <cstddef>
#include <functional>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, remove unused include

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed

return to_upper_table[code];
} else {
return binary_search_ranges(to_upper_table_ranges, to_upper_table_ranges_size, code);
return binary_search_ranges(to_upper_table_ranges, to_upper_table_ranges_size, code, [](bool condition) { assert(condition); });
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like it's still possible to call assert from runtime-light. Let's fix this as well

const int _v_78__[] = {121, 117, 0};
const int _s_79__[] = {1103, 0};
const int _v_79__[] = {121, 97, 0};
// TODO does constexpr std::array enough for safe use in runtime-light ?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed TODO

if (!s[k]) { \
match_v = v; \
match_s = s; \
match_v = v.data(); \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is data() called here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

because s and v now have type std::array

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

k2 k2 related

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants