Skip to content

[BugFix] Fix ASAN crash for BOOLEAN nested in Avro complex-type columns#76041

Merged
wyb merged 2 commits into
StarRocks:mainfrom
banmoy:fix_11522
Jul 9, 2026
Merged

[BugFix] Fix ASAN crash for BOOLEAN nested in Avro complex-type columns#76041
wyb merged 2 commits into
StarRocks:mainfrom
banmoy:fix_11522

Conversation

@banmoy

@banmoy banmoy commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Why I'm doing:

Fix the daily ASAN crash reported in StarRocks/StarRocksTest#11522:

be/src/gutil/casts.h:78: To down_cast(From*) [with To = FixedLengthColumn<signed char>*; ...]:
Assertion `f == __null || dynamic_cast<To>(f) != __null' failed.

It aborts BE when an Avro routine load targets a native complex-type column (STRUCT/MAP/ARRAY) that contains a BOOLEAN field/element/value.

What I'm doing:

BooleanColumn is FixedLengthColumn<uint8_t>, but the nested (non-adaptive) add_nullable_column in be/src/formats/avro/nullable_column.cpp dispatched TYPE_BOOLEAN through add_nullable_numeric_column<int8_t>. add_numeric_column<int8_t> then down_casts the uint8 column to FixedLengthColumn<int8_t>*, which trips the dynamic_cast assert under ASAN/DEBUG.

The adaptive path (add_adpative_nullable_column, used for top-level columns) already dispatched TYPE_BOOLEAN through the correct <uint8_t> — which is why only complex types crashed and a plain top-level BOOLEAN column was fine. The fix dispatches the nested path through <uint8_t> too. add_numeric_column<uint8_t> is already explicitly instantiated, so no other change is needed.

Added regression test AvroScannerTest.test_struct_with_boolean; the full AvroScannerTest suite (26 tests) passes on a clean ASAN build.

Notes:

Fixes StarRocks/StarRocksTest#11522

What type of PR is this:

  • BugFix
  • Feature
  • Enhancement
  • Refactor
  • UT
  • Doc
  • Tool

Does this PR entail a change in behavior?

  • Yes, this PR will result in a change in behavior.
  • No, this PR will not result in a change in behavior.

Checklist:

  • I have added test cases for my bug fix or my new feature
  • This pr needs user documentation (for new or modified features or behaviors)
    • I have added documentation for my new feature or new function
    • This pr needs auto generate documentation
  • This is a backport pr

Bugfix cherry-pick branch check:

  • I have checked the version labels which the pr will be auto-backported to the target branch
    • 4.1
    • 4.0
    • 3.5

BooleanColumn is FixedLengthColumn<uint8_t>, but the nested (non-adaptive)
add_nullable_column dispatched TYPE_BOOLEAN through
add_nullable_numeric_column<int8_t>. add_numeric_column then down_cast the
uint8 column to FixedLengthColumn<int8_t>*, tripping the dynamic_cast assert
(gutil/casts.h) under ASAN/DEBUG whenever a BOOLEAN is nested inside a native
STRUCT/MAP/ARRAY target column of an Avro routine load (StarRocksTest#11522).

The adaptive path (add_adpative_nullable_column, used for top-level columns)
already dispatched TYPE_BOOLEAN through <uint8_t>, which is why only complex
types crashed. Dispatch the nested path through <uint8_t> as well.

Add regression test AvroScannerTest.test_struct_with_boolean.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GN8hHLLGz7o25mvSJhwqXr
@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

⚠️ coverage incomplete — code_kb context-base tool is unavailable in this session; module risk NOT assessed.


This is not an "all clear" — it's a tooling/access gap. To actually run this review I need the `context-base` MCP server connected (providing `list_collections`/`context_get` for `contextbase="code_kb"`). Can you confirm that MCP server is configured for this environment, or point me to how it's normally invoked here (e.g., a different tool name)?

@CelerData-Reviewer

Copy link
Copy Markdown

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🚀

Reviewed commit: 8bce3df3b9

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@github-actions github-actions Bot requested review from ZiheLiu and gengjun-git July 8, 2026 11:12
…ibility

test_struct_with_boolean depends on native STRUCT target support (PR StarRocks#74901,
main only), so it cannot cherry-pick to release branches that lack it. Replace
it with test_array_with_boolean, which drives the same add_nullable_column
TYPE_BOOLEAN dispatch (the fixed line) and whose ARRAY path is present on all
release branches.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GN8hHLLGz7o25mvSJhwqXr
@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

[Java-Extensions Incremental Coverage Report]

pass : 0 / 0 (0%)

@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

[FE Incremental Coverage Report]

pass : 0 / 0 (0%)

@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

[BE Incremental Coverage Report]

pass : 1 / 1 (100.00%)

file detail

path covered_line new_line coverage not_covered_line_detail
🔵 be/src/formats/avro/nullable_column.cpp 1 1 100.00% []

@wyb wyb merged commit bed4395 into StarRocks:main Jul 9, 2026
65 of 66 checks passed
@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

@Mergifyio backport branch-4.1

@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

@Mergifyio backport branch-4.0

@mergify

mergify Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

backport branch-4.1

✅ Backports have been created

Details

@mergify

mergify Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

backport branch-4.0

✅ Backports have been created

Details

Cherry-pick of bed4395 has failed:

On branch mergify/bp/branch-4.0/pr-76041
Your branch is up to date with 'origin/branch-4.0'.

You are currently cherry-picking commit bed4395814.
  (fix conflicts and run "git cherry-pick --continue")
  (use "git cherry-pick --skip" to skip this patch)
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

Unmerged paths:
  (use "git add <file>..." to mark resolution)
	both modified:   be/src/formats/avro/nullable_column.cpp
	both modified:   be/test/exec/avro_scanner_test.cpp

no changes added to commit (use "git add" and/or "git commit -a")

To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants