Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
7b203a6
Add iterative evaluation method
LinZhihao-723 May 6, 2025
e74e31f
Fix null query issue.
LinZhihao-723 May 6, 2025
e3636fe
Implement search.
LinZhihao-723 May 6, 2025
10008b5
Ops, forget to commit this one.
LinZhihao-723 May 7, 2025
00e2ecc
Fix clang-tidy warnings on the tes files.
LinZhihao-723 May 7, 2025
ca87b29
Ignore unsupported literal types.
LinZhihao-723 May 7, 2025
8f51308
WIP
LinZhihao-723 May 7, 2025
e7a578b
Working on the unit tests...
LinZhihao-723 May 7, 2025
6791912
Add basic
LinZhihao-723 May 7, 2025
7ea6075
Merge branch 'oss_main' into kvir-search-query-handler-evaluation
LinZhihao-723 May 7, 2025
dd35aa2
Finish test dev
LinZhihao-723 May 8, 2025
bfe5873
Add inverter to the test
LinZhihao-723 May 8, 2025
ed633bf
Update test case.
LinZhihao-723 May 11, 2025
8dda41b
Add comments for xor.
LinZhihao-723 May 11, 2025
fd0c79a
Update components/core/src/clp/ffi/ir_stream/search/ErrorCode.cpp
LinZhihao-723 May 11, 2025
cc6bdd4
Merge branch 'kvir-search-query-handler-evaluation' of https://github…
LinZhihao-723 May 11, 2025
d9d27b5
Apply code review comments.
LinZhihao-723 May 11, 2025
1a6694d
Fix doc strings.
LinZhihao-723 May 12, 2025
b24af9c
Apply code review comments to move pruned check out of loop.
LinZhihao-723 May 12, 2025
8667286
Merge branch 'main' into kvir-search-query-handler-evaluation
LinZhihao-723 May 12, 2025
57568f2
Fix docstrings.
LinZhihao-723 May 13, 2025
2cad470
Apply suggestions from code review
LinZhihao-723 May 14, 2025
d7d8a92
Update components/core/src/clp/ffi/ir_stream/search/QueryHandlerImpl.hpp
LinZhihao-723 May 14, 2025
f32419f
Rename result bitmask type.
LinZhihao-723 May 14, 2025
66ed01f
Renaming push and pop according to the review comments.
LinZhihao-723 May 14, 2025
6067998
Fix docstring.
LinZhihao-723 May 14, 2025
ea1a28c
Use constexpr.
LinZhihao-723 May 14, 2025
e8e3148
Merge branch 'oss_main' into kvir-search-query-handler-evaluation
LinZhihao-723 May 14, 2025
620abca
Fix...
LinZhihao-723 May 14, 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
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,22 @@
#define CLP_FFI_IR_STREAM_SEARCH_ASTEVALUATIONRESULT_HPP

#include <cstdint>
#include <type_traits>

namespace clp::ffi::ir_stream::search {
/**
* Enum representing the result of evaluating a search AST.
*/
enum class AstEvaluationResult : uint8_t {
True,
False,
enum AstEvaluationResult : uint8_t {
True = 1,
False = 1 << 1,

// The AST evaluation is intentionally skipped because it belongs to a pruned branch of the
// parent tree.
Pruned,
Pruned = 1 << 2,
};

using ast_evaluation_result_bitmask_t = std::underlying_type_t<AstEvaluationResult>;
} // namespace clp::ffi::ir_stream::search

#endif // CLP_FFI_IR_STREAM_SEARCH_ASTEVALUATIONRESULT_HPP
9 changes: 7 additions & 2 deletions components/core/src/clp/ffi/ir_stream/search/ErrorCode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ auto ErrorCategory::message(ErrorCodeEnum error_enum) const -> std::string {
switch (error_enum) {
case ErrorCodeEnum::AstDynamicCastFailure:
return "Failed to dynamically cast an AST node to the expected type.";
case ErrorCodeEnum::AstEvaluationInvariantViolation:
return "Internal invariant violated during AST evaluation. This indicates a serious"
" bug in the evaluation logic.";
case ErrorCodeEnum::AttemptToIterateAstLeafExpr:
return "Attempted to iterate a leaf expression of an AST.";
case ErrorCodeEnum::ColumnDescriptorTokenIteratorOutOfBounds:
return "Attempted to access a token beyond the end of the column descriptor.";
case ErrorCodeEnum::ColumnTokenizationFailure:
Expand All @@ -27,6 +32,8 @@ auto ErrorCategory::message(ErrorCodeEnum error_enum) const -> std::string {
return "The projected column is not unique.";
case ErrorCodeEnum::EncodedTextAstDecodingFailure:
return "Failed to decode the given encoded text AST.";
case ErrorCodeEnum::ExpressionTypeUnexpected:
return "Unexpected expression type.";
case ErrorCodeEnum::LiteralTypeUnexpected:
return "Unexpected literal type.";
case ErrorCodeEnum::LiteralTypeUnsupported:
Expand All @@ -35,8 +42,6 @@ auto ErrorCategory::message(ErrorCodeEnum error_enum) const -> std::string {
return "The requested method is not implemented.";
case ErrorCodeEnum::ProjectionColumnDescriptorCreationFailure:
return "Failed to create a column descriptor for the given projection.";
case ErrorCodeEnum::QueryExpressionIsNull:
return "The query expression is NULL.";
case ErrorCodeEnum::QueryTransformationPassFailed:
return "Failed to execute transformation passes on the query expression.";
default:
Expand Down
4 changes: 3 additions & 1 deletion components/core/src/clp/ffi/ir_stream/search/ErrorCode.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,18 @@ namespace clp::ffi::ir_stream::search {
*/
enum class ErrorCodeEnum : uint8_t {
AstDynamicCastFailure = 1,
AstEvaluationInvariantViolation,
AttemptToIterateAstLeafExpr,
ColumnDescriptorTokenIteratorOutOfBounds,
ColumnTokenizationFailure,
DuplicateProjectedColumn,
EncodedTextAstDecodingFailure,
ExpressionTypeUnexpected,
LiteralTypeUnexpected,
LiteralTypeUnsupported,
MethodNotImplemented,
ProjectionColumnDescriptorCreationFailure,
QueryTransformationPassFailed,
QueryExpressionIsNull,
};

using ErrorCode = ystdlib::error_handling::ErrorCode<ErrorCodeEnum>;
Expand Down
18 changes: 6 additions & 12 deletions components/core/src/clp/ffi/ir_stream/search/QueryHandler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,21 +90,15 @@ class QueryHandler {
}

/**
* 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
* Evaluates the given kv-pair log event against the underlying query.
* @param log_event
* @return A result containing the evaluation result on success, or an error code indicating
* the failure:
* - Forwards `QueryHandlerImpl::evaluate_node_id_value_pairs`'s return values.
* - Forwards `QueryHandlerImpl::evaluate_kv_pair_log_event`'s return values.
*/
[[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> {
return m_query_handler_impl.evaluate_node_id_value_pairs(
auto_gen_node_id_value_pairs,
user_gen_node_id_value_pairs
);
[[nodiscard]] auto evaluate_kv_pair_log_event(KeyValuePairLogEvent const& log_event)
-> outcome_v2::std_result<AstEvaluationResult> {
return m_query_handler_impl.evaluate_kv_pair_log_event(log_event);
}

private:
Expand Down
Loading
Loading