Skip to content

refactor(clp-s): Split up clp-s code to create clp_s::search::ast and clp_s::TimestampPattern libraries.#790

Merged
gibber9809 merged 9 commits into
y-scope:mainfrom
gibber9809:ast-lib-new
Apr 2, 2025
Merged

refactor(clp-s): Split up clp-s code to create clp_s::search::ast and clp_s::TimestampPattern libraries.#790
gibber9809 merged 9 commits into
y-scope:mainfrom
gibber9809:ast-lib-new

Conversation

@gibber9809

@gibber9809 gibber9809 commented Mar 28, 2025

Copy link
Copy Markdown
Contributor

Description

This PR splits up the clp-s build and introduces the clp_s::search::ast and clp_s:TimestampPattern libraries.

The diff is deceptively large, but contains (almost) no real code change. Mostly this PR consists of:

  • Moving ast components into clp_s/search/ast and putting them in the clp_s::search::ast namespace
  • Refactoring code to respect the new clp_s::search::ast namespace
  • Adding some missing includes
  • Changing the lint exceptions in lint-tasks.yml to account for moving code into clp_s/search/ast
  • Modifying various CMakeLists files to create and use clp_s::search::ast and clp_s::TimestampPattern
  • Move StringUtils::has_unescaped_wildcards into SearchUtils (this dependency was missed by the previous refactoring PR refactor(clp-s): Divide clp-s search AST code so that it can easily be turned into a library. #754)

Checklist

  • The PR satisfies the contribution guidelines.
  • This is a breaking change and that has been indicated in the PR title, OR this isn't a
    breaking change.
  • Necessary docs have been updated, OR no docs need to be updated.

Validation performed

  • Validated that unit tests pass succesfully

Summary by CodeRabbit

Summary by CodeRabbit

  • Refactor
    • Reorganized search functionality into a dedicated AST module.
    • Updated namespaces, includes, and function signatures for improved modularity and clarity.
  • Chores
    • Removed obsolete wildcard detection utilities.
    • Streamlined build configurations and dependency management to simplify maintenance.

@gibber9809 gibber9809 requested review from a team and wraymo as code owners March 28, 2025 20:24
@coderabbitai

coderabbitai Bot commented Mar 28, 2025

Copy link
Copy Markdown
Contributor

Walkthrough

This pull request restructures the codebase by migrating a wide range of files and references from the original clp_s::search namespace to a new dedicated clp_s::search::ast namespace. Numerous CMake configuration files are updated to remove obsolete source file listings and add new library dependencies, including a new TimestampPattern library. Additionally, include directives, method signatures, and using declarations in both core and search components (as well as in tests) are revised to reflect the new directory structure and namespace. Obsolete functionality, such as the has_unescaped_wildcards method, is removed.

Changes

File(s) Change Summary
components/core/CMakeLists.txt, components/core/src/clp_s/CMakeLists.txt, components/core/src/clp_s/indexer/CMakeLists.txt, components/core/src/clp_s/search/kql/CMakeLists.txt, components/core/src/clp_s/search/sql/CMakeLists.txt Removed multiple source file listings (e.g. various expression and literal files) from unit test and search module lists; added new libraries (clp_s::search::ast, clp_s::TimestampPattern); updated source file paths to the new ast subdirectory.
components/core/src/clp_s/JsonParser.cpp, SchemaTree.cpp, SchemaTree.hpp, TimestampDictionaryReader.cpp, TimestampDictionaryReader.hpp, TimestampEntry.cpp, TimestampEntry.hpp, TimestampPattern.hpp, Utils.cpp, Utils.hpp, clp-s.cpp Revised include directives and function calls to reference the new ast namespace; adjusted literal types and filtering logic; removed the has_unescaped_wildcards functionality from StringUtils.
components/core/src/clp_s/search/AddTimestampConditions.cpp, AddTimestampConditions.hpp, EvaluateTimestampIndex.cpp, EvaluateTimestampIndex.hpp, Output.cpp, Output.hpp, Projection.cpp, Projection.hpp, SchemaMatch.cpp, SchemaMatch.hpp Updated class inheritance, method signatures, and internal references to use AST-specific types; transitioned all search-related functions and pointers from the old namespace to clp_s::search::ast.
All files under components/core/src/clp_s/search/ast/ (e.g. AndExpr.*, BooleanLiteral.*, ConstantProp.*, …, Value.hpp) Changed namespace declarations from clp_s::search to clp_s::search::ast; reorganised include paths and file locations; added a new utility function (has_unescaped_wildcards) in SearchUtils.
components/core/src/clp_s/search/kql/kql.cpp, kql.hpp, components/core/src/clp_s/search/sql/sql.cpp, sql.hpp Updated header include paths and using declarations to point to the new ast locations; modified parsing function return types to use std::shared_ptr<clp_s::search::ast::Expression>.
components/core/tests/test-clp_s-search.cpp, test-kql.cpp, test-sql.cpp, lint-tasks.yml Adjusted header inclusions and using declarations in test files to utilise the restructured ast namespace; updated lint configuration file paths to reflect the directory reorganisation.

Suggested reviewers

  • LinZhihao-723

📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3433b76 and 3ae6775.

📒 Files selected for processing (2)
  • components/core/src/clp_s/search/Output.cpp (4 hunks)
  • components/core/src/clp_s/search/ast/CMakeLists.txt (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
`**/*.{cpp,hpp,java,js,jsx,tpp,ts,tsx}`: - Prefer `false == ` rather than `!`.

**/*.{cpp,hpp,java,js,jsx,tpp,ts,tsx}: - Prefer false == <expression> rather than !<expression>.

  • components/core/src/clp_s/search/Output.cpp
⏰ Context from checks skipped due to timeout of 90000ms (11)
  • GitHub Check: ubuntu-jammy-lint
  • GitHub Check: ubuntu-jammy-static-linked-bins
  • GitHub Check: centos-stream-9-dynamic-linked-bins
  • GitHub Check: centos-stream-9-static-linked-bins
  • GitHub Check: ubuntu-jammy-dynamic-linked-bins
  • GitHub Check: build-macos (macos-13, false)
  • GitHub Check: build-macos (macos-15, false)
  • GitHub Check: build-macos (macos-13, true)
  • GitHub Check: build (macos-latest)
  • GitHub Check: lint-check (ubuntu-latest)
  • GitHub Check: lint-check (macos-latest)
🔇 Additional comments (6)
components/core/src/clp_s/search/ast/CMakeLists.txt (1)

1-67: LGTM: The new CMake configuration for the AST library is well-structured.

The file is organized clearly with source files grouped logically into separate variables. The library setup follows CMake best practices with appropriate include directories, compile features, and dependencies.

components/core/src/clp_s/search/Output.cpp (5)

9-15: Include directives properly updated for the new namespace structure.

The include paths have been correctly modified to reflect the new directory structure and namespace organization.


20-30: Using directives properly reflect the new namespace structure.

The using directives have been correctly updated to use the clp_s::search::ast namespace for all AST-related types.


61-65: Condition reordered following coding guidelines and comments added for clarity.

The condition has been rewritten to follow the coding guideline of preferring false == <expression> rather than !<expression>. The added comments explain that the timestamp index check is performed a second time because ambiguous columns might match the timestamp column after column resolution.


950-951: Function relocated from StringUtils to ast namespace as planned.

The has_unescaped_wildcards function has been correctly moved from the StringUtils class to the ast namespace as mentioned in the PR objectives.


1136-1138: Namespace updated for cIntegralTypes.

The cIntegralTypes constant has been correctly qualified with the ast:: namespace to reflect the new code organization.

✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai plan to trigger planning for file edits and PR creation.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (7)
components/core/src/clp_s/search/ast/FilterOperation.hpp (2)

1-2: Consider updating header guards to match the new namespace structure.

The header guards still use CLP_S_SEARCH_FILTEROPERATION_HPP instead of something that reflects the new ast namespace. While this won't affect functionality, it might be more consistent to update them.

-#ifndef CLP_S_SEARCH_FILTEROPERATION_HPP
-#define CLP_S_SEARCH_FILTEROPERATION_HPP
+#ifndef CLP_S_SEARCH_AST_FILTEROPERATION_HPP
+#define CLP_S_SEARCH_AST_FILTEROPERATION_HPP

20-20: Update header guard end comment to match any changes to the header guard.

If you update the header guards as suggested above, don't forget to update this end comment as well.

-#endif  // CLP_S_SEARCH_FILTEROPERATION_HPP
+#endif  // CLP_S_SEARCH_AST_FILTEROPERATION_HPP
components/core/src/clp_s/search/ast/FilterExpr.cpp (1)

99-107: Consider adding more context to get_operand return value.

The method returns nullptr if there isn't a second operand, which might be surprising to callers. Consider either adding documentation to clarify this behavior or adding a check before incrementing the iterator.

 std::shared_ptr<Literal> FilterExpr::get_operand() {
     auto it = op_begin();
+    // First operand is the column descriptor, second is the actual operand
     it++;
     if (it == op_end()) {
+        // Return nullptr if there is no operand (e.g., for EXISTS operation)
         return nullptr;
     } else {
         return std::static_pointer_cast<Literal>(*it);
     }
 }
components/core/src/clp_s/search/ast/Transformation.hpp (2)

1-2: Consider updating header guards to match the new namespace structure.

The header guards still use CLP_S_SEARCH_TRANSFORMATION_HPP instead of something that reflects the new ast namespace. While this won't affect functionality, it might be more consistent to update them.

-#ifndef CLP_S_SEARCH_TRANSFORMATION_HPP
-#define CLP_S_SEARCH_TRANSFORMATION_HPP
+#ifndef CLP_S_SEARCH_AST_TRANSFORMATION_HPP
+#define CLP_S_SEARCH_AST_TRANSFORMATION_HPP

21-21: Update header guard end comment to match any changes to the header guard.

If you update the header guards as suggested above, don't forget to update this end comment as well.

-#endif  // CLP_S_SEARCH_TRANSFORMATION_HPP
+#endif  // CLP_S_SEARCH_AST_TRANSFORMATION_HPP
components/core/src/clp_s/search/ast/Integral.hpp (1)

12-13: FIXME Note: Investigate Bitmask Inclusion
There is a FIXME comment regarding why String types are included in the integral bitmask. It would be beneficial to revisit this design decision and either document the rationale or refactor the bitmask usage.

components/core/src/clp_s/search/ast/OrOfAndForm.cpp (1)

34-37: Boolean Negation Style
In lines 34–37 the code uses the negation operator (!expr->is_inverted()) within calls to OrExpr::create and AndExpr::create. According to our coding guidelines for C++ files, it is preferable to use false == expr->is_inverted() instead. This change would further standardise the code style.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c2dd008 and 3433b76.

📒 Files selected for processing (71)
  • components/core/CMakeLists.txt (1 hunks)
  • components/core/src/clp_s/CMakeLists.txt (3 hunks)
  • components/core/src/clp_s/JsonParser.cpp (3 hunks)
  • components/core/src/clp_s/SchemaTree.cpp (1 hunks)
  • components/core/src/clp_s/SchemaTree.hpp (2 hunks)
  • components/core/src/clp_s/TimestampDictionaryReader.cpp (2 hunks)
  • components/core/src/clp_s/TimestampDictionaryReader.hpp (0 hunks)
  • components/core/src/clp_s/TimestampEntry.cpp (1 hunks)
  • components/core/src/clp_s/TimestampEntry.hpp (2 hunks)
  • components/core/src/clp_s/TimestampPattern.hpp (1 hunks)
  • components/core/src/clp_s/Utils.cpp (0 hunks)
  • components/core/src/clp_s/Utils.hpp (0 hunks)
  • components/core/src/clp_s/clp-s.cpp (9 hunks)
  • components/core/src/clp_s/indexer/CMakeLists.txt (1 hunks)
  • components/core/src/clp_s/search/AddTimestampConditions.cpp (1 hunks)
  • components/core/src/clp_s/search/AddTimestampConditions.hpp (3 hunks)
  • components/core/src/clp_s/search/EvaluateTimestampIndex.cpp (1 hunks)
  • components/core/src/clp_s/search/EvaluateTimestampIndex.hpp (2 hunks)
  • components/core/src/clp_s/search/Output.cpp (3 hunks)
  • components/core/src/clp_s/search/Output.hpp (22 hunks)
  • components/core/src/clp_s/search/Projection.cpp (2 hunks)
  • components/core/src/clp_s/search/Projection.hpp (3 hunks)
  • components/core/src/clp_s/search/SchemaMatch.cpp (1 hunks)
  • components/core/src/clp_s/search/SchemaMatch.hpp (8 hunks)
  • components/core/src/clp_s/search/ast/AndExpr.cpp (2 hunks)
  • components/core/src/clp_s/search/ast/AndExpr.hpp (2 hunks)
  • components/core/src/clp_s/search/ast/BooleanLiteral.cpp (2 hunks)
  • components/core/src/clp_s/search/ast/BooleanLiteral.hpp (2 hunks)
  • components/core/src/clp_s/search/ast/CMakeLists.txt (1 hunks)
  • components/core/src/clp_s/search/ast/ColumnDescriptor.cpp (2 hunks)
  • components/core/src/clp_s/search/ast/ColumnDescriptor.hpp (2 hunks)
  • components/core/src/clp_s/search/ast/ConstantProp.cpp (2 hunks)
  • components/core/src/clp_s/search/ast/ConstantProp.hpp (2 hunks)
  • components/core/src/clp_s/search/ast/ConvertToExists.cpp (2 hunks)
  • components/core/src/clp_s/search/ast/ConvertToExists.hpp (2 hunks)
  • components/core/src/clp_s/search/ast/DateLiteral.cpp (2 hunks)
  • components/core/src/clp_s/search/ast/DateLiteral.hpp (2 hunks)
  • components/core/src/clp_s/search/ast/EmptyExpr.cpp (2 hunks)
  • components/core/src/clp_s/search/ast/EmptyExpr.hpp (2 hunks)
  • components/core/src/clp_s/search/ast/Expression.cpp (2 hunks)
  • components/core/src/clp_s/search/ast/Expression.hpp (2 hunks)
  • components/core/src/clp_s/search/ast/FilterExpr.cpp (2 hunks)
  • components/core/src/clp_s/search/ast/FilterExpr.hpp (2 hunks)
  • components/core/src/clp_s/search/ast/FilterOperation.hpp (2 hunks)
  • components/core/src/clp_s/search/ast/Integral.cpp (2 hunks)
  • components/core/src/clp_s/search/ast/Integral.hpp (2 hunks)
  • components/core/src/clp_s/search/ast/Literal.hpp (2 hunks)
  • components/core/src/clp_s/search/ast/NarrowTypes.cpp (2 hunks)
  • components/core/src/clp_s/search/ast/NarrowTypes.hpp (2 hunks)
  • components/core/src/clp_s/search/ast/NullLiteral.cpp (2 hunks)
  • components/core/src/clp_s/search/ast/NullLiteral.hpp (2 hunks)
  • components/core/src/clp_s/search/ast/OrExpr.cpp (2 hunks)
  • components/core/src/clp_s/search/ast/OrExpr.hpp (2 hunks)
  • components/core/src/clp_s/search/ast/OrOfAndForm.cpp (2 hunks)
  • components/core/src/clp_s/search/ast/OrOfAndForm.hpp (2 hunks)
  • components/core/src/clp_s/search/ast/SearchUtils.cpp (3 hunks)
  • components/core/src/clp_s/search/ast/SearchUtils.hpp (2 hunks)
  • components/core/src/clp_s/search/ast/StringLiteral.cpp (2 hunks)
  • components/core/src/clp_s/search/ast/StringLiteral.hpp (2 hunks)
  • components/core/src/clp_s/search/ast/Transformation.hpp (2 hunks)
  • components/core/src/clp_s/search/ast/Value.hpp (2 hunks)
  • components/core/src/clp_s/search/kql/CMakeLists.txt (1 hunks)
  • components/core/src/clp_s/search/kql/kql.cpp (5 hunks)
  • components/core/src/clp_s/search/kql/kql.hpp (1 hunks)
  • components/core/src/clp_s/search/sql/CMakeLists.txt (1 hunks)
  • components/core/src/clp_s/search/sql/sql.cpp (2 hunks)
  • components/core/src/clp_s/search/sql/sql.hpp (1 hunks)
  • components/core/tests/test-clp_s-search.cpp (2 hunks)
  • components/core/tests/test-kql.cpp (1 hunks)
  • components/core/tests/test-sql.cpp (1 hunks)
  • lint-tasks.yml (1 hunks)
💤 Files with no reviewable changes (3)
  • components/core/src/clp_s/TimestampDictionaryReader.hpp
  • components/core/src/clp_s/Utils.hpp
  • components/core/src/clp_s/Utils.cpp
🧰 Additional context used
📓 Path-based instructions (1)
`**/*.{cpp,hpp,java,js,jsx,tpp,ts,tsx}`: - Prefer `false == ` rather than `!`.

**/*.{cpp,hpp,java,js,jsx,tpp,ts,tsx}: - Prefer false == <expression> rather than !<expression>.

  • components/core/src/clp_s/TimestampPattern.hpp
  • components/core/src/clp_s/search/ast/Transformation.hpp
  • components/core/src/clp_s/search/ast/ConvertToExists.cpp
  • components/core/src/clp_s/search/ast/ConvertToExists.hpp
  • components/core/src/clp_s/search/ast/FilterOperation.hpp
  • components/core/src/clp_s/search/ast/ColumnDescriptor.cpp
  • components/core/src/clp_s/search/ast/Expression.hpp
  • components/core/src/clp_s/search/ast/EmptyExpr.cpp
  • components/core/src/clp_s/search/ast/ConstantProp.cpp
  • components/core/src/clp_s/search/ast/Integral.hpp
  • components/core/src/clp_s/search/ast/Value.hpp
  • components/core/src/clp_s/search/ast/OrExpr.hpp
  • components/core/src/clp_s/search/ast/Literal.hpp
  • components/core/src/clp_s/search/ast/OrExpr.cpp
  • components/core/src/clp_s/search/ast/DateLiteral.hpp
  • components/core/src/clp_s/search/ast/NullLiteral.cpp
  • components/core/src/clp_s/search/ast/EmptyExpr.hpp
  • components/core/src/clp_s/search/ast/BooleanLiteral.hpp
  • components/core/src/clp_s/search/ast/Integral.cpp
  • components/core/src/clp_s/search/ast/ConstantProp.hpp
  • components/core/src/clp_s/search/ast/NullLiteral.hpp
  • components/core/src/clp_s/search/ast/FilterExpr.cpp
  • components/core/src/clp_s/search/ast/NarrowTypes.cpp
  • components/core/src/clp_s/search/ast/NarrowTypes.hpp
  • components/core/src/clp_s/search/ast/AndExpr.hpp
  • components/core/src/clp_s/search/ast/OrOfAndForm.cpp
  • components/core/src/clp_s/search/ast/Expression.cpp
  • components/core/src/clp_s/search/ast/ColumnDescriptor.hpp
  • components/core/src/clp_s/TimestampEntry.cpp
  • components/core/src/clp_s/search/ast/OrOfAndForm.hpp
  • components/core/src/clp_s/search/ast/DateLiteral.cpp
  • components/core/src/clp_s/search/sql/sql.cpp
  • components/core/src/clp_s/search/AddTimestampConditions.cpp
  • components/core/src/clp_s/TimestampDictionaryReader.cpp
  • components/core/src/clp_s/search/ast/SearchUtils.hpp
  • components/core/src/clp_s/search/kql/kql.hpp
  • components/core/src/clp_s/search/Projection.cpp
  • components/core/tests/test-sql.cpp
  • components/core/src/clp_s/search/ast/BooleanLiteral.cpp
  • components/core/src/clp_s/search/EvaluateTimestampIndex.hpp
  • components/core/src/clp_s/SchemaTree.hpp
  • components/core/src/clp_s/search/ast/StringLiteral.cpp
  • components/core/src/clp_s/SchemaTree.cpp
  • components/core/src/clp_s/search/EvaluateTimestampIndex.cpp
  • components/core/src/clp_s/search/ast/FilterExpr.hpp
  • components/core/src/clp_s/search/ast/AndExpr.cpp
  • components/core/src/clp_s/search/ast/SearchUtils.cpp
  • components/core/src/clp_s/search/AddTimestampConditions.hpp
  • components/core/tests/test-clp_s-search.cpp
  • components/core/src/clp_s/clp-s.cpp
  • components/core/src/clp_s/search/ast/StringLiteral.hpp
  • components/core/src/clp_s/search/sql/sql.hpp
  • components/core/src/clp_s/search/Projection.hpp
  • components/core/src/clp_s/search/SchemaMatch.cpp
  • components/core/src/clp_s/search/Output.cpp
  • components/core/src/clp_s/TimestampEntry.hpp
  • components/core/src/clp_s/JsonParser.cpp
  • components/core/tests/test-kql.cpp
  • components/core/src/clp_s/search/kql/kql.cpp
  • components/core/src/clp_s/search/SchemaMatch.hpp
  • components/core/src/clp_s/search/Output.hpp
🧬 Code Definitions (5)
components/core/src/clp_s/search/EvaluateTimestampIndex.hpp (3)
components/core/src/clp_s/search/Output.hpp (6)
  • expr (122-122)
  • expr (130-130)
  • expr (138-138)
  • expr (345-345)
  • expr (360-360)
  • expr (366-366)
components/core/src/clp_s/search/SchemaMatch.hpp (2)
  • expr (27-27)
  • expr (143-147)
components/core/src/clp_s/search/AddTimestampConditions.hpp (1)
  • expr (41-41)
components/core/src/clp_s/SchemaTree.cpp (2)
components/core/src/clp_s/search/ast/StringLiteral.hpp (2)
  • type (40-40)
  • type (40-40)
components/core/src/clp_s/ColumnReader.hpp (6)
  • Integer (82-82)
  • Float (105-105)
  • VarString (210-210)
  • Boolean (128-128)
  • DateString (247-247)
  • Unknown (39-39)
components/core/src/clp_s/search/Output.cpp (2)
components/core/src/clp_s/search/ast/SearchUtils.hpp (1)
  • has_unescaped_wildcards (67-67)
components/core/src/clp_s/search/ast/SearchUtils.cpp (2)
  • has_unescaped_wildcards (137-147)
  • has_unescaped_wildcards (137-137)
components/core/src/clp_s/search/SchemaMatch.hpp (3)
components/core/src/clp_s/search/Output.hpp (6)
  • expr (122-122)
  • expr (130-130)
  • expr (138-138)
  • expr (345-345)
  • expr (360-360)
  • expr (366-366)
components/core/src/clp_s/search/AddTimestampConditions.hpp (1)
  • expr (41-41)
components/core/src/clp_s/search/Projection.hpp (1)
  • column (42-42)
components/core/src/clp_s/search/Output.hpp (4)
components/core/src/clp_s/search/AddTimestampConditions.hpp (1)
  • expr (41-41)
components/core/src/clp_s/search/SchemaMatch.hpp (5)
  • expr (27-27)
  • expr (143-147)
  • schema (33-33)
  • schema (48-48)
  • schema (55-55)
components/core/src/clp_s/search/EvaluateTimestampIndex.hpp (1)
  • expr (26-26)
components/core/src/clp_s/search/ast/StringLiteral.hpp (2)
  • op (56-56)
  • op (58-58)
🪛 Cppcheck (2.10-2)
components/core/tests/test-kql.cpp

[performance] 12-12: Variable 'm_previous_logging_level' is assigned in constructor body. Consider performing initialization in initialization list.

(useInitializationList)

⏰ Context from checks skipped due to timeout of 90000ms (10)
  • GitHub Check: centos-stream-9-dynamic-linked-bins
  • GitHub Check: centos-stream-9-static-linked-bins
  • GitHub Check: ubuntu-jammy-static-linked-bins
  • GitHub Check: ubuntu-jammy-dynamic-linked-bins
  • GitHub Check: ubuntu-jammy-lint
  • GitHub Check: build-macos (macos-14, false)
  • GitHub Check: build-macos (macos-15, false)
  • GitHub Check: build-macos (macos-15, true)
  • GitHub Check: build-macos (macos-13, true)
  • GitHub Check: build-macos (macos-13, false)
🔇 Additional comments (195)
components/core/src/clp_s/search/ast/ConvertToExists.hpp (1)

6-6: Appropriate namespace change for the restructuring

The namespace change from clp_s::search to clp_s::search::ast is consistent with the PR objective of creating a dedicated clp_s::search::ast library. This helps in better organization of the AST-related components.

Also applies to: 27-27

components/core/src/clp_s/TimestampPattern.hpp (1)

14-14: Proper include for dependency

The addition of the ErrorCode.hpp include is necessary as it's used in the OperationFailed exception class constructor. This ensures the class has access to all required dependencies.

components/core/src/clp_s/search/ast/Expression.cpp (1)

3-3: Namespace updated to match new structure

The namespace change from clp_s::search to clp_s::search::ast aligns with the PR objective of reorganizing AST-related components into a dedicated namespace.

Also applies to: 35-35

components/core/src/clp_s/search/ast/Literal.hpp (1)

9-9: Consistent namespace restructuring

The namespace change properly places the Literal class in the clp_s::search::ast namespace, which is consistent with the overall architecture changes in this PR.

Also applies to: 108-108

components/core/src/clp_s/search/ast/EmptyExpr.cpp (1)

3-3: Namespace updated as part of restructuring

The namespace change from clp_s::search to clp_s::search::ast is consistent with the PR's goal of reorganizing the codebase.

Also applies to: 27-27

components/core/src/clp_s/search/ast/ConstantProp.cpp (1)

9-9: Namespace updated correctly.

The namespace has been properly changed from clp_s::search to clp_s::search::ast which aligns with the PR objective of reorganizing the codebase.

Also applies to: 43-43

components/core/src/clp_s/search/ast/FilterOperation.hpp (1)

4-4: Namespace updated correctly.

The namespace has been properly changed from clp_s::search to clp_s::search::ast which aligns with the PR objective of reorganizing the codebase.

Also applies to: 18-18

components/core/src/clp_s/search/ast/FilterExpr.cpp (1)

3-3: Namespace updated correctly.

The namespace has been properly changed from clp_s::search to clp_s::search::ast which aligns with the PR objective of reorganizing the codebase.

Also applies to: 108-108

components/core/src/clp_s/search/ast/Transformation.hpp (1)

6-6: Namespace updated correctly.

The namespace has been properly changed from clp_s::search to clp_s::search::ast which aligns with the PR objective of reorganizing the codebase.

Also applies to: 19-19

components/core/src/clp_s/search/ast/OrExpr.cpp (1)

3-3: Namespace updated correctly.

The namespace has been properly changed from clp_s::search to clp_s::search::ast which aligns with the PR objective of reorganizing the codebase.

Also applies to: 55-55

components/core/src/clp_s/search/ast/Expression.hpp (2)

10-10: Namespace Update: Declaration Change
The namespace declaration has been correctly updated to clp_s::search::ast, which reflects the new modular organisation of the AST components.


116-116: Namespace Closure Update: Correct End Marker
The closing namespace directive is properly updated to clp_s::search::ast, ensuring that the entire class definition remains within the intended scope.

components/core/src/clp_s/search/ast/FilterExpr.hpp (2)

11-11: Namespace Declaration Update
The namespace declaration has been updated to clp_s::search::ast, aligning this header with the new code structure.


98-98: Namespace Closure Consistency
The updated closing namespace directive confirms that all definitions are correctly encapsulated within clp_s::search::ast.

components/core/src/clp_s/search/ast/StringLiteral.cpp (3)

5-5: Include Directive Revision
Changing the include from "Utils.hpp" to "SearchUtils.hpp" is a good move. This update aligns better with the new organisational hierarchy for AST utilities.


7-7: Namespace Declaration Update
The namespace is now correctly declared as clp_s::search::ast, which ensures that the StringLiteral implementation is scoped appropriately within the AST module.


95-95: Namespace Closure Update
The closing brace now properly marks the end of the clp_s::search::ast namespace, keeping the code well-organised and encapsulated.

components/core/src/clp_s/search/ast/AndExpr.hpp (2)

6-6: Namespace Declaration Refactoring
The namespace declaration has been updated to clp_s::search::ast, clearly grouping the AST-specific classes.


56-56: Namespace Closure Confirmation
The closing namespace directive now correctly reflects the new namespace structure, ensuring consistency throughout the file.

components/core/src/clp_s/search/ast/Integral.hpp (2)

10-10: Namespace Declaration Updated
The namespace is now declared as clp_s::search::ast, which is consistent with the overall restructuring of the codebase.


80-80: Namespace Closure Consistency
The closing namespace directive is updated correctly, ensuring the file’s contents remain within the clp_s::search::ast scope.

components/core/src/clp_s/search/ast/AndExpr.cpp (2)

5-5: Namespace declaration update.
The declaration on line 5 now correctly uses namespace clp_s::search::ast, aligning this file with the new project structure.


57-57: Proper closing of the namespace.
The closing brace on line 57 now accurately reflects the updated namespace. Great work maintaining consistency across the file.

components/core/src/clp_s/search/ast/NullLiteral.cpp (2)

3-3: Namespace update in effect.
Line 3 introduces the new namespace clp_s::search::ast properly. This change is consistent with the overall reorganisation effort.


32-32: Namespace closure confirmation.
The closing namespace directive on line 32 correctly terminates the scope for clp_s::search::ast.

components/core/src/clp_s/search/ast/ConvertToExists.cpp (2)

11-11: Updated namespace declaration.
The updated namespace on line 11 (clp_s::search::ast) is now in place, ensuring that the file is part of the refactored AST module.


116-116: Correct closure for the updated namespace.
The closing brace on line 116 now properly concludes the namespace block introduced at the start.

components/core/src/clp_s/search/ast/NarrowTypes.hpp (2)

9-9: Namespace correction in header.
Line 9 correctly introduces the clp_s::search::ast namespace for the NarrowTypes class, in line with the reorganisation strategy.


26-27: Updated closing namespace directive.
The closing directive now matches the new namespace structure perfectly.

components/core/src/clp_s/search/ast/Value.hpp (2)

6-6: Namespace update implemented.
The namespace declaration on line 6 has been modified to clp_s::search::ast, ensuring consistency across related modules.


31-32: Correct namespace closure.
The closing brace on line 31 correctly finishes the updated namespace block.

components/core/src/clp_s/search/ast/EmptyExpr.hpp (2)

6-6: Namespace Declaration Updated
The namespace declaration has been updated to clp_s::search::ast, which clearly reflects the new modular structure for AST components. This change improves code clarity and consistency with the broader refactoring.


35-35: Consistent Namespace Closure
The closing namespace marker now correctly reads } // namespace clp_s::search::ast, ensuring that the file remains fully consistent with the new namespace hierarchy.

components/core/src/clp_s/search/ast/ConstantProp.hpp (2)

6-6: Namespace Declaration Updated
The namespace in this header has been shifted to clp_s::search::ast, aligning it with the reorganisation of AST-related classes. This update promotes better modular separation within the codebase.


21-21: Consistent Namespace Closure
The closing bracket now properly declares the end of the clp_s::search::ast namespace. This ensures that all entities in the file are correctly scoped.

components/core/src/clp_s/search/ast/OrOfAndForm.cpp (2)

7-7: Namespace Relocation
The namespace has been updated to clp_s::search::ast at the start of the file. This refactoring supports the overall modular structure established in this PR and is consistently applied.


179-179: Namespace Closure Consistency
The closing namespace comment now correctly refers to clp_s::search::ast. This consistent update ensures the file adheres to the new namespace convention.

components/core/src/clp_s/search/ast/Integral.cpp (2)

7-7: Namespace Update
The namespace change to clp_s::search::ast is cleanly implemented at the beginning of the file. This aligns the Integral class with the new AST sub-namespace as intended.


96-96: Consistent Namespace Closure
The file’s closing namespace marker is now in line with the reorganisation, identifying the correct clp_s::search::ast namespace.

components/core/src/clp_s/search/ast/NullLiteral.hpp (2)

10-10: Namespace Declaration Updated
The file now declares its contents within the clp_s::search::ast namespace. This change reinforces the newly introduced modular separation for AST elements.


52-52: Proper Namespace Closure
The closing of the namespace is correctly updated to match clp_s::search::ast, ensuring that all declarations within this header reside in the appropriate namespace.

components/core/src/clp_s/search/ast/DateLiteral.hpp (3)

6-6: Include path updated correctly to match new directory structure.

The include path for Defs.hpp has been properly updated to reflect the new location of the DateLiteral.hpp file in the ast subdirectory.


9-9: Namespace updated to reflect new code organization.

The namespace has been correctly updated from clp_s::search to clp_s::search::ast as part of the code refactoring to create a dedicated AST library.


61-61: Closing namespace comment updated to match new namespace.

The closing namespace comment has been properly updated to reflect the new namespace structure.

components/core/src/clp_s/search/ast/BooleanLiteral.hpp (2)

10-10: Namespace updated to reflect new code organization.

The namespace has been correctly updated from clp_s::search to clp_s::search::ast as part of the code refactoring to create a dedicated AST library.


56-56: Closing namespace comment updated to match new namespace.

The closing namespace comment has been properly updated to reflect the new namespace structure.

components/core/src/clp_s/search/ast/OrExpr.hpp (2)

6-6: Namespace updated to reflect new code organization.

The namespace has been correctly updated from clp_s::search to clp_s::search::ast as part of the code refactoring to create a dedicated AST library.


51-51: Closing namespace comment updated to match new namespace.

The closing namespace comment has been properly updated to reflect the new namespace structure.

components/core/src/clp_s/search/ast/NarrowTypes.cpp (3)

12-12: Namespace updated to reflect new code organization.

The namespace has been correctly updated from clp_s::search to clp_s::search::ast as part of the code refactoring to create a dedicated AST library.


55-82: Code follows project's coding guidelines for boolean expressions.

The code correctly uses false == literal->as_any(op) rather than !literal->as_any(op) which is consistent with the coding guidelines that prefer false == <expression> over !<expression>.


138-138: Closing namespace comment updated to match new namespace.

The closing namespace comment has been properly updated to reflect the new namespace structure.

components/core/src/clp_s/search/ast/ColumnDescriptor.cpp (2)

5-5: Namespace Update Verification
The namespace has been correctly updated to clp_s::search::ast, which clearly delineates the AST-related components. Please ensure that all related header files are updated accordingly.


122-122: Namespace Closure Consistency
The closing namespace directive is now correctly marked for clp_s::search::ast.

components/core/src/clp_s/indexer/CMakeLists.txt (1)

58-59: Updated Source File Paths
The modifications redirect the source file paths for SearchUtils.cpp and SearchUtils.hpp from the old location to the new ../search/ast/ directory, which is consistent with the reorganisation. Ensure that any dependent modules reference these new paths correctly.

components/core/src/clp_s/search/ast/OrOfAndForm.hpp (2)

10-10: Namespace Modification in Header
The namespace declaration is now updated to clp_s::search::ast for the OrOfAndForm class. This change aligns well with the new project structure.


64-64: Namespace Closure in Header
The closing of the namespace is correctly updated and matches the modified opening.

components/core/src/clp_s/search/ast/BooleanLiteral.cpp (2)

3-3: Namespace Update for BooleanLiteral
The updated namespace clp_s::search::ast now correctly encapsulates the BooleanLiteral implementation, which is in line with the overall refactoring objective.


44-44: Proper Namespace Closure
The closing directive for the namespace is updated and correctly reflects the new module structure.

components/core/src/clp_s/TimestampEntry.cpp (6)

6-7: Include Directive Update
The addition of #include "search/ast/FilterOperation.hpp" ensures that the FilterOperation enum is accessible. Verify that the relative include path is accurate relative to the file’s location.


9-10: Using Declaration for FilterOperation
The statement using clp_s::search::ast::FilterOperation; simplifies the usage of the enum in the file. This improves code clarity and maintains consistency with the new namespace.


145-198: Filter Evaluation (Double Timestamp) Logic
The switch-case structure handling various FilterOperation values for a double timestamp is comprehensive. Please verify that returning EvaluatedValue::Unknown in certain conditions aligns with the desired semantics for ambiguous cases.


254-315: Filter Evaluation (epochtime_t) Logic
The implementation utilising std::ceil and std::floor for double-to-epochtime conversions is appropriate. Confirm that these rounding rules meet the business requirements for accurate filtering, especially at the boundary values.


370-377: Begin Timestamp Getter Logic
The logic in get_begin_timestamp distinguishes correctly between Epoch and DoubleEpoch encodings. Casting the double value for epoch timestamps is handled as intended.


379-386: End Timestamp Getter Logic
The use of std::ceil in get_end_timestamp to convert double epoch values is logical. Please verify that this approach does not introduce unintended rounding issues in critical timestamp comparisons.

components/core/src/clp_s/search/ast/SearchUtils.hpp (3)

5-5: Appropriate include added for string_view

The inclusion of <string_view> is necessary for the new function has_unescaped_wildcards which uses std::string_view as its parameter type.


11-11: Namespace updated to match restructuring objectives

The namespace has been updated from clp_s::search to clp_s::search::ast, which aligns with the PR's objective of reorganizing the codebase.


62-67: Well-documented new function with appropriate attributes

The new has_unescaped_wildcards function is properly documented with a clear description of its purpose and return value. The use of [[nodiscard]] is appropriate as the return value shouldn't be ignored.

components/core/src/clp_s/search/ast/DateLiteral.cpp (2)

5-5: Include path correctly updated for new directory structure

The include path has been updated from ../TimestampPattern.hpp to ../../TimestampPattern.hpp to account for the file's move to the ast subdirectory.


8-8: Namespace updated to match restructuring objectives

The namespace has been updated from clp_s::search to clp_s::search::ast, which aligns with the PR's objective of reorganizing the codebase.

components/core/src/clp_s/search/kql/kql.hpp (2)

6-6: Include path correctly updated for new directory structure

The include path has been updated from ../Expression.hpp to ../ast/Expression.hpp to reflect the reorganization of code as described in the PR objectives.


14-14: Function signature properly updated with fully qualified namespace

The function signature has been updated to use the fully qualified namespace for the return type (std::shared_ptr<clp_s::search::ast::Expression>) which is necessary due to the namespace reorganization.

components/core/src/clp_s/search/ast/CMakeLists.txt (4)

1-39: Comprehensive source file listing for the new library

The CLP_S_AST_SOURCES variable includes all the necessary AST-related source and header files that have been moved to the new namespace. This ensures that all components are properly included in the build.


41-47: Core dependencies properly included

The CLP_S_CORE_SOURCES variable includes all the necessary core header files needed for the library's functionality, ensuring proper access to fundamental types and definitions.


49-54: Library correctly defined with alias for consistent referencing

The creation of the clp_s_search_ast library and its alias clp_s::search::ast follows good CMake practices, allowing for consistent referencing of the library from other parts of the project.


55-63: Dependencies properly configured with appropriate visibility

The library configuration correctly:

  • Sets the include directories and C++20 standard
  • Links publicly to clp_s::TimestampPattern which is used in public interfaces
  • Links privately to simdjson which is only used internally

This ensures that dependencies are properly managed and exposed only when necessary.

components/core/src/clp_s/search/ast/ColumnDescriptor.hpp (3)

10-11: Include order is correct.

The include order has been updated correctly to ensure proper dependency resolution. The relative path approach ../../ErrorCode.hpp and ../../TraceableException.hpp is appropriate for the new directory structure.


14-14: Namespace update correctly reflects new code organization.

The namespace has been appropriately updated to clp_s::search::ast which aligns with the PR objective of reorganizing the codebase structure.


308-308: Namespace closing comment is accurate.

The closing namespace comment correctly reflects the full namespace path clp_s::search::ast.

components/core/src/clp_s/search/sql/sql.cpp (2)

9-10: Include paths updated correctly.

The include paths have been properly updated to reflect the new location of EmptyExpr.hpp and Expression.hpp in the ast subdirectory.


22-24: Using declarations added for the ast namespace.

These using declarations for EmptyExpr and Expression from the new clp_s::search::ast namespace help maintain clean code while adapting to the new namespace structure.

components/core/src/clp_s/search/EvaluateTimestampIndex.hpp (3)

4-5: Memory header included for shared_ptr.

Adding the explicit include for <memory> is good practice since this file uses std::shared_ptr.


8-8: Include path updated correctly.

The include path has been correctly updated to reference Expression.hpp from its new location in the ast subdirectory.


26-26: Method signature updated to use ast namespace.

The method signature for run has been properly updated to use std::shared_ptr<ast::Expression> instead of the previous version, which is consistent with the namespace changes and matches the pattern used in other related classes like AddTimestampConditions, SchemaMatch, etc. as seen in the relevant code snippets.

components/core/tests/test-sql.cpp (2)

6-6: Include path updated correctly for test file.

The include path has been properly updated to reference EmptyExpr.hpp from its new location in the ast subdirectory.


10-10: Using declaration updated to reference new namespace.

The using declaration has been correctly updated to reference EmptyExpr from the new clp_s::search::ast namespace.

components/core/src/clp_s/search/AddTimestampConditions.cpp (4)

3-10: Include paths properly updated for AST components

The includes have been correctly updated to reference the new ast/ directory structure, which aligns with the PR objective of creating the clp_s::search::ast library.


12-18: Using declarations properly added for ast namespace

These using declarations improve code readability by eliminating the need for fully qualified names throughout the implementation. The approach maintains consistency with the restructuring objective.


22-22: Coding style follows guidelines

The expression false == m_begin_ts.has_value() correctly follows the coding guideline to prefer false == <expression> rather than !<expression>.


28-28: Consistent coding style maintained

The expression false == m_timestamp_column.has_value() correctly follows the coding guideline to prefer false == <expression> rather than !<expression>.

components/core/src/clp_s/search/ast/StringLiteral.hpp (4)

8-8: Include path updated

The include path has been changed from "Utils.hpp" to "SearchUtils.hpp", reflecting the refactoring of utility functions into the new namespace structure.


10-10: Namespace properly updated to the new structure

The namespace has been changed from clp_s::search to clp_s::search::ast, which aligns with the PR objective of creating a dedicated AST namespace.


72-72: Function call updated

The function call has been changed from StringUtils::has_unescaped_wildcards(m_v) to has_unescaped_wildcards(m_v), reflecting that this function has been moved into the current namespace or is now accessible without qualification.


77-77: Namespace closing comment updated

The namespace closing comment has been correctly updated to reflect the new namespace structure.

components/core/src/clp_s/search/kql/CMakeLists.txt (1)

22-22: Added dependency on the new AST library

The kql library now depends on the new clp_s::search::ast library, which is consistent with the PR's objective of splitting the code into separate libraries. This change ensures that the kql library can use types and functions from the ast namespace.

components/core/src/clp_s/SchemaTree.cpp (3)

5-5: Include path updated for Literal.hpp

The include path has been updated from "search/Literal.hpp" to "search/ast/Literal.hpp" to reflect the new directory structure after code reorganization.


9-9: Return type updated to use the new namespace

The return type of the node_to_literal_type function has been updated from clp_s::search::LiteralType to clp_s::search::ast::LiteralType to align with the new namespace structure.


14-14: LiteralType enum references updated to use the ast namespace

All references to LiteralType values have been updated to use the clp_s::search::ast:: namespace prefix. This ensures consistency with the namespace restructuring throughout the codebase.

Also applies to: 16-16, 18-18, 20-20, 22-22, 24-24, 26-26, 28-28, 32-32

components/core/src/clp_s/search/sql/CMakeLists.txt (1)

21-21: Updated dependency looks correct.

The addition of clp_s::search::ast as a dependency in the target_link_libraries command is consistent with the PR objective of creating a new clp_s::search::ast library and restructuring the codebase.

components/core/src/clp_s/TimestampDictionaryReader.cpp (2)

5-5: Include path updated correctly.

The change in include path from "search/SearchUtils.hpp" to "search/ast/SearchUtils.hpp" properly reflects the restructuring of components into the new AST namespace.


24-30: Function call updated to use the new namespace.

The call to tokenize_column_descriptor has been properly updated to use the new clp_s::search::ast namespace. This is consistent with the PR's objective of moving functionality to the AST namespace.

The boolean comparison style (false == expression) follows the coding guidelines.

components/core/src/clp_s/search/sql/sql.hpp (2)

7-7: Include path updated correctly.

The include path has been updated to reference the Expression.hpp file in its new location within the ast directory.


15-16: Return type updated with correct namespace.

The return type of parse_sql_expression has been updated to explicitly use the clp_s::search::ast::Expression type, which is appropriate given the namespace restructuring in this PR.

components/core/src/clp_s/search/EvaluateTimestampIndex.cpp (5)

3-9: Include paths updated correctly.

All include paths have been properly updated to reference files in their new locations within the ast directory.


10-17: Using directives added for AST types.

Adding these using directives improves code readability by avoiding the need to prefix these commonly used types with their full namespace throughout the file.


19-19: Constant definition updated with correct namespace.

The definition of cDateTypes has been correctly updated to reference search::ast::cIntegralTypes and search::ast::EpochDateT in their new namespace.


58-60: Boolean comparison follows coding guidelines.

The use of false == column->matches_any(cDateTypes) is consistent with the coding guideline preference for false == <expression> rather than !<expression>.


81-83: Boolean comparison follows coding guidelines.

The use of false == matched is consistent with the coding guideline preference for false == <expression> rather than !<expression>.

components/core/src/clp_s/SchemaTree.hpp (2)

15-15: Include path updated correctly.

The include path has been correctly updated to reflect the new location of the Literal.hpp file within the ast subdirectory.


51-51: Return type updated to match new namespace structure.

The return type has been properly updated to use the new namespace structure clp_s::search::ast::LiteralType, which aligns with the PR objective of placing AST components within the clp_s::search::ast namespace.

components/core/src/clp_s/search/ast/SearchUtils.cpp (5)

5-5: Appropriate include added for string_view.

The addition of the string_view include is appropriate since the new function uses std::string_view as a parameter.


10-10: Include path updated correctly.

The include path for archive_constants.hpp has been correctly updated to reflect the new file location in the directory structure.


12-12: Namespace updated to match new structure.

The namespace has been updated to clp_s::search::ast which properly reflects the restructuring mentioned in the PR objectives.


137-147: Function implementation correctly relocated.

The has_unescaped_wildcards function has been correctly implemented in the SearchUtils namespace, as mentioned in the PR objectives which specified relocating this function from StringUtils.

The implementation follows the coding guidelines by using '*' == str[i] instead of str[i] == '*', matching the preference for Yoda-style conditionals seen elsewhere in the codebase.


282-282: Namespace closing comment updated.

The namespace closing comment has been correctly updated to match the new namespace structure.

components/core/tests/test-clp_s-search.cpp (5)

19-23: Include paths updated correctly.

The include paths have been correctly updated to reflect the new location of headers in the ast subdirectory.


118-118: Class reference updated correctly.

The reference to EmptyExpr has been properly updated to use the new namespace clp_s::search::ast::EmptyExpr.

The code also follows the coding guidelines by using nullptr == std::dynamic_pointer_cast<...> rather than std::dynamic_pointer_cast<...> == nullptr.


120-120: Class reference updated correctly.

The reference to OrOfAndForm has been properly updated to use the new namespace clp_s::search::ast::OrOfAndForm.


124-124: Class reference updated correctly.

The reference to NarrowTypes has been properly updated to use the new namespace clp_s::search::ast::NarrowTypes.


128-128: Class reference updated correctly.

The reference to ConvertToExists has been properly updated to use the new namespace clp_s::search::ast::ConvertToExists.

components/core/src/clp_s/search/AddTimestampConditions.hpp (4)

4-4: Standard include added.

The memory include has been properly added, which is necessary for using shared_ptr.


11-12: Include paths updated correctly.

The include paths have been properly updated to reference the headers from the new ast subdirectory.


24-24: Base class updated correctly.

The base class has been updated from Transformation to ast::Transformation to reflect the new namespace structure.


41-41: Method signature updated correctly.

The return type and parameter type have been properly updated to use std::shared_ptrast::Expression instead of std::shared_ptr, aligning with the new namespace structure.

components/core/src/clp_s/search/Projection.cpp (3)

6-6: Proper include added for the AST component.

The addition of the AST-specific include directive aligns with the restructuring of the codebase and ensures proper access to the ColumnDescriptor class that has been moved to the ast namespace.


9-9: Method signature correctly updated to use the new namespace structure.

The parameter type has been properly updated to use the ast namespace, which is consistent with the restructuring mentioned in the PR objectives.


37-37: Method signature correctly updated to use the new namespace structure.

The parameter type for resolve_column has been properly updated to use the ast namespace, maintaining consistency with the add_column method updated earlier.

components/core/src/clp_s/CMakeLists.txt (4)

2-2: New subdirectory correctly added for AST components.

The addition of the search/ast subdirectory aligns with the PR objectives of creating a dedicated namespace for AST-related components.


204-211: New source file set created for TimestampPattern.

This change properly groups related files for the new TimestampPattern library, which aligns with the PR objectives.


213-224: New TimestampPattern library properly defined.

The library definition includes appropriate compiler features (C++20) and dependency linking, ensuring the new library is properly integrated into the build system.


242-243: New libraries correctly linked to the clp-s executable.

The clp-s executable now properly links against both new libraries (clp_s::search::ast and clp_s::TimestampPattern), ensuring access to the restructured components.

components/core/CMakeLists.txt (1)

649-650: New libraries correctly linked to unitTest.

The unitTest executable now properly links against both new libraries (clp_s::search::ast and clp_s::TimestampPattern), ensuring that tests can access the restructured components.

components/core/src/clp_s/TimestampEntry.hpp (2)

12-12: Include path correctly updated for relocated FilterOperation.

The include path has been updated to reflect the new location of the FilterOperation header in the ast namespace.


92-93: Method signatures correctly updated with fully qualified namespace.

Both evaluate_filter method signatures have been properly updated to use the fully qualified name for FilterOperation, clearly indicating which version of the class is being used after the namespace restructuring.

components/core/src/clp_s/search/SchemaMatch.cpp (2)

9-18: Clean refactoring of header includes to utilize the new ast namespace.

The includes have been properly updated to reference AST components from their new location in the ast/ directory, which aligns with the PR objective of splitting the code into a dedicated AST library.


20-32: Well-organized namespace usage with explicit using directives.

The added using directives clearly indicate which AST components are being used in this file, improving code readability while maintaining the separation of concerns introduced by the new namespace structure.

components/core/src/clp_s/search/Projection.hpp (2)

10-10: Updated include directive to use the new ast namespace.

The include path has been correctly updated to reference ColumnDescriptor from its new location in the ast directory.


42-42: Method signatures and member variables properly updated to use ast::ColumnDescriptor.

All references to ColumnDescriptor have been updated to use the new ast namespace, ensuring consistency with the PR objective of creating a dedicated AST library. The changes to method signatures and member variables maintain the existing functionality while adhering to the new code organization.

Also applies to: 82-83, 85-85

components/core/src/clp_s/clp-s.cpp (4)

24-29: Include directives properly updated to reference the new ast namespace.

The includes have been correctly updated to reference AST components from their new location, aligning with the PR objective of creating a dedicated AST library.


71-71: Function parameter type correctly updated to use ast::Expression.

The function signature has been properly updated to use the new namespace, maintaining compatibility with the refactored code structure.


153-181: AST-related objects and functions consistently updated throughout the code.

All references to AST components (EmptyExpr, OrOfAndForm, NarrowTypes, ConvertToExists) have been properly updated to use the ast namespace. The changes maintain functionality while adapting to the new code organization.


209-223: Function calls to AST utility functions properly updated.

Calls to tokenize_column_descriptor and create_from_escaped_tokens have been correctly updated to use the ast namespace, ensuring consistency throughout the codebase.

components/core/src/clp_s/JsonParser.cpp (2)

31-32: Include directives properly updated to reference the new ast namespace.

The includes have been correctly updated to reference ColumnDescriptor and SearchUtils from their new location in the ast directory, aligning with the PR objective.


95-110: Function calls updated to use the ast namespace.

Calls to tokenize_column_descriptor and create_from_escaped_tokens have been properly updated to use the clp_s::search::ast namespace, ensuring consistency throughout the codebase.

components/core/tests/test-kql.cpp (2)

9-12: Includes look properly updated for new AST structure
These added include statements correctly reference the new ast directory without any obvious issues or structural conflicts.

🧰 Tools
🪛 Cppcheck (2.10-2)

[performance] 12-12: Variable 'm_previous_logging_level' is assigned in constructor body. Consider performing initialization in initialization list.

(useInitializationList)


16-20: Namespace usage aligns with the refactored codebase
Using declarations for the ast namespace appear consistent and facilitate clear references to the moved classes.

components/core/src/clp_s/search/Output.cpp (3)

9-15: Correct transition to AST headers
The newly introduced headers under ast/ correctly reflect the new library structure.


19-29: Using directives maintain clarity
These using statements neatly clarify references to AST classes. No issues detected.


941-941: Conditional check respects project guidelines
Using false == ast::has_unescaped_wildcards(query_string) follows the recommended style and integrates the new AST function cleanly.

components/core/src/clp_s/search/kql/kql.cpp (5)

12-23: Includes properly reference refactored AST headers
These additions accurately point to the new ast files with no apparent warnings.


32-45: Using statements correctly adopt the ast namespace
Standardizing these references promotes readability and eases tracking of AST classes.


93-93: Literal unescape check is straightforward
The condition if (false == ...unescape_kql_value(...)) aligns with coding guidelines.


111-111: Accurate date literal unescape
Similarly, verifying unescape_kql_value for date literals matches the same pattern without issues.


132-135: Tokenization condition is clearly handled
This condition correctly verifies the outcome of tokenize_column_descriptor and is stylistically consistent with the rest of the project.

lint-tasks.yml (1)

443-478: Approve namespace restructuring for AST components.

The modification correctly updates the linting exclusion patterns to reflect the new file paths after the AST components were moved to the dedicated ast directory. This change aligns perfectly with the PR objective of restructuring the codebase to create a new clp_s::search::ast namespace.

components/core/src/clp_s/search/Output.hpp (27)

17-18: Updated includes to reference the new ast namespace.

The includes now correctly reference the AST components from their new location in the dedicated ast directory, which aligns with the codebase restructuring objective.


30-30: Updated constructor parameter type to use ast namespace.

The parameter type has been properly updated to use the ast::Expression type from the new namespace.


59-59: Updated member variable declaration to use ast namespace.

The m_expr member variable has been correctly updated to use the ast::Expression type.


79-81: Updated unordered_map declarations to use ast namespace.

The mapping data structures have been properly updated to use the ast::Expression type, maintaining consistency with the namespace changes throughout the file.


89-91: Updated member variables for wildcard handling to use ast namespace.

The wildcard-related member variables have been correctly updated to use the ast namespace for types like ColumnDescriptor and LiteralTypeBitmask.


95-96: Updated OpList iteration variables to use ast namespace.

The expression state stack now correctly uses the ast::OpList iterator type.


122-122: Updated evaluate method signature to use ast namespace.

The method signature now correctly uses the ast::Expression type, maintaining consistency with the namespace changes.


130-130: Updated evaluate_filter method signature to use ast namespace.

The method signature now correctly uses the ast::FilterExpr type from the new namespace.


138-138: Updated evaluate_wildcard_filter method signature to use ast namespace.

The method signature now correctly uses the ast::FilterExpr type, maintaining consistency with other filter evaluation methods.


148-151: Updated evaluate_int_filter method signature to use ast namespace.

The method signature has been properly updated to use the ast::FilterOperation and ast::Literal types from the new namespace.


160-160: Updated evaluate_int_filter_core static method to use ast namespace.

The method now correctly uses the ast::FilterOperation enum from the new namespace.


169-173: Updated evaluate_float_filter method to use ast namespace.

The method parameters have been properly updated to use the ast::FilterOperation and ast::Literal types.


182-182: Updated evaluate_float_filter_core static method to use ast namespace.

The method now correctly uses the ast::FilterOperation enum from the new namespace.


191-195: Updated evaluate_clp_string_filter method to use ast namespace.

The method parameters have been properly updated to use the ast::FilterOperation type.


204-208: Updated evaluate_var_string_filter method to use ast namespace.

The method parameters have been properly updated to use the ast::FilterOperation type.


217-221: Updated evaluate_epoch_date_filter method to use ast namespace.

The method parameters have been properly updated to use the ast::FilterOperation and ast::Literal types.


231-236: Updated evaluate_array_filter method to use ast namespace.

The method parameters have been properly updated to use the ast::FilterOperation, ast::DescriptorList, and ast::Literal types.


247-253: Updated evaluate_array_filter_value method to use ast namespace.

The method parameters have been properly updated to use the ast::FilterOperation, ast::DescriptorList, and ast::Literal types.


264-270: Updated evaluate_array_filter_array method to use ast namespace.

The method parameters have been properly updated to use the ast::FilterOperation, ast::DescriptorList, and ast::Literal types.


281-287: Updated evaluate_array_filter_object method to use ast namespace.

The method parameters have been properly updated to use the ast::FilterOperation, ast::DescriptorList, and ast::Literal types.


296-300: Updated evaluate_wildcard_array_filter method to use ast namespace.

The method parameters have been properly updated to use the ast::FilterOperation and ast::Literal types.


309-313: Updated array-specific evaluate_wildcard_array_filter overload to use ast namespace.

The method parameters have been properly updated to use the ast::FilterOperation and ast::Literal types.


322-326: Updated object-specific evaluate_wildcard_array_filter overload to use ast namespace.

The method parameters have been properly updated to use the ast::FilterOperation and ast::Literal types.


335-339: Updated evaluate_bool_filter method to use ast namespace.

The method parameters have been properly updated to use the ast::FilterOperation and ast::Literal types.


345-345: Updated populate_string_queries method to use ast namespace.

The method parameter has been properly updated to use the ast::Expression type.


359-360: Updated constant_propagate method to use ast namespace.

The method signature has been properly updated to use the ast::Expression type.


366-366: Updated populate_searched_wildcard_columns method to use ast namespace.

The method parameter has been properly updated to use the ast::Expression type.

components/core/src/clp_s/search/SchemaMatch.hpp (14)

10-14: Updated includes to reference components from the ast namespace.

The includes now correctly reference AST components from their new location in the ast directory, which aligns with the codebase restructuring objective.


17-17: Updated class inheritance to use ast namespace.

The SchemaMatch class now correctly inherits from ast::Transformation instead of just Transformation, maintaining the inheritance relationship after the namespace change.


27-27: Updated run method signature to use ast namespace.

The method signature now correctly uses the ast::Expression type for both return value and parameter.


33-33: Updated get_query_for_schema method signature to use ast namespace.

The method signature now correctly uses the ast::Expression type for the return value.


72-79: Updated member variables to use ast namespace.

All member variables related to column descriptors and expressions have been properly updated to use the appropriate types from the ast namespace.


82-82: Updated schema_to_query map to use ast namespace.

The map now correctly uses ast::Expression as the value type.


94-94: Updated populate_column_mapping method signature to use ast namespace.

The method parameter has been properly updated to use the ast::ColumnDescriptor type.


101-101: Updated overloaded populate_column_mapping method to use ast namespace.

The method parameter has been properly updated to use the ast::ColumnDescriptor type, maintaining consistency with the other overload.


108-108: Updated expression-based populate_column_mapping method to use ast namespace.

Both the parameter and return type have been properly updated to use the ast::Expression type.


120-120: Updated intersect_schemas method to use ast namespace.

Both the parameter and return type have been properly updated to use the ast::Expression type.


130-135: Updated intersect_and_sub_expr method to use ast namespace.

The method parameters have been properly updated to use the ast::Expression and ast::ColumnDescriptor types.


143-146: Updated split_expression_by_schema method to use ast namespace.

The method parameters have been properly updated to use the ast::Expression type consistently.


154-154: Updated get_column_id_for_descriptor method to use ast namespace.

The method parameter has been properly updated to use the ast::ColumnDescriptor type.


161-161: Updated get_literal_type_for_column method to use ast namespace.

The method parameter and return type have been properly updated to use the ast::ColumnDescriptor and ast::LiteralType types respectively.

@wraymo wraymo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for the refactoring. I'm generally fine with the changes. Just two questions:

  1. Since we're moving timestamp patterns into a separate library, do we still want to create TimestampPatternGlobalInstance? What's the benefit of having a separate library here?

  2. Could we document somewhere what ast refers to? I'm not sure if that's clear enough.

return false;
}

bool StringUtils::has_unescaped_wildcards(std::string const& str) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is it because it's related to escaping so we move it to SearchUtils?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It's because it is used by StringLiteral. Moving it into SearchUtils allows the ast library to not depend on Utils.


// Skip decompressing archive if it won't match based on the timestamp
// range index
EvaluateTimestampIndex timestamp_index(m_archive_reader->get_timestamp_dictionary());

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Are we checking the index elsewhere?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yeah, we check it in the main flow before schema matching if you check clp-s.cpp.

I took it out because I thought it was a leftover from when we had sub-archives, but now I'm realizing that the reason we have this duplicated check here is because ambiguous columns can get resolved to the timestamp column after column resolution.

I will add it back.

@gibber9809

Copy link
Copy Markdown
Contributor Author

Thanks for the refactoring. I'm generally fine with the changes. Just two questions:

1. Since we're moving timestamp patterns into a separate library, do we still want to create `TimestampPatternGlobalInstance`? What's the benefit of having a separate library here?

2. Could we document somewhere what `ast` refers to? I'm not sure if that's clear enough.

For 1 I was trying to make it more obvious that users of the ast library should call TimestampPattern::init() and trying to make the dependencies in the build a bit clearer -- i.e. both the ast library and the core clp-s json parsing code depend on TimestampPattern. I can get rid of the clp_s::TimestampPattern library if you don't think pulling it out is useful though?

For 2 I can add a comment in the CMakeLists.txt file to explain a bit about the library.

@gibber9809 gibber9809 requested a review from wraymo March 31, 2025 16:33
@gibber9809

Copy link
Copy Markdown
Contributor Author

Thanks for the refactoring. I'm generally fine with the changes. Just two questions:

1. Since we're moving timestamp patterns into a separate library, do we still want to create `TimestampPatternGlobalInstance`? What's the benefit of having a separate library here?

2. Could we document somewhere what `ast` refers to? I'm not sure if that's clear enough.

For 1 I was trying to make it more obvious that users of the ast library should call TimestampPattern::init() and trying to make the dependencies in the build a bit clearer -- i.e. both the ast library and the core clp-s json parsing code depend on TimestampPattern. I can get rid of the clp_s::TimestampPattern library if you don't think pulling it out is useful though?

For 2 I can add a comment in the CMakeLists.txt file to explain a bit about the library.

I pushed the changes that I described. I can get rid of the TimestampPattern library or not depending on what you decide.

@kirkrodrigues kirkrodrigues changed the title refactor(clp-s): Split up clp-s code to create clp_s::search::ast and clp_s::TimestampPattern library refactor(clp-s): Split up clp-s code to create clp_s::search::ast and clp_s::TimestampPattern libraries. Apr 2, 2025

@kirkrodrigues kirkrodrigues left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Approving changes external to components/core/src/clp_s.

Edited PR title slightly to be grammatically correct and follow our convention of finishing PR titles with a period.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants