Closed gibber9809 closed 5 days ago
The changes across multiple files enhance error handling and validation processes in the parsing and processing of JSON and KQL data. Key modifications include improved error logging and exception handling in the JsonParser
and TimestampDictionaryReader
. The tokenize_column_descriptor
method's return type was changed to bool
in Utils
, allowing for better error feedback. Additionally, the KQL grammar was updated to recognize periods as special characters, and new tests were added to validate parsing with escape sequences. Overall, the changes focus on robustness and error management.
File Path | Change Summary |
---|---|
components/core/src/clp_s/JsonParser.cpp |
Enhanced error handling in constructor and parse method; added logging and exception handling. |
components/core/src/clp_s/TimestampDictionaryReader.cpp |
Added error handling in read_new_entries method for tokenization failures. |
components/core/src/clp_s/Utils.cpp |
Changed return type of tokenize_column_descriptor from void to bool and improved functionality. |
components/core/src/clp_s/Utils.hpp |
Updated tokenize_column_descriptor method signature to return bool with [[nodiscard]] attribute. |
components/core/src/clp_s/clp-s.cpp |
Improved error handling in search_archive function; checks tokenization result and logs errors. |
components/core/src/clp_s/search/kql/Kql.g4 |
Modified SPECIAL_CHARACTER fragment to include a period (. ) as a valid character. |
components/core/src/clp_s/search/kql/kql.cpp |
Enhanced error handling in visitColumn and parse_kql_expression methods; added exception handling. |
components/core/tests/test-kql.cpp |
Added new test cases for handling escape sequences in column names in KQL parsing. |
sequenceDiagram
participant User
participant KQLParser
participant StringUtils
participant Logger
User->>KQLParser: Parse KQL Expression
KQLParser->>StringUtils: tokenize_column_descriptor(column)
alt Tokenization Success
StringUtils-->>KQLParser: Tokens
KQLParser->>User: Return Parsed Expression
else Tokenization Failure
StringUtils-->>KQLParser: false
KQLParser->>Logger: Log Error
KQLParser-->>User: Return nullptr
end
JsonParser.cpp
, particularly in how errors are logged and managed during parsing processes.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?
Description
This PR adds support for using backslash to escape characters in KQL key names. The change is mostly contained in the
StringUtiles::tokenize_column_descriptor
function, but does involve a small change to the kql.g4 grammar to allow the '.' character to be escaped.For example the key consisting of the tokens {"com.bnn", "uuid"} can now be specified as "com\.bnn.uuid" in KQL.
This PR also adds error handling for invalid KQL key names. Invalid key names currently include keys ending ending in a trailing unescaped '\' or '.'.
Validation performed
Summary by CodeRabbit
Summary by CodeRabbit
New Features
Bug Fixes
Tests