Skip to content

feat(kv-ir)!: Add support for matching KQL timestamp literals against integer and float values.#1848

Merged
gibber9809 merged 4 commits into
y-scope:mainfrom
gibber9809:ir-timestamp-literal-search
Jan 8, 2026
Merged

feat(kv-ir)!: Add support for matching KQL timestamp literals against integer and float values.#1848
gibber9809 merged 4 commits into
y-scope:mainfrom
gibber9809:ir-timestamp-literal-search

Conversation

@gibber9809

@gibber9809 gibber9809 commented Jan 7, 2026

Copy link
Copy Markdown
Contributor

Description

This PR updates the mapping between kv-ir stream schema tree nodes and literal types in order to allow timestamp literals to match floats, integers, and nothing else.

In practice for the current way ASTs are generated from KQL and refined this was already possible (since timestamp literals can be converted to integer and float literals), but this PR makes the mapping more explicit and adds tests.

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

  • Added tests to ensure that timestamp literals work as expected for column resolution and search.
  • Manually validated that timestamps in kv-ir streams can be searched as expected using timestamp literals in the clp-s cli.

Summary by CodeRabbit

Release Notes

  • Tests

    • Enhanced timestamp expression support in search query validation.
    • Extended test coverage for timestamp literal handling with various filter operations.
  • Internal Updates

    • Refined type mapping for timestamp handling in search utilities.

✏️ Tip: You can customize this high-level summary in your review settings.

@gibber9809 gibber9809 requested a review from a team as a code owner January 7, 2026 21:10
@coderabbitai

coderabbitai Bot commented Jan 7, 2026

Copy link
Copy Markdown
Contributor

Walkthrough

These changes extend timestamp literal support in search functionality tests and utilities. Modifications include adding timestamp-formatted KQL expressions to test cases, introducing TimestampLiteral test operands with filter operations, and updating type mappings to include TimestampT in numeric literal types.

Changes

Cohort / File(s) Summary
Test Query Handler Expressions
components/core/src/clp/ffi/ir_stream/search/test/test_QueryHandlerImpl.cpp
Adds timestamp-formatted KQL expressions (<column>: timestamp("<value>")) to matchable expressions for both Int and Float node test cases, expanding the set of testable filter representations.
Test Utilities & Operands
components/core/src/clp/ffi/ir_stream/search/test/test_utils.cpp
Introduces TimestampLiteral test operand support with includes, using declarations, and extends filter operation test coverage (EQ, NEQ, LT, LTE, GT, GTE) for timestamp scenarios alongside existing literal types. Updates test matrices to map timestamp evaluations to appropriate literal types (IntegerT, FloatT).
Type Mapping Utility
components/core/src/clp/ffi/ir_stream/search/utils.cpp
Updates schema_tree_node_type_to_literal_types function to include TimestampT in numeric type handling: adds TimestampT to IntegerT for Int nodes and to FloatT for Float nodes; removes TimestampT from Str case.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and accurately describes the main change: adding support for matching KQL timestamp literals against integer and float values, which aligns with the PR's core modifications across all three modified files.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@LinZhihao-723 LinZhihao-723 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.

The code changes lgtm. My only concern is that this implementation will no longer allow comparing timestamp literal against an unparsed string representation. We should probably create an issue to keep track of this.
For the PR title, how about:

feat(kv-ir)!: Add support for matching KQL timestamp literals against integer and float values.

I feel like we should mark this as a breaking change since it changes the search behavior.

@gibber9809

Copy link
Copy Markdown
Contributor Author

The code changes lgtm. My only concern is that this implementation will no longer allow comparing timestamp literal against an unparsed string representation. We should probably create an issue to keep track of this. For the PR title, how about:

feat(kv-ir)!: Add support for matching KQL timestamp literals against integer and float values.

I feel like we should mark this as a breaking change since it changes the search behavior.

Makes sense. Yeah I figured it was better to just drop the string comparison support for now until we have time to do it properly -- created #1851 to track.

@gibber9809 gibber9809 changed the title feat(kv-ir): Allow timestamp literals to match integer and float columns during search. feat(kv-ir)!: Add support for matching KQL timestamp literals against integer and float values. Jan 8, 2026
@gibber9809 gibber9809 merged commit 19bb18f into y-scope:main Jan 8, 2026
26 checks passed
davidlion pushed a commit to davidlion/clp that referenced this pull request Jan 17, 2026
junhaoliao pushed a commit to junhaoliao/clp that referenced this pull request May 17, 2026
junhaoliao pushed a commit to junhaoliao/clp that referenced this pull request May 17, 2026
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.

2 participants