clp icon indicating copy to clipboard operation
clp copied to clipboard

clp-s: Add boilerplate for new sql parser

Open gibber9809 opened this issue 1 year ago • 2 comments

Description

This PR adds boilerplate for the new sql parser. This includes a stubbed out g4 grammar and visitor, as well as a basic unit test that tells us that the whole thing compiles and runs.

Validation performed

  • validated that unit test linking against sql parser library builds and runs successfully

Summary by CodeRabbit

  • New Features

    • Introduced SQL parsing capabilities with a new SQL parser and grammar.
    • Added a LogSuppressor class to manage logging during tests.
    • Implemented unit tests for SQL parsing functionality, including handling edge cases.
  • Bug Fixes

    • Enhanced error handling in SQL parsing to ensure proper logging and feedback.

gibber9809 avatar Jul 31 '24 19:07 gibber9809

@LinZhihao-723 fixed clang-tidy warnings. Re-review?

gibber9809 avatar Sep 16 '24 17:09 gibber9809

Walkthrough

The changes introduce a new SQL parsing feature into the project, which includes the addition of a SQL grammar definition and an implementation of a SQL expression parser. A new error listener class is created for error handling during parsing. Unit tests for the SQL parser are also added to ensure its functionality. The modifications to CMake configuration files accommodate the new SQL components, and updates to existing files integrate the new functionality.

Changes

File(s) Change Summary
components/core/CMakeLists.txt, components/core/src/clp_s/CMakeLists.txt Added new test file tests/test-sql.cpp and linked the sql library. Included SQL search subdirectory.
components/core/src/clp_s/search/antlr_common/ErrorListener.hpp Introduced ErrorListener class for handling syntax errors during parsing.
components/core/src/clp_s/search/kql/CMakeLists.txt, components/core/src/clp_s/search/kql/kql.cpp Added header file for ErrorListener and updated linked library from Boost::filesystem. Removed custom ErrorListener class.
components/core/src/clp_s/search/sql/CMakeLists.txt, components/core/src/clp_s/search/sql/Sql.g4, components/core/src/clp_s/search/sql/sql.cpp, components/core/src/clp_s/search/sql/sql.hpp Added SQL grammar file, implemented SQL parser, and declared parsing function in the header file.
components/core/tests/test-sql.cpp Introduced unit tests for SQL parsing functionality using the Catch2 framework.
components/core/tests/LogSuppressor.hpp Added LogSuppressor class to suppress logging during tests.

Possibly related PRs

  • #450: This PR modifies the CMakeLists.txt files to remove the boost::iostream dependency, which is relevant as the main PR also involves changes to CMakeLists.txt for linking the sql library and adding a new test file.
  • #560: This PR enhances the KQL parsing functionality, which is indirectly related to the SQL testing introduced in the main PR, as both involve parsing and handling expressions in their respective contexts.

Suggested reviewers

  • kirkrodrigues

📜 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 866dcfcd1757aeb81740dd271c6055170c97d30f and b0e1a7cdb375bc2012dad67a53d1509b037a391a.

📒 Files selected for processing (6)
  • components/core/CMakeLists.txt (2 hunks)
  • components/core/src/clp_s/CMakeLists.txt (1 hunks)
  • components/core/src/clp_s/search/kql/CMakeLists.txt (1 hunks)
  • components/core/src/clp_s/search/kql/kql.cpp (3 hunks)
  • components/core/src/clp_s/search/sql/CMakeLists.txt (1 hunks)
  • components/core/src/clp_s/search/sql/sql.cpp (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (6)
  • components/core/src/clp_s/CMakeLists.txt
  • components/core/src/clp_s/search/kql/kql.cpp
  • components/core/CMakeLists.txt
  • components/core/src/clp_s/search/sql/CMakeLists.txt
  • components/core/src/clp_s/search/kql/CMakeLists.txt
  • components/core/src/clp_s/search/sql/sql.cpp
⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: build-macos (macos-14, false)
  • GitHub Check: build-macos (macos-14, true)
  • GitHub Check: build-macos (macos-13, false)
  • GitHub Check: build-macos (macos-13, true)

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 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. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @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[bot] avatar Sep 25 '24 16:09 coderabbitai[bot]

Can we merge main? The latest workflow failure should be resolved by #578.

kirkrodrigues avatar Nov 13 '24 12:11 kirkrodrigues