Skip to content

[fix](expr) Backport constant expression result normalization to 4.2 - #70431

Open
Mryange wants to merge 2 commits into
apache:branch-4.2from
Mryange:backport-69679-branch-4.2
Open

Mryange wants to merge 2 commits into
apache:branch-4.2from
Mryange:backport-69679-branch-4.2

Conversation

@Mryange

@Mryange Mryange commented Nov 10, 2026

Copy link
Copy Markdown
Contributor

What problem does this PR solve?

Issue Number: None

Related PR: #69679

Problem Summary:

Backport #69679 to branch-4.2. Constant expressions such as COALESCE can return ordinary single-row columns, while scan predicate processing assumes ColumnConst and fails a checked cast. Normalize cached results with ConstantExprResult and migrate scan, scalar-function and ANN consumers, preserving NULL handling and constant broadcasting.

Adapt regexp consumers and scan tests to the 4.2 interfaces without importing unrelated master features.

Release note

Fix query errors when scan predicates use constant expressions that return ordinary single-row columns.

Check List (For Author)

  • Test

    • Unit Test: ASAN BE build passed; 197 targeted tests across 13 suites ran, 196 passed and the existing MathFunctionTest.random_test was skipped. Coverage includes constant ownership/broadcasting, NULL scan predicates, LIKE, scalar constant arguments and ANN.
    • clang-format 16 and whitespace checks passed.
    • clang-tidy scanned 28 changed translation units; the existing unmatched NOLINTEND in core/types.h prevents a clean pass. No additional diagnostics on changed lines.
    • Validation used the automation prebuilt third-party package with verified SHA256 and checked Paimon C API compatibility; Paimon/snappy/librdkafka versions differ from the branch defaults. Connector runtime and SQL regression tests were not run.
  • Behavior changed:

    • Yes. Scan consumers accept ordinary single-row constant results.
  • Does this need documentation?

    • No.

Check List (For Reviewer who merge this PR)

  • Confirm the release note
  • Confirm test cases
  • Confirm document
  • Add branch pick label

### What problem does this PR solve?

Issue Number: None

Related PR: apache#69679

Problem Summary:

Constant expressions can return ordinary single-row columns, but scan predicate
processing assumes ColumnConst and fails a checked cast. Backport apache#69679 to
normalize cached results with ConstantExprResult and migrate scan, scalar-function
and ANN consumers. Preserve NULL handling and constant broadcasting.

Adapt regexp consumers and scan tests to the 4.2 interfaces. Exclude tests for
features absent from this branch.

### Release note

Fix query errors when scan predicates use constant expressions that return ordinary
single-row columns, including COALESCE and IFNULL.

### Check List (For Author)

- Test: Unit tests ported and adapted; not executed. Builds and runtime validation
  await user review as required by the development-machine instructions.
  clang-format 16, check-format.sh and git diff --cached --check passed.
- Behavior changed: Yes. Scan consumers accept ordinary single-row constants and
  preserve NULL semantics.
- Does this need documentation: No.

### Check List (For Reviewer who merge this PR)

- [ ] Confirm the release note
- [ ] Confirm test cases
- [ ] Confirm document
- [ ] Add branch pick label

(cherry picked from commit 5b2c066)
### What problem does this PR solve?

Issue Number: None

Related PR: apache#69679

Problem Summary:

The backported scan tests used the master function-filter API and omitted nullable tuple metadata required by branch-4.2. Use the branch's three-argument API, inspect its pushdown function list, and initialize the tuple nullability so the new tests compile and execute.

### Release note

None

### Check List (For Author)

- Test
    - [x] Unit Test

- Behavior changed:
    - [x] No.

- Does this need documentation?
    - [x] No.

### Testing

ASAN BE build passed. Targeted ASAN BE unit tests: 197 tests from 13 suites, 196 passed and 1 pre-existing MathFunctionTest.random_test skipped. clang-format 16 and git diff --check passed. Validation used the automation prebuilt third-party package after checking required C API compatibility; this is not connector runtime validation.

### Check List (For Reviewer who merge this PR)

- [ ] Confirm the release note
- [ ] Confirm test cases
- [ ] Confirm document
- [ ] Add branch pick label
@Mryange
Mryange requested a review from yiguolei as a code owner November 10, 2026 07:32
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.

1 participant