Skip to content

Fix PAX build failure with GCC 15 - #2081

Merged
tuhaihe merged 2 commits into
apache:mainfrom
tuhaihe:fix-pax-gcc15-overloaded-virtual
Oct 10, 2026
Merged

tuhaihe merged 2 commits into
apache:mainfrom
tuhaihe:fix-pax-gcc15-overloaded-virtual

Conversation

@tuhaihe

@tuhaihe tuhaihe commented Oct 6, 2026

Copy link
Copy Markdown
Member

GCC 15 enables -Woverloaded-virtual=1 under -Wall, and PAX builds with -Werror, so the build fails in pax_column.h and
pax_vec_encoding_column.h where a derived class hides a virtual function of its base class.

Add -Wno-error=overloaded-virtual to the GCC flags, as the APPLE (clang) branch already does. The warning is still reported, but no longer fails the build.

Found when building Cloudberry on Ubuntu 26.04, which ships GCC 15.

Assisted-by: Claude Code
Backpatch-through: REL_2_STABLE

Fixes #ISSUE_Number

What does this PR do?

Type of Change

  • Bug fix (non-breaking change)
  • New feature (non-breaking change)
  • Breaking change (fix or feature with breaking changes)
  • Documentation update

Breaking Changes

Test Plan

  • Unit tests added/updated
  • Integration tests added/updated
  • Passed make installcheck
  • Passed make -C src/test installcheck-cbdb-parallel

Impact

Performance:

User-facing changes:

Dependencies:

Checklist

Additional Context

CI Skip Instructions


@tuhaihe tuhaihe added this to the Ubuntu 26.04 Support milestone Oct 6, 2026
@leborchuk leborchuk added the type: Enhancement New feature or request, ideas label Oct 6, 2026

@leborchuk leborchuk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, checked - it really fails with

/home/xifos/git/cloudberry-leborchuk/contrib/pax_storage/src/cpp/storage/columns/pax_encoding_column.h: In instantiation of ‘class pax::PaxEncodingColumn<long int>’: /home/xifos/git/cloudberry-leborchuk/contrib/pax_storage/src/cpp/storage/columns/pax_encoding_column.h:79:23: required from here /home/xifos/git/cloudberry-leborchuk/contrib/pax_storage/src/cpp/storage/columns/pax_column.h:448:29: error: ‘std::pair<char, long unsigned int> pax::PaxCommColumn<T>::GetBuffer(size_t) [with T = long int; size_t = long unsigned int]’ was hidden [-Werror=overloaded-virtual] 448 | std::pair<char , size_t> GetBuffer(size_t position) override; | ^~~~~~~~~ In file included from /home/xifos/git/cloudberry-leborchuk/contrib/pax_storage/src/cpp/storage/columns/pax_encoding_column.cc:28: /home/xifos/git/cloudberry-leborchuk/contrib/pax_storage/src/cpp/storage/columns/pax_encoding_column.h:49:29: note: by ‘std::pair<char, long unsigned int> pax::PaxEncodingColumn<T>::GetBuffer() [with T = long int]’ 49 | std::pair<char *, size_t> GetBuffer() override;

The issue is in using multiple functions GetBuffer in class (multiple classes):

virtual std::pair<char *, size_t> GetBuffer() = 0;
virtual std::pair<char *, size_t> GetBuffer(size_t position) = 0;

PaxCommColumn overrides both. But PaxEncodingColumn overrides only the no-arg one.

And message is about it - we overloaded only one function.

It is just warning, no real bug here. It could be easily fixed - just use https://en.cppreference.com/cpp/language/using_declaration

code should looks like

  using PaxCommColumn<T>::GetBuffer;          // keep base GetBuffer(size_t) visible
  std::pair<char *, size_t> GetBuffer() override;

I suggest create issue to fix all warnings in PAX.

Disable option is good for me.

@tuhaihe
tuhaihe force-pushed the fix-pax-gcc15-overloaded-virtual branch from 1542baf to 3594dbc Compare October 8, 2026 08:24
@tuhaihe

tuhaihe commented Oct 8, 2026

Copy link
Copy Markdown
Member Author

Updates:

The new commit fixes the cause instead of silencing the warning. (An earlier version of
this PR only added -Wno-error=overloaded-virtual; as suggested by @leborchuk, it now changes the code.)

1. GetBuffer() / GetBuffer(size_t) hidden (7 classes)

PaxColumn declares both overloads, but many column classes override only one of them. Add using Base::GetBuffer; to PaxEncodingColumn, PaxNonFixedEncodingColumn, PaxVecEncodingColumn, PaxVecNonFixedEncodingColumn, PaxVecBitPackedColumn, PaxVecBpCharColumn and PaxShortNumericColumn.

2. SetExternalToastDataBuffer (1 class, renamed)

PaxColumns::SetExternalToastDataBuffer(data, column_sizes) is not an override of PaxColumn::SetExternalToastDataBuffer(data). It stores the buffer and gives each column its part of it, while the base version only stores it. A using-declaration would expose the base version on PaxColumns, and calling it would skip the per-column part. So it is renamed to DistributeExternalToastDataBuffer. It has one caller (orc_format_reader.cc).

There is no change in behavior, and CMakeLists.txt is not touched.

@tuhaihe

tuhaihe commented Oct 8, 2026

Copy link
Copy Markdown
Member Author

Hi @leborchuk PTAL. Thanks!

Comment thread contrib/pax_storage/src/cpp/storage/columns/pax_columns.cc Outdated

@jiaqizho jiaqizho left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

GCC 15 enables -Woverloaded-virtual under -Wall. PAX builds with
-Werror, so the build failed, and a build with the warning only
downgraded still printed dozens of warnings. The cause is a derived
class that declares one overload of a function and so hides the other
overloads of the base class.

Fix the cause instead of silencing the warning.

PaxColumn declares both GetBuffer() and GetBuffer(size_t position), but
many column classes override only one of them. Add
"using Base::GetBuffer;" to those classes: PaxEncodingColumn,
PaxNonFixedEncodingColumn, PaxVecEncodingColumn,
PaxVecNonFixedEncodingColumn, PaxVecBitPackedColumn, PaxVecBpCharColumn
and PaxShortNumericColumn.

PaxColumns::SetExternalToastDataBuffer(data, column_sizes) is not an
override of PaxColumn::SetExternalToastDataBuffer(data). It stores the
buffer and gives each column its part of it, while the base version
only stores it. A using-declaration would expose the base version on
PaxColumns, which would skip the per-column part. Rename it to
DistributeExternalToastDataBuffer instead.

There is no change in behavior. The fix is checked with
-Woverloaded-virtual=2 and -Werror on Ubuntu 26.04 (GCC 15.2): the build
had 257 diagnostics at 9 places before, and has none now. The 697 PAX
unit tests pass in a debug build.

Assisted-by: Claude Code
Backpatch-through: REL_2_STABLE
The previous commit renamed PaxColumns::SetExternalToastDataBuffer(data,
column_sizes) to DistributeExternalToastDataBuffer to stop it hiding
PaxColumn::SetExternalToastDataBuffer(data). The rename is not needed,
and a rename does not keep anyone from calling the base version on a
PaxColumns either.

Keep the original name and add
"using PaxColumn::SetExternalToastDataBuffer;" to PaxColumns, the same
as the GetBuffer cases. The definition and the call site in
orc_format_reader.cc are back to what they were.

There is no change in behavior. Checked with -Woverloaded-virtual=2 and
-Werror on Ubuntu 26.04 (GCC 15.2): no diagnostics, and the 697 PAX unit
tests pass in a debug build.

Assisted-by: Claude Code
Backpatch-through: REL_2_STABLE
@tuhaihe
tuhaihe force-pushed the fix-pax-gcc15-overloaded-virtual branch from 2de1590 to 56e9fa4 Compare October 9, 2026 22:52
@tuhaihe
tuhaihe merged commit 2aba737 into apache:main Oct 10, 2026
110 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: Enhancement New feature or request, ideas

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants