Skip to content

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

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

Fix flaky/consistent SystemFunctionsIT.testTypeofArithmetic after int-operand widening#22416
ahkcs wants to merge 7 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 840c4f3)

Here are some key observations to aid the review process:

🧪 PR contains tests
🔒 No security concerns identified
✅ No TODO sections
🔀 Multiple PR themes

Sub-PR theme: Update SystemFunctionsIT.testTypeofArithmetic expected type to BIGINT

Relevant files:

  • sandbox/qa/analytics-engine-rest/src/test/java/org/opensearch/analytics/qa/SystemFunctionsIT.java

Sub-PR theme: Update clickbench plan-shape fixtures for BIGINT widening (Int32 -> Int64)

Relevant files:

  • sandbox/qa/analytics-engine-rest/src/test/resources/planshape/clickbench/q30.plan.yaml
  • sandbox/qa/analytics-engine-rest/src/test/resources/planshape/clickbench/q36.plan.yaml

⚡ Recommended focus areas for review

Empty Test Method

The testTypeofArithmetic method body appears to contain only the assertion, but based on the diff hunk, the method's opening/closing braces surround a single assertFirstRowString call. Verify no other assertions were accidentally dropped compared to the original (the old hunk shows the method previously only had this one assertion, so this looks intentional, but worth double-checking against the file).

public void testTypeofArithmetic() throws IOException {
    assertFirstRowString(oneRow("key00") + "| eval t = typeof(int0 * 2) | fields t", "BIGINT");
}

…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 (d69286a) to head (1afb91b).
⚠️ Report is 4 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main   #22416      +/-   ##
============================================
- Coverage     73.44%   73.43%   -0.02%     
+ Complexity    76488    76424      -64     
============================================
  Files          6104     6104              
  Lines        346576   346578       +2     
  Branches      49885    49886       +1     
============================================
- Hits         254558   254505      -53     
- Misses        71736    71766      +30     
- Partials      20282    20307      +25     

☔ 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

@github-actions

Copy link
Copy Markdown
Contributor

Persistent review updated to latest commit 70642be

@github-actions

Copy link
Copy Markdown
Contributor

❌ Gradle check result for 70642be: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

@github-actions

Copy link
Copy Markdown
Contributor

Persistent review updated to latest commit 1afb91b

@github-actions

Copy link
Copy Markdown
Contributor

✅ Gradle check result for 1afb91b: SUCCESS

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

Copy link
Copy Markdown
Contributor

Persistent review updated to latest commit 84b5c32

@github-actions

Copy link
Copy Markdown
Contributor

Persistent review updated to latest commit 840c4f3

@github-actions

Copy link
Copy Markdown
Contributor

❌ Gradle check result for 840c4f3: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

@ahkcs ahkcs closed this Jul 20, 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