Skip to content

[fix][cp] fix: Make BaseVector::flattenVector unwrap lazy vectors#449

Open
WangGuangxin wants to merge 1 commit into
bytedance:mainfrom
WangGuangxin:cp_14491
Open

[fix][cp] fix: Make BaseVector::flattenVector unwrap lazy vectors#449
WangGuangxin wants to merge 1 commit into
bytedance:mainfrom
WangGuangxin:cp_14491

Conversation

@WangGuangxin
Copy link
Copy Markdown
Collaborator

@WangGuangxin WangGuangxin commented Mar 30, 2026

What problem does this PR solve?

Issue Number: close #191

Type of Change

  • 🐛 Bug fix (non-breaking change which fixes an issue)
  • ✨ New feature (non-breaking change which adds functionality)
  • 🚀 Performance improvement (optimization)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)
  • 🔨 Refactoring (no logic changes)
  • 🔧 Build/CI or Infrastructure changes
  • 📝 Documentation only

Description

Currently BaseVector::flattenVector doesn't unwrap lazy vectors. This patch makes it unwrap the lazy vectors.

Performance Impact

  • No Impact: This change does not affect the critical path (e.g., build system, doc, error handling).

  • Positive Impact: I have run benchmarks.

    Click to view Benchmark Results
    Paste your google-benchmark or TPC-H results here.
    Before: 10.5s
    After:   8.2s  (+20%)
    
  • Negative Impact: Explained below (e.g., trade-off for correctness).

Release Note

Checklist (For Author)

  • I have added/updated unit tests (ctest).
  • I have verified the code with local build (Release/Debug).
  • I have run clang-format / linters.
  • (Optional) I have run Sanitizers (ASAN/TSAN) locally for complex C++ changes.
  • No need to test or manual test.

Breaking Changes

  • No

  • Yes (Description: ...)

    Click to view Breaking Changes
    Breaking Changes:
    - Description of the breaking change.
    - Possible solutions or workarounds.
    - Any other relevant information.
    

Summary:
Fixes facebookincubator/velox#14492, facebookincubator/velox#14021.

Currently `BaseVector::flattenVector` doesn't unwrap lazy vectors. This patch makes it unwrap the lazy vectors.

It should also fix a bunch of vulnerabilities in the code base. For example code like:

https://github.com/facebookincubator/velox/blob/42193a8015081187e06ed4e8ed77b2bb1002a236/velox/expression/FieldReference.cpp#L176-L179

could crash the program with a lazy input.

Some historical issues that relate to this topic:

facebookincubator/velox#6168
facebookincubator/velox#6170
facebookincubator/velox#8697
facebookincubator/velox#9282

Pull Request resolved: facebookincubator/velox#14491

Reviewed By: kKPulla

Differential Revision: D84733842

Pulled By: pedroerp

fbshipit-source-id: a48cd6d9e2ba3ed96a0829b21b9c4c9a92767377
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