Skip to content
Merged
Show file tree
Hide file tree
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 Apr 24, 2025
b67730e
Update to latest yscope-dev-utils.
kirkrodrigues Apr 24, 2025
c6dac9a
Move dependency checksums into build/deps directory; Combine core's d…
kirkrodrigues Apr 25, 2025
2ce6e21
build(deps): Migrate ANTLR installation from Python script to task.
kirkrodrigues Apr 26, 2025
049e973
build(deps): Migrate outcome installation from submodule to task.
kirkrodrigues Apr 26, 2025
72d097f
build(deps): Migrate sqlite3 installation from Python script to task.
kirkrodrigues Apr 26, 2025
44cd30f
build(deps): Migrate utfcpp installation from submodule to task.
kirkrodrigues Apr 26, 2025
e36c516
build(deps): Migrate absl installation from submodule to task; Rename…
kirkrodrigues Apr 26, 2025
a44760a
build(deps): Migrate Catch2 installation from submodule to task; Rena…
kirkrodrigues Apr 26, 2025
d0e98b4
build(deps): Migrate nlohmann_json installation from submodule to tas…
kirkrodrigues Apr 26, 2025
27c3af7
build(deps): Migrate date installation from submodule to task.
kirkrodrigues Apr 26, 2025
8bd6419
build(deps): Migrate simdjson installation from submodule to task.
kirkrodrigues Apr 26, 2025
9aae9e1
build(deps): Migrate yaml-cpp installation from submodule to task.
kirkrodrigues Apr 26, 2025
6890338
build(deps): Migrate log-surgeon installation from submodule to task.
kirkrodrigues Apr 26, 2025
483565a
build(deps): Migrate ystdlib-cpp installation from submodule to task;…
kirkrodrigues Apr 26, 2025
8b1acc4
Remove obsolete download-dependency task.
kirkrodrigues Apr 26, 2025
598a8c2
Parallelize task-based core dependencies installation; Rename all-int…
kirkrodrigues Apr 26, 2025
1ee0360
Make install-remote-cmake-lib task depend on init so directories are …
kirkrodrigues Apr 26, 2025
bd2e81f
Add new taskfile to GH workflow deps and YAML linting.
kirkrodrigues Apr 26, 2025
3662dff
Apply suggestions from code review
kirkrodrigues Apr 27, 2025
a1eff8a
taskfiles/deps/utils.yaml: Fix lint violation.
kirkrodrigues Apr 27, 2025
5d24ee5
Rename clean-old-core-checksum-files to clean-outdated-core-checksum-…
kirkrodrigues Apr 27, 2025
152fb8a
Edit code review suggestions.
kirkrodrigues Apr 27, 2025
c955274
Remove unused G_DEPS_CORE_CMAKE_SETTINGS_FILE.
kirkrodrigues Apr 27, 2025
59b7a8e
Remove obsolete CMake include references to submodules directory.
kirkrodrigues Apr 27, 2025
3c87cba
Remove sqlite3ext.h.
kirkrodrigues Apr 27, 2025
f2790eb
Rename CLP_XXX_SOURCE_DIRECTORY to CLP_XXX_INCLUDES_DIRECTORY for hea…
kirkrodrigues Apr 27, 2025
1ee6482
Nest outcome header under outcome directory that's a symlink of the d…
kirkrodrigues Apr 27, 2025
b1ae815
Nest sqlite3 headers under sqlite3 directory that's a symlink of the …
kirkrodrigues Apr 27, 2025
84125e7
Add missing init step for sqlite3 and utfcpp dependencies.
kirkrodrigues Apr 27, 2025
2266e4a
Switch to outcome release tar that's not from githubusercontent.com.
kirkrodrigues Apr 27, 2025
23ac5bb
Rename includes to include to match Unix's naming-convention.
kirkrodrigues Apr 27, 2025
6c4469b
Switch to nlohmann_json release tar that's not from githubusercontent…
kirkrodrigues Apr 27, 2025
85ba10a
Grammar fix.
kirkrodrigues Apr 27, 2025
5993d10
Merge branch 'core-taskfile-install-deps' into kvir-search-query-hand…
LinZhihao-723 Apr 27, 2025
28d0f89
Merge conflict
LinZhihao-723 Apr 27, 2025
27a188a
Add Ast evaluation result.
LinZhihao-723 Apr 27, 2025
6068f24
Add cmake
LinZhihao-723 Apr 27, 2025
9649abe
Impl...
LinZhihao-723 Apr 28, 2025
a4da5ea
Merge branch 'oss-main' into kvir-search-query-handler-interface
LinZhihao-723 Apr 28, 2025
757e85d
Finish the interface.
LinZhihao-723 Apr 28, 2025
f9ee740
Update error code.
LinZhihao-723 Apr 28, 2025
19a7749
Fix...
LinZhihao-723 Apr 28, 2025
479c571
Rename error code
LinZhihao-723 Apr 28, 2025
7bfe895
Apply suggestions from code review
LinZhihao-723 Apr 28, 2025
ed854c7
Merge oss main.
LinZhihao-723 Apr 28, 2025
36b042c
Update error code's doc string and macro guard.
LinZhihao-723 Apr 28, 2025
634fbba
Simpify docstring.
LinZhihao-723 Apr 28, 2025
c1a0b97
Missing rename
LinZhihao-723 Apr 28, 2025
b2f096a
Update components/core/src/clp/ffi/ir_stream/search/QueryHandler.hpp
LinZhihao-723 Apr 28, 2025
ab0175c
Update method name according to code review discussion.
LinZhihao-723 Apr 28, 2025
17790a8
Refactor docstring.
LinZhihao-723 Apr 28, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions components/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,11 @@ set(SOURCE_FILES_unitTest
src/clp/ffi/ir_stream/protocol_constants.hpp
src/clp/ffi/ir_stream/Serializer.cpp
src/clp/ffi/ir_stream/Serializer.hpp
src/clp/ffi/ir_stream/search/AstEvaluationResult.hpp
src/clp/ffi/ir_stream/search/ErrorCode.cpp
src/clp/ffi/ir_stream/search/ErrorCode.hpp
src/clp/ffi/ir_stream/search/NewProjectedSchemaTreeNodeCallbackReq.hpp
src/clp/ffi/ir_stream/search/QueryHandler.hpp
src/clp/ffi/ir_stream/utils.cpp
src/clp/ffi/ir_stream/utils.hpp
src/clp/ffi/KeyValuePairLogEvent.cpp
Expand Down
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 components/core/src/clp/ffi/ir_stream/search/ErrorCode.cpp
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 components/core/src/clp/ffi/ir_stream/search/ErrorCode.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#ifndef CLP_FFI_IR_STREAM_SEARCH_QUERYHANDLERERRORCODE_HPP
#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.
*/
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 components/core/src/clp/ffi/ir_stream/search/QueryHandler.hpp
Copy link
Member Author

Choose a reason for hiding this comment

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

@kirkrodrigues Can u help review;

  • The docstring of this class.
  • The docstring and naming of the two APIs:
    • step_column_resolution
    • evaluate_node_id_value_pairs

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.
*
* 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.
* - evaluating the query against deserialized node-ID-value pairs.
*
* @tparam NewProjectedSchemaTreeNodeCallbackType Type of the callback to handle new projected
* schema tree nodes.
*/
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.
* @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(
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
Loading