Skip to content

Fix flaky/consistent SystemFunctionsIT.testTypeofArithmetic after int-operand widening#22416

Open
ahkcs wants to merge 3 commits into
opensearch-project:mainfrom
ahkcs:fix/typeof-arithmetic-bigint-it
Open

Fix flaky/consistent SystemFunctionsIT.testTypeofArithmetic after int-operand widening#22416
ahkcs wants to merge 3 commits into
opensearch-project:mainfrom
ahkcs:fix/typeof-arithmetic-bigint-it

Conversation

@ahkcs

@ahkcs ahkcs commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Description

SystemFunctionsIT.testTypeofArithmetic has been failing consistently on main:

Value mismatch for query: source=calcs | where key='key00' | head 1 | eval t = typeof(int0 * 2) | fields t
expected:<[]INT> but was:<[BIG]INT>

This is an expected behavior change, not a regression. opensearch-project/sql#5603 widens narrow integer operands (byte/short/int) before +, -, * so the result cannot overflow the inferred type. As a result, int0 * 2 now infers as BIGINT instead of INT, and typeof(int0 * 2) correctly returns "BIGINT". The QA assertion was written against the old (overflow-prone) INT inference and needs to reflect the new, correct type.

Change

Update the typeof(int0 * 2) assertion (and its comment) to expect "BIGINT". Test-only; no production code change.

Testing

  • ./gradlew ':sandbox:qa:analytics-engine-rest:integTest' --tests 'org.opensearch.analytics.qa.SystemFunctionsIT.testTypeofArithmetic' (sandbox, JDK 25).

Check List

  • Commits are signed per the DCO using --signoff.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

opensearch-project/sql#5603 widens narrow integer operands (byte/short/int)
before +, -, * so the result cannot overflow the inferred type, which makes
`int0 * 2` infer as BIGINT instead of INT. Update the typeof assertion (and its
comment) to expect "BIGINT", matching the merged SQL behavior. This IT has been
failing consistently on main since that grammar/lowering change landed.

Test-only change.

Signed-off-by: Kai Huang <ahkcs@amazon.com>
@ahkcs ahkcs requested a review from a team as a code owner July 8, 2026 18:12
@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

PR Reviewer Guide 🔍

(Review updated until commit 6de4aac)

Here are some key observations to aid the review process:

🧪 PR contains tests
🔒 No security concerns identified
✅ No TODO sections
🔀 No multiple PR themes
⚡ No major issues detected

…rch.org mirror; unrelated to this test-only change)

Signed-off-by: Kai Huang <ahkcs@amazon.com>
@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Persistent review updated to latest commit ae725ab

@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

✅ Gradle check result for ae725ab: SUCCESS

@codecov

codecov Bot commented Jul 8, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 73.43%. Comparing base (dbad8f5) to head (6de4aac).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main   #22416      +/-   ##
============================================
- Coverage     73.50%   73.43%   -0.07%     
+ Complexity    76487    76463      -24     
============================================
  Files          6104     6104              
  Lines        346567   346567              
  Branches      49883    49883              
============================================
- Hits         254733   254515     -218     
- Misses        71550    71800     +250     
+ Partials      20284    20252      -32     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@github-actions

Copy link
Copy Markdown
Contributor

Persistent review updated to latest commit 6de4aac

@github-actions

Copy link
Copy Markdown
Contributor

✅ Gradle check result for 6de4aac: SUCCESS

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