Skip to content

Fix: LAL compiler treated (tag("x") as Integer) + (tag("y") as Integer) as string concatenation instead of numeric addition.#13857

Merged
wankai123 merged 2 commits intoapache:masterfrom
wankai123:lal-plus
Apr 30, 2026
Merged

Fix: LAL compiler treated (tag("x") as Integer) + (tag("y") as Integer) as string concatenation instead of numeric addition.#13857
wankai123 merged 2 commits intoapache:masterfrom
wankai123:lal-plus

Conversation

@wankai123
Copy link
Copy Markdown
Member

  • Add a unit test to verify that the fix works.

  • Explain briefly why the bug exists and how to fix it.

  • If this pull request closes/resolves/fixes an existing issue, replace the issue number. Closes #.

  • Update the CHANGES log.

…er)` as string concatenation instead of numeric addition.
@wankai123 wankai123 added this to the 10.5.0 milestone Apr 30, 2026
@wankai123 wankai123 requested review from Copilot and wu-sheng April 30, 2026 09:06
@wankai123 wankai123 added the bug Something isn't working and you are sure it's a bug! label Apr 30, 2026
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes LAL (Log Analysis Language) code generation so that + between numerically cast operands (e.g., (tag("x") as Integer) + (tag("y") as Integer)) is emitted as numeric addition rather than forced string concatenation, ensuring numeric comparisons in conditions behave correctly.

Changes:

  • Update LAL value codegen to detect all-numeric + operand lists and emit long arithmetic (with boxing for non-comparison contexts).
  • Add unit tests covering integer/long arithmetic sums in conditions and ensuring uncast + remains string concatenation.
  • Add a changelog entry describing the fix and its impact.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
oap-server/analyzer/log-analyzer/src/main/java/.../LALValueCodegen.java Detects numeric + operands and generates long arithmetic instead of "" + ... concatenation.
oap-server/analyzer/log-analyzer/src/test/java/.../LALClassGeneratorConditionTest.java Adds tests validating arithmetic-vs-concat codegen output in relevant DSL patterns.
docs/en/changes/changes.md Documents the bug fix in the changelog.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@wu-sheng wu-sheng added the backend OAP backend related. label Apr 30, 2026
wu-sheng
wu-sheng previously approved these changes Apr 30, 2026
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@wankai123 wankai123 merged commit dae1553 into apache:master Apr 30, 2026
434 of 437 checks passed
@wankai123 wankai123 deleted the lal-plus branch April 30, 2026 11:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend OAP backend related. bug Something isn't working and you are sure it's a bug!

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants