Skip to content

feat(core): Optimize subquery generation by narrowing wildcard token type inference (fixes #1864).#1865

Merged
gibber9809 merged 6 commits into
y-scope:mainfrom
gibber9809:clp-subquery-generation-specificity-fix
Jan 13, 2026
Merged

feat(core): Optimize subquery generation by narrowing wildcard token type inference (fixes #1864).#1865
gibber9809 merged 6 commits into
y-scope:mainfrom
gibber9809:clp-subquery-generation-specificity-fix

Conversation

@gibber9809

@gibber9809 gibber9809 commented Jan 13, 2026

Copy link
Copy Markdown
Contributor

Description

This PR fixes a performance bug described in #1864. The issue is that during subquery generation we treat non-definite variable tokens containing wildcards as any possible type, which can lead to us considering some impossible query interpretations that in turn lead to unnecessary decompression and scan.

The fix is to add some heuristic helpers that try to determine if a wildcard string could possibly correspond to a representable IntVar or FloatVar. We use these helpers to skip these query interpretations when they're definitely impossible.

For the query and dataset provided by @rishikeshdevsot, this change improves single-threaded query performance by about ~250x because decompression and scan is reduced from ~300GB to ~500MB as a result of not pursuing the impossible query interpretations.

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 for helpers that determine whether wildcard strings could correspond to IntVar or FloatVar.
  • Benchmarked performance improvement in example provided by @rishikeshdevsot.

Summary by CodeRabbit

  • New Features

    • Added wildcard validation for determining whether wildcarded strings could represent integers or floats, improving numeric inference during encoding and matching.
  • Bug Fixes

    • Refined type inference for tokens with wildcards so numeric possibilities are only retained when wildcard patterns can validly represent numbers.
  • Tests

    • Added parameterized tests covering a range of integer and float wildcard representability cases.

✏️ 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 13, 2026 16:40
@coderabbitai

coderabbitai Bot commented Jan 13, 2026

Copy link
Copy Markdown
Contributor

Walkthrough

Adds two static validators to EncodedVariableInterpreter to check whether wildcard strings could represent integer or float encoded variables; QueryToken uses them to conditionally add IntVar/FloatVar for non-variable tokens. Tests were added. The implementation file contains duplicated definitions of the new methods.

Changes

Cohort / File(s) Summary
Declarations
components/core/src/clp/EncodedVariableInterpreter.hpp
Adds two public static methods: wildcard_string_could_be_representable_integer_var(std::string_view) and wildcard_string_could_be_representable_float_var(std::string_view).
Implementations (duplicate defs)
components/core/src/clp/EncodedVariableInterpreter.cpp
Implements both validation functions with per-character checks allowing digits, optional leading -, optional single ., and wildcard characters ? and *. Also adds #include <algorithm>. Note: the functions are defined twice in the file (duplicate definitions introduced).
Conditional type logic
components/core/src/clp/QueryToken.cpp
For non-variable tokens, IntVar/FloatVar are now added only when the corresponding wildcard representability checks pass; m_cannot_convert_to_non_dict_var is set/cleared accordingly.
Tests
components/core/tests/test-EncodedVariableInterpreter.cpp
Adds Catch2 GENERATE-based parameterized tests covering positive and negative cases for both wildcard-integer and wildcard-float representability checks; adds generator include.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related issues

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.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 accurately reflects the main objective: optimizing subquery generation by narrowing wildcard token type inference, matching the core changes in the PR.

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

✨ Finishing touches
  • 📝 Generate docstrings

📜 Recent review details

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 804927d and effa11d.

📒 Files selected for processing (2)
  • components/core/src/clp/EncodedVariableInterpreter.cpp
  • components/core/tests/test-EncodedVariableInterpreter.cpp
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{cpp,hpp,java,js,jsx,tpp,ts,tsx}

⚙️ CodeRabbit configuration file

  • Prefer false == <expression> rather than !<expression>.

Files:

  • components/core/tests/test-EncodedVariableInterpreter.cpp
  • components/core/src/clp/EncodedVariableInterpreter.cpp
🧠 Learnings (5)
📚 Learning: 2024-11-01T03:26:26.386Z
Learnt from: LinZhihao-723
Repo: y-scope/clp PR: 570
File: components/core/tests/test-ir_encoding_methods.cpp:376-399
Timestamp: 2024-11-01T03:26:26.386Z
Learning: In the test code (`components/core/tests/test-ir_encoding_methods.cpp`), exception handling for `msgpack::unpack` can be omitted because the Catch2 testing framework captures exceptions if they occur.

Applied to files:

  • components/core/tests/test-EncodedVariableInterpreter.cpp
📚 Learning: 2024-10-13T09:27:43.408Z
Learnt from: LinZhihao-723
Repo: y-scope/clp PR: 557
File: components/core/tests/test-ir_encoding_methods.cpp:1216-1286
Timestamp: 2024-10-13T09:27:43.408Z
Learning: In the unit test case `ffi_ir_stream_serialize_schema_tree_node_id` in `test-ir_encoding_methods.cpp`, suppressing the `readability-function-cognitive-complexity` warning is acceptable due to the expansion of Catch2 macros in C++ tests, and such test cases may not have readability issues.

Applied to files:

  • components/core/tests/test-EncodedVariableInterpreter.cpp
📚 Learning: 2024-11-29T22:50:17.206Z
Learnt from: AVMatthews
Repo: y-scope/clp PR: 595
File: components/core/tests/test-clp_s-end_to_end.cpp:109-110
Timestamp: 2024-11-29T22:50:17.206Z
Learning: In `components/core/tests/test-clp_s-end_to_end.cpp`, the success of `constructor.store()` is verified through `REQUIRE` statements and subsequent comparisons.

Applied to files:

  • components/core/tests/test-EncodedVariableInterpreter.cpp
📚 Learning: 2025-12-09T01:57:04.839Z
Learnt from: SharafMohamed
Repo: y-scope/clp PR: 1313
File: components/core/tests/test-SchemaSearcher.cpp:136-137
Timestamp: 2025-12-09T01:57:04.839Z
Learning: In C++ files under the components directory, keep forward declarations even when a definition follows in the same scope (such as in anonymous namespaces) to maintain consistency across multiple methods. This style reduces churn and aligns with the existing convention in this repository for both source and tests.

Applied to files:

  • components/core/tests/test-EncodedVariableInterpreter.cpp
  • components/core/src/clp/EncodedVariableInterpreter.cpp
📚 Learning: 2025-05-07T16:56:35.687Z
Learnt from: LinZhihao-723
Repo: y-scope/clp PR: 882
File: components/core/src/clp/ffi/ir_stream/search/QueryHandlerImpl.cpp:378-402
Timestamp: 2025-05-07T16:56:35.687Z
Learning: In the CLP search component, the `evaluate_wildcard_filter` function should return `AstEvaluationResult::Pruned` when `node_id_value_pairs` is empty, not `AstEvaluationResult::False`. Empty node sets should be treated as "undetermined" rather than definitive non-matches.

Applied to files:

  • components/core/src/clp/EncodedVariableInterpreter.cpp
🧬 Code graph analysis (2)
components/core/tests/test-EncodedVariableInterpreter.cpp (2)
components/core/src/clp/EncodedVariableInterpreter.hpp (4)
  • value (100-103)
  • value (110-113)
  • value (126-128)
  • value (134-136)
components/core/src/clp/EncodedVariableInterpreter.cpp (4)
  • wildcard_string_could_be_representable_integer_var (200-209)
  • wildcard_string_could_be_representable_integer_var (200-202)
  • wildcard_string_could_be_representable_float_var (211-221)
  • wildcard_string_could_be_representable_float_var (211-213)
components/core/src/clp/EncodedVariableInterpreter.cpp (1)
components/core/src/clp/EncodedVariableInterpreter.hpp (4)
  • value (100-103)
  • value (110-113)
  • value (126-128)
  • value (134-136)
🪛 Cppcheck (2.19.0)
components/core/tests/test-EncodedVariableInterpreter.cpp

[information] 8-8: Include file

(missingIncludeSystem)


[information] 8-8: Include file

(missingIncludeSystem)


[information] 8-8: Include file

(missingIncludeSystem)


[information] 8-8: Include file

(missingIncludeSystem)


[information] 8-8: Include file

(missingIncludeSystem)


[information] 8-8: Include file

(missingIncludeSystem)


[information] 8-8: Include file

(missingIncludeSystem)


[information] 8-8: Include file

(missingIncludeSystem)


[information] 8-8: Include file

(missingIncludeSystem)


[information] 8-8: Include file

(missingIncludeSystem)


[style] 437-437: The function 'decode_message' is never used.

(unusedFunction)

components/core/src/clp/EncodedVariableInterpreter.cpp

[information] 3-3: Include file

(missingIncludeSystem)


[information] 3-3: Include file

(missingIncludeSystem)


[style] 200-200: The function 'wildcard_string_could_be_representable_integer_var' is never used.

(unusedFunction)


[style] 211-211: The function 'wildcard_string_could_be_representable_float_var' is never used.

(unusedFunction)


[style] 203-203: The function 'search_string_matches_all' is never used.

(unusedFunction)


[style] 205-205: The function 'get_sub_queries' is never used.

(unusedFunction)


[style] 207-207: The function 'contains_sub_queries' is never used.

(unusedFunction)


[style] 209-209: The function 'get_relevant_sub_queries' is never used.

(unusedFunction)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (15)
  • GitHub Check: centos-stream-9-static-linked-bins
  • GitHub Check: ubuntu-jammy-lint
  • GitHub Check: centos-stream-9-dynamic-linked-bins
  • GitHub Check: manylinux_2_28-x86_64-static-linked-bins
  • GitHub Check: manylinux_2_28-x86_64-dynamic-linked-bins
  • GitHub Check: musllinux_1_2-x86_64-static-linked-bins
  • GitHub Check: ubuntu-jammy-static-linked-bins
  • GitHub Check: musllinux_1_2-x86_64-dynamic-linked-bins
  • GitHub Check: ubuntu-jammy-dynamic-linked-bins
  • GitHub Check: package-image
  • GitHub Check: build-macos (macos-15, false)
  • GitHub Check: build-macos (macos-15, true)
  • GitHub Check: check-generated
  • GitHub Check: lint-check (ubuntu-24.04)
  • GitHub Check: lint-check (macos-15)
🔇 Additional comments (8)
components/core/src/clp/EncodedVariableInterpreter.cpp (3)

3-3: LGTM!

The <algorithm> include is required for std::ranges::any_of used in the new helper functions below.


200-209: LGTM!

The heuristic correctly identifies patterns that could possibly represent an integer variable by checking that all characters are in the allowed set (digits, -, ?, *). The permissive approach appropriately avoids rejecting patterns where wildcards could expand to valid integer representations.


211-221: LGTM!

Consistent implementation with the integer variant, correctly adding . to the allowed character set for float representation. The heuristic appropriately rejects only patterns that definitely cannot match a float.

components/core/tests/test-EncodedVariableInterpreter.cpp (5)

8-8: LGTM!

Required include for the GENERATE macro used in the parameterized tests below.


388-401: LGTM!

Good coverage of patterns that should be accepted: single wildcards, wildcards with digits, and negative number patterns.


403-420: LGTM!

Comprehensive rejection test cases covering escaped wildcards (backslash not allowed), empty strings, alphabetic characters, unicode, and decimal points (correctly rejected for integer representation).


422-435: LGTM!

Good coverage including the decimal point pattern "*25.987*" which differentiates this from the integer variant.


437-453: LGTM!

Comprehensive rejection tests, notably including scientific notation patterns ("*1.4E09*", "*1.4e09*") which correctly reject due to the E/e characters not being in the allowed set for representable floats.


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.

@gibber9809 gibber9809 changed the title feat(core): Check possible types of non-definite variable tokens containing wildcards during subquery generation (fixes #1846). feat(core): Check possible types of non-definite variable tokens containing wildcards during subquery generation (fixes #1864). Jan 13, 2026
@LinZhihao-723 LinZhihao-723 self-requested a review January 13, 2026 17:18

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

overall lgtm.
We should also mark #457 as resolved.

Comment thread components/core/src/clp/EncodedVariableInterpreter.hpp Outdated
Comment thread components/core/src/clp/EncodedVariableInterpreter.hpp Outdated
Comment thread components/core/src/clp/EncodedVariableInterpreter.cpp Outdated
Comment thread components/core/src/clp/EncodedVariableInterpreter.cpp Outdated
Co-authored-by: Lin Zhihao <59785146+LinZhihao-723@users.noreply.github.com>

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.

Sorry for missing this, we should also include <algorithm>

@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: 2

🤖 Fix all issues with AI agents
In @components/core/src/clp/EncodedVariableInterpreter.cpp:
- Around line 207-214: The function
EncodedVariableInterpreter::wildcard_string_could_be_representable_float_var
currently treats an empty string as matching; add an explicit check at the start
of the function to return false if value.empty(), then keep the existing any_of
predicate unchanged so empty wildcard strings are rejected just like the integer
variant.
- Around line 199-205: The function
wildcard_string_could_be_representable_integer_var currently returns true for
empty strings due to any_of on an empty range; change it to explicitly return
false for empty input by adding an early check (if value.empty() return false)
at the top of
EncodedVariableInterpreter::wildcard_string_could_be_representable_integer_var
so its behavior matches convert_string_to_representable_integer_var's handling
of empty strings and prevents empty wildcard strings from being treated as
representable integer vars.
📜 Review details

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 66dc0fc and 2094653.

📒 Files selected for processing (2)
  • components/core/src/clp/EncodedVariableInterpreter.cpp
  • components/core/src/clp/EncodedVariableInterpreter.hpp
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{cpp,hpp,java,js,jsx,tpp,ts,tsx}

⚙️ CodeRabbit configuration file

  • Prefer false == <expression> rather than !<expression>.

Files:

  • components/core/src/clp/EncodedVariableInterpreter.cpp
  • components/core/src/clp/EncodedVariableInterpreter.hpp
🧠 Learnings (1)
📚 Learning: 2025-12-09T01:57:04.839Z
Learnt from: SharafMohamed
Repo: y-scope/clp PR: 1313
File: components/core/tests/test-SchemaSearcher.cpp:136-137
Timestamp: 2025-12-09T01:57:04.839Z
Learning: In C++ files under the components directory, keep forward declarations even when a definition follows in the same scope (such as in anonymous namespaces) to maintain consistency across multiple methods. This style reduces churn and aligns with the existing convention in this repository for both source and tests.

Applied to files:

  • components/core/src/clp/EncodedVariableInterpreter.cpp
🧬 Code graph analysis (1)
components/core/src/clp/EncodedVariableInterpreter.cpp (1)
components/core/src/clp/EncodedVariableInterpreter.hpp (4)
  • value (100-103)
  • value (110-113)
  • value (126-128)
  • value (134-136)
🪛 Cppcheck (2.19.0)
components/core/src/clp/EncodedVariableInterpreter.cpp

[style] 199-199: The function 'wildcard_string_could_be_representable_integer_var' is never used.

(unusedFunction)


[style] 207-207: The function 'wildcard_string_could_be_representable_float_var' is never used.

(unusedFunction)


[style] 203-203: The function 'search_string_matches_all' is never used.

(unusedFunction)


[style] 205-205: The function 'get_sub_queries' is never used.

(unusedFunction)


[style] 207-207: The function 'contains_sub_queries' is never used.

(unusedFunction)


[style] 209-209: The function 'get_relevant_sub_queries' is never used.

(unusedFunction)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (15)
  • GitHub Check: ubuntu-jammy-static-linked-bins
  • GitHub Check: manylinux_2_28-x86_64-dynamic-linked-bins
  • GitHub Check: package-image
  • GitHub Check: ubuntu-jammy-dynamic-linked-bins
  • GitHub Check: musllinux_1_2-x86_64-static-linked-bins
  • GitHub Check: manylinux_2_28-x86_64-static-linked-bins
  • GitHub Check: ubuntu-jammy-lint
  • GitHub Check: centos-stream-9-dynamic-linked-bins
  • GitHub Check: musllinux_1_2-x86_64-dynamic-linked-bins
  • GitHub Check: centos-stream-9-static-linked-bins
  • GitHub Check: lint-check (ubuntu-24.04)
  • GitHub Check: build-macos (macos-15, true)
  • GitHub Check: lint-check (macos-15)
  • GitHub Check: build-macos (macos-15, false)
  • GitHub Check: check-generated
🔇 Additional comments (1)
components/core/src/clp/EncodedVariableInterpreter.hpp (1)

121-137: LGTM!

The declarations are well-formed with appropriate [[nodiscard]] attributes. The documentation clearly indicates the heuristic nature of these methods.

@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: 2

🤖 Fix all issues with AI agents
In @components/core/src/clp/EncodedVariableInterpreter.cpp:
- Around line 200-206: The function
wildcard_string_could_be_representable_integer_var currently returns true for
empty input because std::ranges::any_of on an empty range yields false; change
it to explicitly return false when value.empty() and replace the double-negation
any_of pattern with std::ranges::all_of for clarity (i.e., ensure every
character satisfies ('0' <= c && c <= '9') || c == '-' || c == '?' || c == '*').
Keep the function name intact and ensure behavior matches
convert_string_to_representable_integer_var for the empty-string case.
- Around line 208-215: The function
wildcard_string_could_be_representable_float_var has the same empty-string edge
case and confusing double negations; update it to explicitly return false for an
empty value and simplify the predicate by using positive logic (e.g.,
std::ranges::all_of) so it returns true only when value is non-empty and every
character is one of '0'-'9', '-', '.', '?' or '*'; modify the body of
EncodedVariableInterpreter::wildcard_string_could_be_representable_float_var to
check value.empty() first, then return the all_of result.
📜 Review details

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2094653 and 804927d.

📒 Files selected for processing (1)
  • components/core/src/clp/EncodedVariableInterpreter.cpp
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{cpp,hpp,java,js,jsx,tpp,ts,tsx}

⚙️ CodeRabbit configuration file

  • Prefer false == <expression> rather than !<expression>.

Files:

  • components/core/src/clp/EncodedVariableInterpreter.cpp
🧠 Learnings (2)
📚 Learning: 2025-05-07T16:56:35.687Z
Learnt from: LinZhihao-723
Repo: y-scope/clp PR: 882
File: components/core/src/clp/ffi/ir_stream/search/QueryHandlerImpl.cpp:378-402
Timestamp: 2025-05-07T16:56:35.687Z
Learning: In the CLP search component, the `evaluate_wildcard_filter` function should return `AstEvaluationResult::Pruned` when `node_id_value_pairs` is empty, not `AstEvaluationResult::False`. Empty node sets should be treated as "undetermined" rather than definitive non-matches.

Applied to files:

  • components/core/src/clp/EncodedVariableInterpreter.cpp
📚 Learning: 2025-12-09T01:57:04.839Z
Learnt from: SharafMohamed
Repo: y-scope/clp PR: 1313
File: components/core/tests/test-SchemaSearcher.cpp:136-137
Timestamp: 2025-12-09T01:57:04.839Z
Learning: In C++ files under the components directory, keep forward declarations even when a definition follows in the same scope (such as in anonymous namespaces) to maintain consistency across multiple methods. This style reduces churn and aligns with the existing convention in this repository for both source and tests.

Applied to files:

  • components/core/src/clp/EncodedVariableInterpreter.cpp
🪛 Cppcheck (2.19.0)
components/core/src/clp/EncodedVariableInterpreter.cpp

[information] 3-3: Include file

(missingIncludeSystem)


[information] 3-3: Include file

(missingIncludeSystem)


[style] 200-200: The function 'wildcard_string_could_be_representable_integer_var' is never used.

(unusedFunction)


[style] 208-208: The function 'wildcard_string_could_be_representable_float_var' is never used.

(unusedFunction)


[style] 203-203: The function 'search_string_matches_all' is never used.

(unusedFunction)


[style] 205-205: The function 'get_sub_queries' is never used.

(unusedFunction)


[style] 207-207: The function 'contains_sub_queries' is never used.

(unusedFunction)


[style] 209-209: The function 'get_relevant_sub_queries' is never used.

(unusedFunction)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (16)
  • GitHub Check: build-macos (macos-15, true)
  • GitHub Check: build-macos (macos-15, false)
  • GitHub Check: musllinux_1_2-x86_64-static-linked-bins
  • GitHub Check: ubuntu-jammy-static-linked-bins
  • GitHub Check: musllinux_1_2-x86_64-dynamic-linked-bins
  • GitHub Check: manylinux_2_28-x86_64-static-linked-bins
  • GitHub Check: package-image
  • GitHub Check: ubuntu-jammy-dynamic-linked-bins
  • GitHub Check: ubuntu-jammy-lint
  • GitHub Check: manylinux_2_28-x86_64-dynamic-linked-bins
  • GitHub Check: centos-stream-9-static-linked-bins
  • GitHub Check: centos-stream-9-dynamic-linked-bins
  • GitHub Check: check-generated
  • GitHub Check: build (macos-15)
  • GitHub Check: lint-check (macos-15)
  • GitHub Check: lint-check (ubuntu-24.04)
🔇 Additional comments (1)
components/core/src/clp/EncodedVariableInterpreter.cpp (1)

3-3: LGTM!

The <algorithm> header is correctly added for std::ranges::any_of usage in the new helper functions.

Comment thread components/core/src/clp/EncodedVariableInterpreter.cpp
Comment on lines +208 to +215
auto EncodedVariableInterpreter::wildcard_string_could_be_representable_float_var(
std::string_view value
) -> bool {
return false == std::ranges::any_of(value, [](char const c) -> bool {
return false
== (('0' <= c && c <= '9') || c == '-' || c == '.' || c == '?' || c == '*');
});
}

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.

⚠️ Potential issue | 🟡 Minor

Same empty string edge case as the integer variant.

This function has the same empty string edge case and double negation complexity as the integer version. Consider the same refactoring approach for consistency.

Suggested refactor
 auto EncodedVariableInterpreter::wildcard_string_could_be_representable_float_var(
         std::string_view value
 ) -> bool {
-    return false == std::ranges::any_of(value, [](char const c) -> bool {
-               return false
-                      == (('0' <= c && c <= '9') || c == '-' || c == '.' || c == '?' || c == '*');
-           });
+    if (value.empty()) {
+        return false;
+    }
+    return std::ranges::all_of(value, [](char const c) -> bool {
+        return ('0' <= c && c <= '9') || c == '-' || c == '.' || c == '?' || c == '*';
+    });
 }
🧰 Tools
🪛 Cppcheck (2.19.0)

[style] 208-208: The function 'wildcard_string_could_be_representable_float_var' is never used.

(unusedFunction)


[style] 209-209: The function 'get_relevant_sub_queries' is never used.

(unusedFunction)

🤖 Prompt for AI Agents
In @components/core/src/clp/EncodedVariableInterpreter.cpp around lines 208 -
215, The function wildcard_string_could_be_representable_float_var has the same
empty-string edge case and confusing double negations; update it to explicitly
return false for an empty value and simplify the predicate by using positive
logic (e.g., std::ranges::all_of) so it returns true only when value is
non-empty and every character is one of '0'-'9', '-', '.', '?' or '*'; modify
the body of
EncodedVariableInterpreter::wildcard_string_could_be_representable_float_var to
check value.empty() first, then return the all_of result.

Comment thread components/core/src/clp/EncodedVariableInterpreter.cpp

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

For the PR title, how about:

feat(core): Optimize subquery generation by narrowing wildcard type inference (fixes #1864).

@gibber9809

Copy link
Copy Markdown
Contributor Author

For the PR title, how about:

feat(core): Optimize subquery generation by narrowing wildcard type inference (fixes #1864).

Going to use "wildcard token type inference" as a slight edit.

@gibber9809 gibber9809 changed the title feat(core): Check possible types of non-definite variable tokens containing wildcards during subquery generation (fixes #1864). feat(core): Optimize subquery generation by narrowing wildcard token type inference (fixes #1864). Jan 13, 2026
@gibber9809 gibber9809 merged commit 0937dbe into y-scope:main Jan 13, 2026
27 checks passed
davidlion pushed a commit to davidlion/clp that referenced this pull request Jan 17, 2026
…type inference (fixes y-scope#1864). (y-scope#1865)

Co-authored-by: Lin Zhihao <59785146+LinZhihao-723@users.noreply.github.com>
junhaoliao pushed a commit to junhaoliao/clp that referenced this pull request May 17, 2026
…type inference (fixes y-scope#1864). (y-scope#1865)

Co-authored-by: Lin Zhihao <59785146+LinZhihao-723@users.noreply.github.com>
junhaoliao pushed a commit to junhaoliao/clp that referenced this pull request May 17, 2026
…type inference (fixes y-scope#1864). (y-scope#1865)

Co-authored-by: Lin Zhihao <59785146+LinZhihao-723@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants