-
Notifications
You must be signed in to change notification settings - Fork 88
feat(kv-ir): Add QueryHandler API declarations for handling KV-pair IR stream queries.
#863
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
LinZhihao-723
merged 52 commits into
y-scope:main
from
LinZhihao-723:kvir-search-query-handler-interface
Apr 29, 2025
Merged
Changes from 44 commits
Commits
Show all changes
52 commits
Select commit
Hold shift + click to select a range
06fc873
mv taskfiles/deps.yaml taskfiles/deps/main.yaml
kirkrodrigues b67730e
Update to latest yscope-dev-utils.
kirkrodrigues c6dac9a
Move dependency checksums into build/deps directory; Combine core's d…
kirkrodrigues 2ce6e21
build(deps): Migrate ANTLR installation from Python script to task.
kirkrodrigues 049e973
build(deps): Migrate outcome installation from submodule to task.
kirkrodrigues 72d097f
build(deps): Migrate sqlite3 installation from Python script to task.
kirkrodrigues 44cd30f
build(deps): Migrate utfcpp installation from submodule to task.
kirkrodrigues e36c516
build(deps): Migrate absl installation from submodule to task; Rename…
kirkrodrigues a44760a
build(deps): Migrate Catch2 installation from submodule to task; Rena…
kirkrodrigues d0e98b4
build(deps): Migrate nlohmann_json installation from submodule to tas…
kirkrodrigues 27c3af7
build(deps): Migrate date installation from submodule to task.
kirkrodrigues 8bd6419
build(deps): Migrate simdjson installation from submodule to task.
kirkrodrigues 9aae9e1
build(deps): Migrate yaml-cpp installation from submodule to task.
kirkrodrigues 6890338
build(deps): Migrate log-surgeon installation from submodule to task.
kirkrodrigues 483565a
build(deps): Migrate ystdlib-cpp installation from submodule to task;…
kirkrodrigues 8b1acc4
Remove obsolete download-dependency task.
kirkrodrigues 598a8c2
Parallelize task-based core dependencies installation; Rename all-int…
kirkrodrigues 1ee0360
Make install-remote-cmake-lib task depend on init so directories are …
kirkrodrigues bd2e81f
Add new taskfile to GH workflow deps and YAML linting.
kirkrodrigues 3662dff
Apply suggestions from code review
kirkrodrigues a1eff8a
taskfiles/deps/utils.yaml: Fix lint violation.
kirkrodrigues 5d24ee5
Rename clean-old-core-checksum-files to clean-outdated-core-checksum-…
kirkrodrigues 152fb8a
Edit code review suggestions.
kirkrodrigues c955274
Remove unused G_DEPS_CORE_CMAKE_SETTINGS_FILE.
kirkrodrigues 59b7a8e
Remove obsolete CMake include references to submodules directory.
kirkrodrigues 3c87cba
Remove sqlite3ext.h.
kirkrodrigues f2790eb
Rename CLP_XXX_SOURCE_DIRECTORY to CLP_XXX_INCLUDES_DIRECTORY for hea…
kirkrodrigues 1ee6482
Nest outcome header under outcome directory that's a symlink of the d…
kirkrodrigues b1ae815
Nest sqlite3 headers under sqlite3 directory that's a symlink of the …
kirkrodrigues 84125e7
Add missing init step for sqlite3 and utfcpp dependencies.
kirkrodrigues 2266e4a
Switch to outcome release tar that's not from githubusercontent.com.
kirkrodrigues 23ac5bb
Rename includes to include to match Unix's naming-convention.
kirkrodrigues 6c4469b
Switch to nlohmann_json release tar that's not from githubusercontent…
kirkrodrigues 85ba10a
Grammar fix.
kirkrodrigues 5993d10
Merge branch 'core-taskfile-install-deps' into kvir-search-query-hand…
LinZhihao-723 28d0f89
Merge conflict
LinZhihao-723 27a188a
Add Ast evaluation result.
LinZhihao-723 6068f24
Add cmake
LinZhihao-723 9649abe
Impl...
LinZhihao-723 a4da5ea
Merge branch 'oss-main' into kvir-search-query-handler-interface
LinZhihao-723 757e85d
Finish the interface.
LinZhihao-723 f9ee740
Update error code.
LinZhihao-723 19a7749
Fix...
LinZhihao-723 479c571
Rename error code
LinZhihao-723 7bfe895
Apply suggestions from code review
LinZhihao-723 ed854c7
Merge oss main.
LinZhihao-723 36b042c
Update error code's doc string and macro guard.
LinZhihao-723 634fbba
Simpify docstring.
LinZhihao-723 c1a0b97
Missing rename
LinZhihao-723 b2f096a
Update components/core/src/clp/ffi/ir_stream/search/QueryHandler.hpp
LinZhihao-723 ab0175c
Update method name according to code review discussion.
LinZhihao-723 17790a8
Refactor docstring.
LinZhihao-723 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
components/core/src/clp/ffi/ir_stream/search/AstEvaluationResult.hpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| #ifndef CLP_FFI_IR_STREAM_SEARCH_ASTEVALUATIONRESULT_HPP | ||
| #define CLP_FFI_IR_STREAM_SEARCH_ASTEVALUATIONRESULT_HPP | ||
|
|
||
| #include <cstdint> | ||
|
|
||
| namespace clp::ffi::ir_stream::search { | ||
| /** | ||
| * Enum representing the result of evaluating a search AST. | ||
| * | ||
| * Possible values: | ||
| * - True: The AST evaluates to `true`. | ||
| * - False: The AST evaluates to `false`. | ||
| * - Pruned: The AST evaluation is intentionally skipped because it belongs to a pruned branch of | ||
| * the parent tree. | ||
| */ | ||
| enum class AstEvaluationResult : uint8_t { | ||
| True, | ||
| False, | ||
| Pruned, | ||
| }; | ||
| } // namespace clp::ffi::ir_stream::search | ||
|
|
||
| #endif // CLP_FFI_IR_STREAM_SEARCH_ASTEVALUATIONRESULT_HPP |
25 changes: 25 additions & 0 deletions
25
components/core/src/clp/ffi/ir_stream/search/ErrorCode.cpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| #include "ErrorCode.hpp" | ||
|
|
||
| #include <string> | ||
|
|
||
| #include <ystdlib/error_handling/ErrorCode.hpp> | ||
|
|
||
| namespace { | ||
| using clp::ffi::ir_stream::search::ErrorCodeEnum; | ||
| using ErrorCategory = ystdlib::error_handling::ErrorCategory<ErrorCodeEnum>; | ||
| } // namespace | ||
|
|
||
| template <> | ||
| auto ErrorCategory::name() const noexcept -> char const* { | ||
| return "clp::ffi::ir_stream::search::QueryHandlerError"; | ||
| } | ||
|
|
||
| template <> | ||
| auto ErrorCategory::message(ErrorCodeEnum error_enum) const -> std::string { | ||
| switch (error_enum) { | ||
| case ErrorCodeEnum::MethodNotImplemented: | ||
| return "The requested method is not implemented."; | ||
| default: | ||
| return "Unknown error code enum."; | ||
| } | ||
| } | ||
21 changes: 21 additions & 0 deletions
21
components/core/src/clp/ffi/ir_stream/search/ErrorCode.hpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| #ifndef CLP_FFI_IR_STREAM_SEARCH_QUERYHANDLERERRORCODE_HPP | ||
LinZhihao-723 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| #define CLP_FFI_IR_STREAM_SEARCH_QUERYHANDLERERRORCODE_HPP | ||
|
|
||
| #include <cstdint> | ||
|
|
||
| #include <ystdlib/error_handling/ErrorCode.hpp> | ||
|
|
||
| namespace clp::ffi::ir_stream::search { | ||
| /** | ||
| * This enum class represents all possible error codes related to query handler. | ||
LinZhihao-723 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| */ | ||
| enum class ErrorCodeEnum : uint8_t { | ||
| MethodNotImplemented, | ||
| }; | ||
|
|
||
| using ErrorCode = ystdlib::error_handling::ErrorCode<ErrorCodeEnum>; | ||
| } // namespace clp::ffi::ir_stream::search | ||
|
|
||
| YSTDLIB_ERROR_HANDLING_MARK_AS_ERROR_CODE_ENUM(clp::ffi::ir_stream::search::ErrorCodeEnum); | ||
|
|
||
| #endif // CLP_FFI_IR_STREAM_SEARCH_QUERYHANDLERERRORCODE_HPP | ||
111 changes: 111 additions & 0 deletions
111
components/core/src/clp/ffi/ir_stream/search/QueryHandler.hpp
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @kirkrodrigues Can u help review;
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,111 @@ | ||
| #ifndef CLP_FFI_IR_STREAM_SEARCH_QUERYHANDLER_HPP | ||
| #define CLP_FFI_IR_STREAM_SEARCH_QUERYHANDLER_HPP | ||
|
|
||
| #include <outcome/outcome.hpp> | ||
|
|
||
| #include "../../KeyValuePairLogEvent.hpp" | ||
| #include "../../SchemaTree.hpp" | ||
| #include "AstEvaluationResult.hpp" | ||
| #include "ErrorCode.hpp" | ||
| #include "NewProjectedSchemaTreeNodeCallbackReq.hpp" | ||
|
|
||
| namespace clp::ffi::ir_stream::search { | ||
| /** | ||
| * Class for handing KV-pair IR stream search queries. | ||
LinZhihao-723 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| * | ||
| * Each query handler stores a KQL query represented as an AST. The handler is responsible for: | ||
| * - resolving column descriptors to concrete schema tree nodes within the stream. | ||
LinZhihao-723 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| * - evaluating the query against deserialized node-ID-value pairs. | ||
| * | ||
| * @tparam NewProjectedSchemaTreeNodeCallbackType Type of the callback to handle new projected | ||
| * schema tree nodes. | ||
LinZhihao-723 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| */ | ||
| template <NewProjectedSchemaTreeNodeCallbackReq NewProjectedSchemaTreeNodeCallbackType> | ||
| class QueryHandler { | ||
| public: | ||
| // Factory function | ||
| /** | ||
| * @param new_projected_schema_tree_node_callback | ||
| * @return A result containing the newly constructed `QueryHandler` on success, or an error code | ||
| * indicating the failure: | ||
| * - TODO | ||
| */ | ||
| [[nodiscard]] static auto create( | ||
| NewProjectedSchemaTreeNodeCallbackType new_projected_schema_tree_node_callback | ||
| ) -> outcome_v2::std_result<QueryHandler>; | ||
|
|
||
| // Delete copy constructor and assignment operator | ||
| QueryHandler(QueryHandler const&) = delete; | ||
| auto operator=(QueryHandler const&) -> QueryHandler& = delete; | ||
|
|
||
| // Default move constructor and assignment operator | ||
| QueryHandler(QueryHandler&&) = default; | ||
| auto operator=(QueryHandler&&) -> QueryHandler& = default; | ||
|
|
||
| // Destructor | ||
| ~QueryHandler() = default; | ||
|
|
||
| /** | ||
| * Processes a newly inserted schema tree node to update the partially-resolved columns. | ||
LinZhihao-723 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| * @param is_auto_generated | ||
| * @param node_locator | ||
| * @param node_id | ||
| * @return A void result on success, or an error code indicating the failure: | ||
| * - TODO | ||
| */ | ||
| [[nodiscard]] auto step_column_resolution( | ||
LinZhihao-723 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| bool is_auto_generated, | ||
| SchemaTree::NodeLocator const& node_locator, | ||
| SchemaTree::Node::id_t node_id | ||
| ) -> outcome_v2::std_result<void>; | ||
|
|
||
| /** | ||
| * Evaluates the given node-ID-value pairs against the underlying query. | ||
| * @param auto_gen_node_id_value_pairs | ||
| * @param user_gen_node_id_value_pairs | ||
| * @return A result containing the evaluation result on success, or an error code indicating | ||
| * the failure: | ||
| * - TODO | ||
| */ | ||
| [[nodiscard]] auto evaluate_node_id_value_pairs( | ||
| KeyValuePairLogEvent::NodeIdValuePairs const& auto_gen_node_id_value_pairs, | ||
| KeyValuePairLogEvent::NodeIdValuePairs const& user_gen_node_id_value_pairs | ||
| ) -> outcome_v2::std_result<AstEvaluationResult>; | ||
|
|
||
| private: | ||
| // Constructor | ||
| explicit QueryHandler( | ||
| NewProjectedSchemaTreeNodeCallbackType new_projected_schema_tree_node_callback | ||
| ) | ||
| : m_new_projected_schema_tree_node_callback{new_projected_schema_tree_node_callback} {} | ||
|
|
||
| NewProjectedSchemaTreeNodeCallbackType m_new_projected_schema_tree_node_callback; | ||
| }; | ||
|
|
||
| template <NewProjectedSchemaTreeNodeCallbackReq NewProjectedSchemaTreeNodeCallbackType> | ||
| auto QueryHandler<NewProjectedSchemaTreeNodeCallbackType>::create( | ||
| [[maybe_unused]] NewProjectedSchemaTreeNodeCallbackType | ||
| new_projected_schema_tree_node_callback | ||
| ) -> outcome_v2::std_result<QueryHandler<NewProjectedSchemaTreeNodeCallbackType>> { | ||
| return ErrorCode{ErrorCodeEnum::MethodNotImplemented}; | ||
| } | ||
|
|
||
| template <NewProjectedSchemaTreeNodeCallbackReq NewProjectedSchemaTreeNodeCallbackType> | ||
| auto QueryHandler<NewProjectedSchemaTreeNodeCallbackType>::step_column_resolution( | ||
| [[maybe_unused]] bool is_auto_generated, | ||
| [[maybe_unused]] SchemaTree::NodeLocator const& node_locator, | ||
| [[maybe_unused]] SchemaTree::Node::id_t node_id | ||
| ) -> outcome_v2::std_result<void> { | ||
| return ErrorCode{ErrorCodeEnum::MethodNotImplemented}; | ||
| } | ||
|
|
||
| template <NewProjectedSchemaTreeNodeCallbackReq NewProjectedSchemaTreeNodeCallbackType> | ||
| auto QueryHandler<NewProjectedSchemaTreeNodeCallbackType>::evaluate_node_id_value_pairs( | ||
| [[maybe_unused]] KeyValuePairLogEvent::NodeIdValuePairs const& auto_gen_node_id_value_pairs, | ||
| [[maybe_unused]] KeyValuePairLogEvent::NodeIdValuePairs const& user_gen_node_id_value_pairs | ||
| ) -> outcome_v2::std_result<AstEvaluationResult> { | ||
| return ErrorCode{ErrorCodeEnum::MethodNotImplemented}; | ||
| } | ||
| } // namespace clp::ffi::ir_stream::search | ||
|
|
||
| #endif // CLP_FFI_IR_STREAM_SEARCH_QUERYHANDLER_HPP | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.