GH-48176: [C++][Parquet] Fix arrow-ipc-message-internal-test failure - #48166

Merged
pitrou merged 2 commits into
apache:mainfrom
Vishwanatha-HD:fixParqIssues1
Dec 8, 2025
Merged

GH-48176: [C++][Parquet] Fix arrow-ipc-message-internal-test failure#48166
pitrou merged 2 commits into
apache:mainfrom
Vishwanatha-HD:fixParqIssues1

Conversation

@Vishwanatha-HD

@Vishwanatha-HDVishwanatha-HD commented Nov 18, 2025

Copy link
Copy Markdown
Contributor

Rationale for this change

Fix arrow-ipc-message-internal-test on big endian systems by passing endianness explicitly.

Are these changes tested?

Yes. The changes are tested on s390x arch to make sure things are working fine. The fix is also tested on x86 arch, to make sure there is no new regression introduced.

Are there any user-facing changes?

No

@koukou changed the title GH-48151: [C++][Parquet] Fix arrow-ipc-message-internal-test & arrow-…GH-48166: [C++][Parquet] Fix arrow-ipc-message-internal-test & arrow-acero-hash-join-node-test failuresNov 19, 2025
@github-actions

Copy link
Copy Markdown

⚠️ GitHub issue #48166has been automatically assigned in GitHub to PR creator.

@koukou changed the title GH-48166: [C++][Parquet] Fix arrow-ipc-message-internal-test & arrow-acero-hash-join-node-test failuresGH-48176: [C++][Parquet] Fix arrow-ipc-message-internal-test & arrow-acero-hash-join-node-test failuresNov 19, 2025

@koukou left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Could you fix lint failure?

Comment threadcpp/src/arrow/acero/hash_join.cc Outdated
Comment on lines +316 to +317
// Check if the scalar is a BooleanScalar before casting
if (mask.scalar()->type->id() == Type::BOOL) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why do we need this check? This check didn't exist in the existing code.

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

@kou,
Please find the root cause of this issue on s390x platform below:

The test was failing with a std::bad_cast exception in the ProbeBatch_ResidualFilter function in hash_join.cc at line 309. The issue occurred when the code tried to cast a Datum's scalar to a BooleanScalar using:

const auto& mask_scalar = mask.scalar_as();

The problem was that the test uses literal(NullScalar()) as one of the filter expressions, which creates a NullScalar (of type NullType), not a BooleanScalar (of type BoolType). When the code tried to cast this to a BooleanScalar, it failed with std::bad_cast on s390x architecture

The Fix
I modified the ProbeBatch_ResidualFilter function to check the scalar's type before attempting the cast

@kiszkkiszkNov 24, 2025

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@Vishwanatha-HD I think that this change makes sense for both platforms: big and little endians. We do not need to use #if ... #else ... #endif.

Or, should we fix BooleanScalar to avoid throwing std::bad_cast? cc @pitrou

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.

This is a very detailed explanation. Thanks @Vishwanatha-HD .

As the author of the questioning test, I can say this is the issue of the test rather than of the hash join code. That is, using an filter expression evaluating to null-type null is invalid - it should be a boolean null. The hash join code itself arbitrarily assuming the expression being boolean is OK, though a DCHECK_EQ(mask.type()->id(), Type::BOOL) would be more preferable.

I think we should in turn fix the test by simply replacing the literal(NullScalar()) with a boolean null - literal(MakeNullScalar(boolean()))

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.

But one question remains: The test should be equally problematic for little-endian as well. Why is it passing?

I'm now looking into it.

@zanmato1984zanmato1984Nov 24, 2025

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.

OK, mystery solved: there are two implementations of hash join - regular and swiss. The regular one has wider range of supported types and platforms (including big-endian). The swiss one is more efficient, but restrictive in supported types and platform (only little-endian). So on big endian platform, the regular one is chosen which is more strict on filter expression type. Little-endian platform uses the swiss one which is less strict on filter expression type by explicitly allowing a null-type null - so our CI, always ran on little-endian platforms, has always been passing.

I'm the author of supporting residual filter in swiss join as well as the tests. I think allowing null-type null was a mistake (it was implemented at the beginning of my contribution to Arrow - and I was very naive then).

I think I can send out an issue/pr soon to address the issues discovered here:

  1. The test in question needs to be revised by replacing null-type null with boolean null, as mentioned in my previous comment (so it will pass on big-endian platforms);
  2. The swiss join code need to be updated by not allowing null-type.
  3. Add DCHECKs to enforce the filter expression checking. (optional)

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.

I filed #48268 to address this problem and I'll work on a PR very soon. Once it's fixed, there shouldn't be failures of this test on big-endian platforms. So as I mentioned before, this part of change is not need (and not quite correct). Thanks.

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.

Should be fixed by #48272 . @Vishwanatha-HD Could you first revert the change to hash_join.cc then rebase main to see if the hash join test is passing on big-endian? Thanks.

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

@zanmato1984.. I tried reverting my changes done to hash_join.cc.. With the latest main, the testcase is passing on the big-endian machine..

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.

That's great, thanks for the update!

Comment threadcpp/src/arrow/ipc/message_internal_test.cc Outdated
@Vishwanatha-HD

Copy link
Copy Markdown
ContributorAuthor

Could you fix lint failure?

I have fixed the lint failures. Thanks..

@Vishwanatha-HDVishwanatha-HD left a comment

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

I have taken care of the review comments and made necessary changes to the code. Pls review my changes. Thanks..

@kiszk

Copy link
Copy Markdown
Member

Could you remove [Parquet] from the title? I think that this is not a Parquet-specific issue.

Comment on lines +80 to +81
// On Big-endian systems, FlatBuffer serialization can produce slightly different
// output across different platforms and toolchains.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Er, ok, but there is a well-defined explanation to this: a Arrow schema has an endianness attached to it, and it defaults to the platform's endianness.

To obey the intent of this test case, you should instead change the schema instantiation above to:

auto schema = ::arrow::schema({f0}, Endianness::Little, metadata);

Does this change solve the issue on s390x?

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

@pitrou.. Thanks for your review comments. But this change didnt quite resolve the issue. Thanks..

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@Vishwanatha-HD You're right, but that should be fixed once #48239 is merged. So I would recommend waiting for that.

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

@pitrou.. With the #48239 getting merged into main, I tried making the changes to schema as you suggested above, but the testcase is not passing on s390x..

./debug/arrow-ipc-message-internal-test --gtest_filter="TestMessageInternal.TestByteIdentical"
Running main() from gmock_main.cc
Note: Google Test filter = TestMessageInternal.TestByteIdentical
[==========] Running 1 test from 1 test suite.
[----------] Global test environment set-up.
[----------] 1 test from TestMessageInternal
[ RUN ] TestMessageInternal.TestByteIdentical
arrow/cpp/src/arrow/testing/gtest_util.cc:241: Failure
Expected equality of these values:
buffer.size()
Which is: 228
expected.size()
Which is: 232
Mismatching buffer size

[ FAILED ] TestMessageInternal.TestByteIdentical (1 ms)
[----------] 1 test from TestMessageInternal (1 ms total)

[----------] Global test environment tear-down
[==========] 1 test from 1 test suite ran. (1 ms total)
[ PASSED ] 0 tests.
[ FAILED ] 1 test, listed below:
[ FAILED ] TestMessageInternal.TestByteIdentical

1 FAILED TEST

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@Vishwanatha-HD You must also undo your own changes.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think it's enough to only test Endianness::Little. Roundtripping is tested elsewhere.

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

Ok.. sure.. I will make the necessary changes and push the code again.. Thanks for your comments @pitrou.. !!

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

@pitrou, as per our discussion yesterday, I have made the necessary changes to message_internal_test.cc file to only test Endianness::Little.. I have reverted the code that I added for BE architecture. Thanks..

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@Vishwanatha-HD Are you sure you pushed your changes? I see lots of CI failures.

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

@pitrou.. Apologies.. It was my bad that I had both Endianness in the for loop.. I have made the necessary code changes and pushed the changes again.. Thanks for pointing this out.. !!

@pitrou

Copy link
Copy Markdown
Member

Also see #48239

@Vishwanatha-HD

Vishwanatha-HD commented Nov 24, 2025

Copy link
Copy Markdown
ContributorAuthor

Could you remove [Parquet] from the title? I think that this is not a Parquet-specific issue.

Hi @kiszk.. My idea of having the Parquet is that the overall changes are intended for Parquet component and in order to enable support to Parquet DB on s390x..

@github-actionsgithub-actionsBot added awaiting changes Awaiting changes and removed awaiting committer review Awaiting committer review labels Nov 24, 2025
Comment threadcpp/src/arrow/acero/hash_join.cc Outdated
@kiszk

Copy link
Copy Markdown
Member

Could you remove [Parquet] from the title? I think that this is not a Parquet-specific issue.

Hi @kiszk.. My idea of having the Parquet is that the overall changes are intended for Parquet component and in order to enable support to Parquet DB on s390x..

I understand your idea. On the other hand, this test case is not for Parquet. The current title may confuse others.

@Vishwanatha-HDVishwanatha-HD left a comment

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

I have addressed all the review comments. Thanks.

@pitrou

Copy link
Copy Markdown
Member

Hey @Vishwanatha-HD I have two requests:

  1. can you rebase/merge the latest git main into this?
  2. Please don't mark discussions as resolved as soon as you have answered them; they should only be marked resolved if there is common agreement that there's nothing to add

@Vishwanatha-HD

Vishwanatha-HD commented Nov 26, 2025

Copy link
Copy Markdown
ContributorAuthor

Hey @Vishwanatha-HD I have two requests:

  1. can you rebase/merge the latest git main into this?
  2. Please don't mark discussions as resolved as soon as you have answered them; they should only be marked resolved if there is common agreement that there's nothing to add

Hi @pitrou.. Sure.. I will do the rebase with the latest git main and get the latest changes into this..
Also, I am sorry for marking the discussions resolved, as I thought I should close it as soon as I work on it & resolve it..

@github-actionsgithub-actionsBot added awaiting change review Awaiting change review and removed awaiting changes Awaiting changes labels Nov 26, 2025
@Vishwanatha-HD

Copy link
Copy Markdown
ContributorAuthor

Hey @Vishwanatha-HD I have two requests:

  1. can you rebase/merge the latest git main into this?
  2. Please don't mark discussions as resolved as soon as you have answered them; they should only be marked resolved if there is common agreement that there's nothing to add

Hi @pitrou.. Sure.. I will do the rebase with the latest git main and get the latest changes into this.. Also, I am sorry for marking the discussions resolved, as I thought I should close it as soon as I work on it & resolve it..

@pitrou.. I did the git rebase to merge the latest git main changes into this..

@Vishwanatha-HD

Copy link
Copy Markdown
ContributorAuthor

With the changes done as part of #48272, the latest main works fine without the hash_join.cc changes on big-endian architecture.. Hence reverting the changes done as part of this PR..

@pitrou

Copy link
Copy Markdown
Member

Also, please fix the PR title and description to match the PR contents.

@Vishwanatha-HDVishwanatha-HD changed the title GH-48176: [C++][Parquet] Fix arrow-ipc-message-internal-test & arrow-acero-hash-join-node-test failuresGH-48176: [C++][Parquet] Fix arrow-ipc-message-internal-test failureDec 4, 2025
@Vishwanatha-HD

Copy link
Copy Markdown
ContributorAuthor

Also, please fix the PR title and description to match the PR contents.

@pitrou.. I have fixed the PR title and the description to match the PR contents as you rightly pointed out.. Thanks for that.. !!

@Vishwanatha-HD
Vishwanatha-HDforce-pushed the fixParqIssues1 branch 2 times, most recently from 758836a to b567a59CompareDecember 5, 2025 05:29

@pitroupitrou left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, I'll just wait for CI before merging

@pitrou
pitrou merged commit 01bc1bd into apache:mainDec 8, 2025
44 of 46 checks passed
@pitroupitrou removed the awaiting change review Awaiting change review label Dec 8, 2025
@conbench-apache-arrow

Copy link
Copy Markdown

After merging your PR, Conbench analyzed the 3 benchmarking runs that have been run so far on merge-commit 01bc1bd.

There were no benchmark performance regressions. 🎉

The full Conbench report has more details. It also includes information about 2 possible false positives for unstable benchmarks that are known to sometimes produce them.

Mottl pushed a commit to Mottl/arrow that referenced this pull request May 26, 2026
…ilure (apache#48166)
**Rationale for this change**
Fix `arrow-ipc-message-internal-test` on big endian systems by passing endianness explicitly.
**Are these changes tested?**
Yes. The changes are tested on s390x arch to make sure things are working fine. The fix is also tested on x86 arch, to make sure there is no new regression introduced.
**Are there any user-facing changes?**
No
* GitHub main Issue link: apache#48151
* GitHub Issue: apache#48176
Lead-authored-by: Vishwanatha-HD <Vishwanatha.HD@ibm.com>
Co-authored-by: Antoine Pitrou <antoine@python.org>
Signed-off-by: Antoine Pitrou <antoine@python.org>
Sign up for freeto 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.

5 participants

@Vishwanatha-HD@kiszk@pitrou@kou@zanmato1984
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Add copy buttons to all
 blocks\n(function() {\n function addCopyButtons() {\n document.querySelectorAll('pre code').forEach(function(codeBlock) {\n if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;\n codeBlock.parentElement.setAttribute('data-copy-added', 'true');\n \n var btn = document.createElement('button');\n btn.textContent = 'Copy';\n btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';\n btn.onmouseover = function() { this.style.opacity = '1'; };\n btn.onmouseout = function() { this.style.opacity = '0.7'; };\n btn.onclick = function() {\n navigator.clipboard.writeText(codeBlock.textContent).then(function() {\n btn.textContent = 'Copied!';\n setTimeout(function() { btn.textContent = 'Copy'; }, 1500);\n });\n };\n codeBlock.parentElement.style.position = 'relative';\n codeBlock.parentElement.appendChild(btn);\n });\n }\n \n addCopyButtons();\n \n // Re-run on dynamic content\n var observer = new MutationObserver(addCopyButtons);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Add Copy Buttons to Code Blocks");
}
} catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
})();
(function(){
try {
var __m = "github.com";
var __re = new RegExp('^' + "github\\.com" + '
Skip to content

GH-48176: [C++][Parquet] Fix arrow-ipc-message-internal-test failure - #48166

Merged
pitrou merged 2 commits into
apache:mainfrom
Vishwanatha-HD:fixParqIssues1
Dec 8, 2025
Merged

GH-48176: [C++][Parquet] Fix arrow-ipc-message-internal-test failure#48166
pitrou merged 2 commits into
apache:mainfrom
Vishwanatha-HD:fixParqIssues1

Conversation

@Vishwanatha-HD

@Vishwanatha-HDVishwanatha-HD commented Nov 18, 2025

Copy link
Copy Markdown
Contributor

Rationale for this change

Fix arrow-ipc-message-internal-test on big endian systems by passing endianness explicitly.

Are these changes tested?

Yes. The changes are tested on s390x arch to make sure things are working fine. The fix is also tested on x86 arch, to make sure there is no new regression introduced.

Are there any user-facing changes?

No

@koukou changed the title GH-48151: [C++][Parquet] Fix arrow-ipc-message-internal-test & arrow-…GH-48166: [C++][Parquet] Fix arrow-ipc-message-internal-test & arrow-acero-hash-join-node-test failuresNov 19, 2025
@github-actions

Copy link
Copy Markdown

⚠️ GitHub issue #48166has been automatically assigned in GitHub to PR creator.

@koukou changed the title GH-48166: [C++][Parquet] Fix arrow-ipc-message-internal-test & arrow-acero-hash-join-node-test failuresGH-48176: [C++][Parquet] Fix arrow-ipc-message-internal-test & arrow-acero-hash-join-node-test failuresNov 19, 2025

@koukou left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Could you fix lint failure?

Comment threadcpp/src/arrow/acero/hash_join.cc Outdated
Comment on lines +316 to +317
// Check if the scalar is a BooleanScalar before casting
if (mask.scalar()->type->id() == Type::BOOL) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why do we need this check? This check didn't exist in the existing code.

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

@kou,
Please find the root cause of this issue on s390x platform below:

The test was failing with a std::bad_cast exception in the ProbeBatch_ResidualFilter function in hash_join.cc at line 309. The issue occurred when the code tried to cast a Datum's scalar to a BooleanScalar using:

const auto& mask_scalar = mask.scalar_as();

The problem was that the test uses literal(NullScalar()) as one of the filter expressions, which creates a NullScalar (of type NullType), not a BooleanScalar (of type BoolType). When the code tried to cast this to a BooleanScalar, it failed with std::bad_cast on s390x architecture

The Fix
I modified the ProbeBatch_ResidualFilter function to check the scalar's type before attempting the cast

@kiszkkiszkNov 24, 2025

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@Vishwanatha-HD I think that this change makes sense for both platforms: big and little endians. We do not need to use #if ... #else ... #endif.

Or, should we fix BooleanScalar to avoid throwing std::bad_cast? cc @pitrou

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.

This is a very detailed explanation. Thanks @Vishwanatha-HD .

As the author of the questioning test, I can say this is the issue of the test rather than of the hash join code. That is, using an filter expression evaluating to null-type null is invalid - it should be a boolean null. The hash join code itself arbitrarily assuming the expression being boolean is OK, though a DCHECK_EQ(mask.type()->id(), Type::BOOL) would be more preferable.

I think we should in turn fix the test by simply replacing the literal(NullScalar()) with a boolean null - literal(MakeNullScalar(boolean()))

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.

But one question remains: The test should be equally problematic for little-endian as well. Why is it passing?

I'm now looking into it.

@zanmato1984zanmato1984Nov 24, 2025

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.

OK, mystery solved: there are two implementations of hash join - regular and swiss. The regular one has wider range of supported types and platforms (including big-endian). The swiss one is more efficient, but restrictive in supported types and platform (only little-endian). So on big endian platform, the regular one is chosen which is more strict on filter expression type. Little-endian platform uses the swiss one which is less strict on filter expression type by explicitly allowing a null-type null - so our CI, always ran on little-endian platforms, has always been passing.

I'm the author of supporting residual filter in swiss join as well as the tests. I think allowing null-type null was a mistake (it was implemented at the beginning of my contribution to Arrow - and I was very naive then).

I think I can send out an issue/pr soon to address the issues discovered here:

  1. The test in question needs to be revised by replacing null-type null with boolean null, as mentioned in my previous comment (so it will pass on big-endian platforms);
  2. The swiss join code need to be updated by not allowing null-type.
  3. Add DCHECKs to enforce the filter expression checking. (optional)

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.

I filed #48268 to address this problem and I'll work on a PR very soon. Once it's fixed, there shouldn't be failures of this test on big-endian platforms. So as I mentioned before, this part of change is not need (and not quite correct). Thanks.

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.

Should be fixed by #48272 . @Vishwanatha-HD Could you first revert the change to hash_join.cc then rebase main to see if the hash join test is passing on big-endian? Thanks.

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

@zanmato1984.. I tried reverting my changes done to hash_join.cc.. With the latest main, the testcase is passing on the big-endian machine..

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.

That's great, thanks for the update!

Comment threadcpp/src/arrow/ipc/message_internal_test.cc Outdated
@Vishwanatha-HD

Copy link
Copy Markdown
ContributorAuthor

Could you fix lint failure?

I have fixed the lint failures. Thanks..

@Vishwanatha-HDVishwanatha-HD left a comment

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

I have taken care of the review comments and made necessary changes to the code. Pls review my changes. Thanks..

@kiszk

Copy link
Copy Markdown
Member

Could you remove [Parquet] from the title? I think that this is not a Parquet-specific issue.

Comment on lines +80 to +81
// On Big-endian systems, FlatBuffer serialization can produce slightly different
// output across different platforms and toolchains.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Er, ok, but there is a well-defined explanation to this: a Arrow schema has an endianness attached to it, and it defaults to the platform's endianness.

To obey the intent of this test case, you should instead change the schema instantiation above to:

auto schema = ::arrow::schema({f0}, Endianness::Little, metadata);

Does this change solve the issue on s390x?

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

@pitrou.. Thanks for your review comments. But this change didnt quite resolve the issue. Thanks..

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@Vishwanatha-HD You're right, but that should be fixed once #48239 is merged. So I would recommend waiting for that.

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

@pitrou.. With the #48239 getting merged into main, I tried making the changes to schema as you suggested above, but the testcase is not passing on s390x..

./debug/arrow-ipc-message-internal-test --gtest_filter="TestMessageInternal.TestByteIdentical"
Running main() from gmock_main.cc
Note: Google Test filter = TestMessageInternal.TestByteIdentical
[==========] Running 1 test from 1 test suite.
[----------] Global test environment set-up.
[----------] 1 test from TestMessageInternal
[ RUN ] TestMessageInternal.TestByteIdentical
arrow/cpp/src/arrow/testing/gtest_util.cc:241: Failure
Expected equality of these values:
buffer.size()
Which is: 228
expected.size()
Which is: 232
Mismatching buffer size

[ FAILED ] TestMessageInternal.TestByteIdentical (1 ms)
[----------] 1 test from TestMessageInternal (1 ms total)

[----------] Global test environment tear-down
[==========] 1 test from 1 test suite ran. (1 ms total)
[ PASSED ] 0 tests.
[ FAILED ] 1 test, listed below:
[ FAILED ] TestMessageInternal.TestByteIdentical

1 FAILED TEST

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@Vishwanatha-HD You must also undo your own changes.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think it's enough to only test Endianness::Little. Roundtripping is tested elsewhere.

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

Ok.. sure.. I will make the necessary changes and push the code again.. Thanks for your comments @pitrou.. !!

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

@pitrou, as per our discussion yesterday, I have made the necessary changes to message_internal_test.cc file to only test Endianness::Little.. I have reverted the code that I added for BE architecture. Thanks..

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@Vishwanatha-HD Are you sure you pushed your changes? I see lots of CI failures.

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

@pitrou.. Apologies.. It was my bad that I had both Endianness in the for loop.. I have made the necessary code changes and pushed the changes again.. Thanks for pointing this out.. !!

@pitrou

Copy link
Copy Markdown
Member

Also see #48239

@Vishwanatha-HD

Vishwanatha-HD commented Nov 24, 2025

Copy link
Copy Markdown
ContributorAuthor

Could you remove [Parquet] from the title? I think that this is not a Parquet-specific issue.

Hi @kiszk.. My idea of having the Parquet is that the overall changes are intended for Parquet component and in order to enable support to Parquet DB on s390x..

@github-actionsgithub-actionsBot added awaiting changes Awaiting changes and removed awaiting committer review Awaiting committer review labels Nov 24, 2025
Comment threadcpp/src/arrow/acero/hash_join.cc Outdated
@kiszk

Copy link
Copy Markdown
Member

Could you remove [Parquet] from the title? I think that this is not a Parquet-specific issue.

Hi @kiszk.. My idea of having the Parquet is that the overall changes are intended for Parquet component and in order to enable support to Parquet DB on s390x..

I understand your idea. On the other hand, this test case is not for Parquet. The current title may confuse others.

@Vishwanatha-HDVishwanatha-HD left a comment

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

I have addressed all the review comments. Thanks.

@pitrou

Copy link
Copy Markdown
Member

Hey @Vishwanatha-HD I have two requests:

  1. can you rebase/merge the latest git main into this?
  2. Please don't mark discussions as resolved as soon as you have answered them; they should only be marked resolved if there is common agreement that there's nothing to add

@Vishwanatha-HD

Vishwanatha-HD commented Nov 26, 2025

Copy link
Copy Markdown
ContributorAuthor

Hey @Vishwanatha-HD I have two requests:

  1. can you rebase/merge the latest git main into this?
  2. Please don't mark discussions as resolved as soon as you have answered them; they should only be marked resolved if there is common agreement that there's nothing to add

Hi @pitrou.. Sure.. I will do the rebase with the latest git main and get the latest changes into this..
Also, I am sorry for marking the discussions resolved, as I thought I should close it as soon as I work on it & resolve it..

@github-actionsgithub-actionsBot added awaiting change review Awaiting change review and removed awaiting changes Awaiting changes labels Nov 26, 2025
@Vishwanatha-HD

Copy link
Copy Markdown
ContributorAuthor

Hey @Vishwanatha-HD I have two requests:

  1. can you rebase/merge the latest git main into this?
  2. Please don't mark discussions as resolved as soon as you have answered them; they should only be marked resolved if there is common agreement that there's nothing to add

Hi @pitrou.. Sure.. I will do the rebase with the latest git main and get the latest changes into this.. Also, I am sorry for marking the discussions resolved, as I thought I should close it as soon as I work on it & resolve it..

@pitrou.. I did the git rebase to merge the latest git main changes into this..

@Vishwanatha-HD

Copy link
Copy Markdown
ContributorAuthor

With the changes done as part of #48272, the latest main works fine without the hash_join.cc changes on big-endian architecture.. Hence reverting the changes done as part of this PR..

@pitrou

Copy link
Copy Markdown
Member

Also, please fix the PR title and description to match the PR contents.

@Vishwanatha-HDVishwanatha-HD changed the title GH-48176: [C++][Parquet] Fix arrow-ipc-message-internal-test & arrow-acero-hash-join-node-test failuresGH-48176: [C++][Parquet] Fix arrow-ipc-message-internal-test failureDec 4, 2025
@Vishwanatha-HD

Copy link
Copy Markdown
ContributorAuthor

Also, please fix the PR title and description to match the PR contents.

@pitrou.. I have fixed the PR title and the description to match the PR contents as you rightly pointed out.. Thanks for that.. !!

@Vishwanatha-HD
Vishwanatha-HDforce-pushed the fixParqIssues1 branch 2 times, most recently from 758836a to b567a59CompareDecember 5, 2025 05:29

@pitroupitrou left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, I'll just wait for CI before merging

@pitrou
pitrou merged commit 01bc1bd into apache:mainDec 8, 2025
44 of 46 checks passed
@pitroupitrou removed the awaiting change review Awaiting change review label Dec 8, 2025
@conbench-apache-arrow

Copy link
Copy Markdown

After merging your PR, Conbench analyzed the 3 benchmarking runs that have been run so far on merge-commit 01bc1bd.

There were no benchmark performance regressions. 🎉

The full Conbench report has more details. It also includes information about 2 possible false positives for unstable benchmarks that are known to sometimes produce them.

Mottl pushed a commit to Mottl/arrow that referenced this pull request May 26, 2026
…ilure (apache#48166)
**Rationale for this change**
Fix `arrow-ipc-message-internal-test` on big endian systems by passing endianness explicitly.
**Are these changes tested?**
Yes. The changes are tested on s390x arch to make sure things are working fine. The fix is also tested on x86 arch, to make sure there is no new regression introduced.
**Are there any user-facing changes?**
No
* GitHub main Issue link: apache#48151
* GitHub Issue: apache#48176
Lead-authored-by: Vishwanatha-HD <Vishwanatha.HD@ibm.com>
Co-authored-by: Antoine Pitrou <antoine@python.org>
Signed-off-by: Antoine Pitrou <antoine@python.org>
Sign up for freeto 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.

5 participants

@Vishwanatha-HD@kiszk@pitrou@kou@zanmato1984
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Force GitHub README to respect dark mode\n(function() {\n var style = document.createElement('style');\n style.textContent = '\n .markdown-body {\n color-scheme: dark light;\n }\n .markdown-body pre { background: #161b22 !important; }\n .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; }\n .markdown-body table th, .markdown-body table td { border-color: #30363d !important; }\n .markdown-body img { background: #0d1117; }\n .markdown-body blockquote { border-left-color: #8b949e; }\n .markdown-body hr { border-color: #30363d; }\n ';\n document.head.appendChild(style);\n})();", "GitHub Dark Mode README Fix"); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

GH-48176: [C++][Parquet] Fix arrow-ipc-message-internal-test failure - #48166

Merged
pitrou merged 2 commits into
apache:mainfrom
Vishwanatha-HD:fixParqIssues1
Dec 8, 2025
Merged

GH-48176: [C++][Parquet] Fix arrow-ipc-message-internal-test failure#48166
pitrou merged 2 commits into
apache:mainfrom
Vishwanatha-HD:fixParqIssues1

Conversation

@Vishwanatha-HD

@Vishwanatha-HDVishwanatha-HD commented Nov 18, 2025

Copy link
Copy Markdown
Contributor

Rationale for this change

Fix arrow-ipc-message-internal-test on big endian systems by passing endianness explicitly.

Are these changes tested?

Yes. The changes are tested on s390x arch to make sure things are working fine. The fix is also tested on x86 arch, to make sure there is no new regression introduced.

Are there any user-facing changes?

No

@koukou changed the title GH-48151: [C++][Parquet] Fix arrow-ipc-message-internal-test & arrow-…GH-48166: [C++][Parquet] Fix arrow-ipc-message-internal-test & arrow-acero-hash-join-node-test failuresNov 19, 2025
@github-actions

Copy link
Copy Markdown

⚠️ GitHub issue #48166has been automatically assigned in GitHub to PR creator.

@koukou changed the title GH-48166: [C++][Parquet] Fix arrow-ipc-message-internal-test & arrow-acero-hash-join-node-test failuresGH-48176: [C++][Parquet] Fix arrow-ipc-message-internal-test & arrow-acero-hash-join-node-test failuresNov 19, 2025

@koukou left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Could you fix lint failure?

Comment threadcpp/src/arrow/acero/hash_join.cc Outdated
Comment on lines +316 to +317
// Check if the scalar is a BooleanScalar before casting
if (mask.scalar()->type->id() == Type::BOOL) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why do we need this check? This check didn't exist in the existing code.

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

@kou,
Please find the root cause of this issue on s390x platform below:

The test was failing with a std::bad_cast exception in the ProbeBatch_ResidualFilter function in hash_join.cc at line 309. The issue occurred when the code tried to cast a Datum's scalar to a BooleanScalar using:

const auto& mask_scalar = mask.scalar_as();

The problem was that the test uses literal(NullScalar()) as one of the filter expressions, which creates a NullScalar (of type NullType), not a BooleanScalar (of type BoolType). When the code tried to cast this to a BooleanScalar, it failed with std::bad_cast on s390x architecture

The Fix
I modified the ProbeBatch_ResidualFilter function to check the scalar's type before attempting the cast

@kiszkkiszkNov 24, 2025

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@Vishwanatha-HD I think that this change makes sense for both platforms: big and little endians. We do not need to use #if ... #else ... #endif.

Or, should we fix BooleanScalar to avoid throwing std::bad_cast? cc @pitrou

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.

This is a very detailed explanation. Thanks @Vishwanatha-HD .

As the author of the questioning test, I can say this is the issue of the test rather than of the hash join code. That is, using an filter expression evaluating to null-type null is invalid - it should be a boolean null. The hash join code itself arbitrarily assuming the expression being boolean is OK, though a DCHECK_EQ(mask.type()->id(), Type::BOOL) would be more preferable.

I think we should in turn fix the test by simply replacing the literal(NullScalar()) with a boolean null - literal(MakeNullScalar(boolean()))

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.

But one question remains: The test should be equally problematic for little-endian as well. Why is it passing?

I'm now looking into it.

@zanmato1984zanmato1984Nov 24, 2025

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.

OK, mystery solved: there are two implementations of hash join - regular and swiss. The regular one has wider range of supported types and platforms (including big-endian). The swiss one is more efficient, but restrictive in supported types and platform (only little-endian). So on big endian platform, the regular one is chosen which is more strict on filter expression type. Little-endian platform uses the swiss one which is less strict on filter expression type by explicitly allowing a null-type null - so our CI, always ran on little-endian platforms, has always been passing.

I'm the author of supporting residual filter in swiss join as well as the tests. I think allowing null-type null was a mistake (it was implemented at the beginning of my contribution to Arrow - and I was very naive then).

I think I can send out an issue/pr soon to address the issues discovered here:

  1. The test in question needs to be revised by replacing null-type null with boolean null, as mentioned in my previous comment (so it will pass on big-endian platforms);
  2. The swiss join code need to be updated by not allowing null-type.
  3. Add DCHECKs to enforce the filter expression checking. (optional)

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.

I filed #48268 to address this problem and I'll work on a PR very soon. Once it's fixed, there shouldn't be failures of this test on big-endian platforms. So as I mentioned before, this part of change is not need (and not quite correct). Thanks.

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.

Should be fixed by #48272 . @Vishwanatha-HD Could you first revert the change to hash_join.cc then rebase main to see if the hash join test is passing on big-endian? Thanks.

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

@zanmato1984.. I tried reverting my changes done to hash_join.cc.. With the latest main, the testcase is passing on the big-endian machine..

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.

That's great, thanks for the update!

Comment threadcpp/src/arrow/ipc/message_internal_test.cc Outdated
@Vishwanatha-HD

Copy link
Copy Markdown
ContributorAuthor

Could you fix lint failure?

I have fixed the lint failures. Thanks..

@Vishwanatha-HDVishwanatha-HD left a comment

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

I have taken care of the review comments and made necessary changes to the code. Pls review my changes. Thanks..

@kiszk

Copy link
Copy Markdown
Member

Could you remove [Parquet] from the title? I think that this is not a Parquet-specific issue.

Comment on lines +80 to +81
// On Big-endian systems, FlatBuffer serialization can produce slightly different
// output across different platforms and toolchains.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Er, ok, but there is a well-defined explanation to this: a Arrow schema has an endianness attached to it, and it defaults to the platform's endianness.

To obey the intent of this test case, you should instead change the schema instantiation above to:

auto schema = ::arrow::schema({f0}, Endianness::Little, metadata);

Does this change solve the issue on s390x?

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

@pitrou.. Thanks for your review comments. But this change didnt quite resolve the issue. Thanks..

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@Vishwanatha-HD You're right, but that should be fixed once #48239 is merged. So I would recommend waiting for that.

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

@pitrou.. With the #48239 getting merged into main, I tried making the changes to schema as you suggested above, but the testcase is not passing on s390x..

./debug/arrow-ipc-message-internal-test --gtest_filter="TestMessageInternal.TestByteIdentical"
Running main() from gmock_main.cc
Note: Google Test filter = TestMessageInternal.TestByteIdentical
[==========] Running 1 test from 1 test suite.
[----------] Global test environment set-up.
[----------] 1 test from TestMessageInternal
[ RUN ] TestMessageInternal.TestByteIdentical
arrow/cpp/src/arrow/testing/gtest_util.cc:241: Failure
Expected equality of these values:
buffer.size()
Which is: 228
expected.size()
Which is: 232
Mismatching buffer size

[ FAILED ] TestMessageInternal.TestByteIdentical (1 ms)
[----------] 1 test from TestMessageInternal (1 ms total)

[----------] Global test environment tear-down
[==========] 1 test from 1 test suite ran. (1 ms total)
[ PASSED ] 0 tests.
[ FAILED ] 1 test, listed below:
[ FAILED ] TestMessageInternal.TestByteIdentical

1 FAILED TEST

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@Vishwanatha-HD You must also undo your own changes.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think it's enough to only test Endianness::Little. Roundtripping is tested elsewhere.

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

Ok.. sure.. I will make the necessary changes and push the code again.. Thanks for your comments @pitrou.. !!

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

@pitrou, as per our discussion yesterday, I have made the necessary changes to message_internal_test.cc file to only test Endianness::Little.. I have reverted the code that I added for BE architecture. Thanks..

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@Vishwanatha-HD Are you sure you pushed your changes? I see lots of CI failures.

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

@pitrou.. Apologies.. It was my bad that I had both Endianness in the for loop.. I have made the necessary code changes and pushed the changes again.. Thanks for pointing this out.. !!

@pitrou

Copy link
Copy Markdown
Member

Also see #48239

@Vishwanatha-HD

Vishwanatha-HD commented Nov 24, 2025

Copy link
Copy Markdown
ContributorAuthor

Could you remove [Parquet] from the title? I think that this is not a Parquet-specific issue.

Hi @kiszk.. My idea of having the Parquet is that the overall changes are intended for Parquet component and in order to enable support to Parquet DB on s390x..

@github-actionsgithub-actionsBot added awaiting changes Awaiting changes and removed awaiting committer review Awaiting committer review labels Nov 24, 2025
Comment threadcpp/src/arrow/acero/hash_join.cc Outdated
@kiszk

Copy link
Copy Markdown
Member

Could you remove [Parquet] from the title? I think that this is not a Parquet-specific issue.

Hi @kiszk.. My idea of having the Parquet is that the overall changes are intended for Parquet component and in order to enable support to Parquet DB on s390x..

I understand your idea. On the other hand, this test case is not for Parquet. The current title may confuse others.

@Vishwanatha-HDVishwanatha-HD left a comment

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

I have addressed all the review comments. Thanks.

@pitrou

Copy link
Copy Markdown
Member

Hey @Vishwanatha-HD I have two requests:

  1. can you rebase/merge the latest git main into this?
  2. Please don't mark discussions as resolved as soon as you have answered them; they should only be marked resolved if there is common agreement that there's nothing to add

@Vishwanatha-HD

Vishwanatha-HD commented Nov 26, 2025

Copy link
Copy Markdown
ContributorAuthor

Hey @Vishwanatha-HD I have two requests:

  1. can you rebase/merge the latest git main into this?
  2. Please don't mark discussions as resolved as soon as you have answered them; they should only be marked resolved if there is common agreement that there's nothing to add

Hi @pitrou.. Sure.. I will do the rebase with the latest git main and get the latest changes into this..
Also, I am sorry for marking the discussions resolved, as I thought I should close it as soon as I work on it & resolve it..

@github-actionsgithub-actionsBot added awaiting change review Awaiting change review and removed awaiting changes Awaiting changes labels Nov 26, 2025
@Vishwanatha-HD

Copy link
Copy Markdown
ContributorAuthor

Hey @Vishwanatha-HD I have two requests:

  1. can you rebase/merge the latest git main into this?
  2. Please don't mark discussions as resolved as soon as you have answered them; they should only be marked resolved if there is common agreement that there's nothing to add

Hi @pitrou.. Sure.. I will do the rebase with the latest git main and get the latest changes into this.. Also, I am sorry for marking the discussions resolved, as I thought I should close it as soon as I work on it & resolve it..

@pitrou.. I did the git rebase to merge the latest git main changes into this..

@Vishwanatha-HD

Copy link
Copy Markdown
ContributorAuthor

With the changes done as part of #48272, the latest main works fine without the hash_join.cc changes on big-endian architecture.. Hence reverting the changes done as part of this PR..

@pitrou

Copy link
Copy Markdown
Member

Also, please fix the PR title and description to match the PR contents.

@Vishwanatha-HDVishwanatha-HD changed the title GH-48176: [C++][Parquet] Fix arrow-ipc-message-internal-test & arrow-acero-hash-join-node-test failuresGH-48176: [C++][Parquet] Fix arrow-ipc-message-internal-test failureDec 4, 2025
@Vishwanatha-HD

Copy link
Copy Markdown
ContributorAuthor

Also, please fix the PR title and description to match the PR contents.

@pitrou.. I have fixed the PR title and the description to match the PR contents as you rightly pointed out.. Thanks for that.. !!

@Vishwanatha-HD
Vishwanatha-HDforce-pushed the fixParqIssues1 branch 2 times, most recently from 758836a to b567a59CompareDecember 5, 2025 05:29

@pitroupitrou left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, I'll just wait for CI before merging

@pitrou
pitrou merged commit 01bc1bd into apache:mainDec 8, 2025
44 of 46 checks passed
@pitroupitrou removed the awaiting change review Awaiting change review label Dec 8, 2025
@conbench-apache-arrow

Copy link
Copy Markdown

After merging your PR, Conbench analyzed the 3 benchmarking runs that have been run so far on merge-commit 01bc1bd.

There were no benchmark performance regressions. 🎉

The full Conbench report has more details. It also includes information about 2 possible false positives for unstable benchmarks that are known to sometimes produce them.

Mottl pushed a commit to Mottl/arrow that referenced this pull request May 26, 2026
…ilure (apache#48166)
**Rationale for this change**
Fix `arrow-ipc-message-internal-test` on big endian systems by passing endianness explicitly.
**Are these changes tested?**
Yes. The changes are tested on s390x arch to make sure things are working fine. The fix is also tested on x86 arch, to make sure there is no new regression introduced.
**Are there any user-facing changes?**
No
* GitHub main Issue link: apache#48151
* GitHub Issue: apache#48176
Lead-authored-by: Vishwanatha-HD <Vishwanatha.HD@ibm.com>
Co-authored-by: Antoine Pitrou <antoine@python.org>
Signed-off-by: Antoine Pitrou <antoine@python.org>
Sign up for freeto 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.

5 participants

@Vishwanatha-HD@kiszk@pitrou@kou@zanmato1984
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Highlight search terms from Google/DuckDuckGo/Bing referrer\n(function() {\n var ref = document.referrer;\n var terms = [];\n \n if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) {\n var url = new URL(ref);\n var q = url.searchParams.get('q') || url.searchParams.get('p');\n if (q) {\n terms = q.split(/\\s+/).filter(function(t) { return t.length > 2; });\n }\n }\n \n if (terms.length === 0) return;\n \n var style = document.createElement('style');\n style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }';\n document.head.appendChild(style);\n \n function highlight(node) {\n if (node.nodeType === 3) { // text node\n var text = node.textContent;\n var found = false;\n terms.forEach(function(term) {\n var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\') + ')', 'gi');\n if (regex.test(text)) {\n found = true;\n var frag = document.createDocumentFragment();\n var parts = text.split(regex);\n parts.forEach(function(part, i) {\n if (i % 2 === 0) {\n frag.appendChild(document.createTextNode(part));\n } else {\n var span = document.createElement('span');\n span.className = 'userscript-highlight';\n span.textContent = part;\n frag.appendChild(span);\n }\n });\n node.parentNode.replaceChild(frag, node);\n }\n });\n } else if (node.nodeType === 1 && node.childNodes) { // element\n var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT'];\n if (!skipTags.includes(node.tagName)) {\n Array.from(node.childNodes).forEach(highlight);\n }\n }\n }\n \n highlight(document.body);\n \n // Re-highlight on dynamic content\n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1 || node.nodeType === 3) highlight(node);\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Highlight Search Terms"); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

GH-48176: [C++][Parquet] Fix arrow-ipc-message-internal-test failure - #48166

Merged
pitrou merged 2 commits into
apache:mainfrom
Vishwanatha-HD:fixParqIssues1
Dec 8, 2025
Merged

GH-48176: [C++][Parquet] Fix arrow-ipc-message-internal-test failure#48166
pitrou merged 2 commits into
apache:mainfrom
Vishwanatha-HD:fixParqIssues1

Conversation

@Vishwanatha-HD

@Vishwanatha-HDVishwanatha-HD commented Nov 18, 2025

Copy link
Copy Markdown
Contributor

Rationale for this change

Fix arrow-ipc-message-internal-test on big endian systems by passing endianness explicitly.

Are these changes tested?

Yes. The changes are tested on s390x arch to make sure things are working fine. The fix is also tested on x86 arch, to make sure there is no new regression introduced.

Are there any user-facing changes?

No

@koukou changed the title GH-48151: [C++][Parquet] Fix arrow-ipc-message-internal-test & arrow-…GH-48166: [C++][Parquet] Fix arrow-ipc-message-internal-test & arrow-acero-hash-join-node-test failuresNov 19, 2025
@github-actions

Copy link
Copy Markdown

⚠️ GitHub issue #48166has been automatically assigned in GitHub to PR creator.

@koukou changed the title GH-48166: [C++][Parquet] Fix arrow-ipc-message-internal-test & arrow-acero-hash-join-node-test failuresGH-48176: [C++][Parquet] Fix arrow-ipc-message-internal-test & arrow-acero-hash-join-node-test failuresNov 19, 2025

@koukou left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Could you fix lint failure?

Comment threadcpp/src/arrow/acero/hash_join.cc Outdated
Comment on lines +316 to +317
// Check if the scalar is a BooleanScalar before casting
if (mask.scalar()->type->id() == Type::BOOL) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why do we need this check? This check didn't exist in the existing code.

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

@kou,
Please find the root cause of this issue on s390x platform below:

The test was failing with a std::bad_cast exception in the ProbeBatch_ResidualFilter function in hash_join.cc at line 309. The issue occurred when the code tried to cast a Datum's scalar to a BooleanScalar using:

const auto& mask_scalar = mask.scalar_as();

The problem was that the test uses literal(NullScalar()) as one of the filter expressions, which creates a NullScalar (of type NullType), not a BooleanScalar (of type BoolType). When the code tried to cast this to a BooleanScalar, it failed with std::bad_cast on s390x architecture

The Fix
I modified the ProbeBatch_ResidualFilter function to check the scalar's type before attempting the cast

@kiszkkiszkNov 24, 2025

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@Vishwanatha-HD I think that this change makes sense for both platforms: big and little endians. We do not need to use #if ... #else ... #endif.

Or, should we fix BooleanScalar to avoid throwing std::bad_cast? cc @pitrou

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.

This is a very detailed explanation. Thanks @Vishwanatha-HD .

As the author of the questioning test, I can say this is the issue of the test rather than of the hash join code. That is, using an filter expression evaluating to null-type null is invalid - it should be a boolean null. The hash join code itself arbitrarily assuming the expression being boolean is OK, though a DCHECK_EQ(mask.type()->id(), Type::BOOL) would be more preferable.

I think we should in turn fix the test by simply replacing the literal(NullScalar()) with a boolean null - literal(MakeNullScalar(boolean()))

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.

But one question remains: The test should be equally problematic for little-endian as well. Why is it passing?

I'm now looking into it.

@zanmato1984zanmato1984Nov 24, 2025

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.

OK, mystery solved: there are two implementations of hash join - regular and swiss. The regular one has wider range of supported types and platforms (including big-endian). The swiss one is more efficient, but restrictive in supported types and platform (only little-endian). So on big endian platform, the regular one is chosen which is more strict on filter expression type. Little-endian platform uses the swiss one which is less strict on filter expression type by explicitly allowing a null-type null - so our CI, always ran on little-endian platforms, has always been passing.

I'm the author of supporting residual filter in swiss join as well as the tests. I think allowing null-type null was a mistake (it was implemented at the beginning of my contribution to Arrow - and I was very naive then).

I think I can send out an issue/pr soon to address the issues discovered here:

  1. The test in question needs to be revised by replacing null-type null with boolean null, as mentioned in my previous comment (so it will pass on big-endian platforms);
  2. The swiss join code need to be updated by not allowing null-type.
  3. Add DCHECKs to enforce the filter expression checking. (optional)

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.

I filed #48268 to address this problem and I'll work on a PR very soon. Once it's fixed, there shouldn't be failures of this test on big-endian platforms. So as I mentioned before, this part of change is not need (and not quite correct). Thanks.

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.

Should be fixed by #48272 . @Vishwanatha-HD Could you first revert the change to hash_join.cc then rebase main to see if the hash join test is passing on big-endian? Thanks.

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

@zanmato1984.. I tried reverting my changes done to hash_join.cc.. With the latest main, the testcase is passing on the big-endian machine..

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.

That's great, thanks for the update!

Comment threadcpp/src/arrow/ipc/message_internal_test.cc Outdated
@Vishwanatha-HD

Copy link
Copy Markdown
ContributorAuthor

Could you fix lint failure?

I have fixed the lint failures. Thanks..

@Vishwanatha-HDVishwanatha-HD left a comment

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

I have taken care of the review comments and made necessary changes to the code. Pls review my changes. Thanks..

@kiszk

Copy link
Copy Markdown
Member

Could you remove [Parquet] from the title? I think that this is not a Parquet-specific issue.

Comment on lines +80 to +81
// On Big-endian systems, FlatBuffer serialization can produce slightly different
// output across different platforms and toolchains.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Er, ok, but there is a well-defined explanation to this: a Arrow schema has an endianness attached to it, and it defaults to the platform's endianness.

To obey the intent of this test case, you should instead change the schema instantiation above to:

auto schema = ::arrow::schema({f0}, Endianness::Little, metadata);

Does this change solve the issue on s390x?

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

@pitrou.. Thanks for your review comments. But this change didnt quite resolve the issue. Thanks..

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@Vishwanatha-HD You're right, but that should be fixed once #48239 is merged. So I would recommend waiting for that.

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

@pitrou.. With the #48239 getting merged into main, I tried making the changes to schema as you suggested above, but the testcase is not passing on s390x..

./debug/arrow-ipc-message-internal-test --gtest_filter="TestMessageInternal.TestByteIdentical"
Running main() from gmock_main.cc
Note: Google Test filter = TestMessageInternal.TestByteIdentical
[==========] Running 1 test from 1 test suite.
[----------] Global test environment set-up.
[----------] 1 test from TestMessageInternal
[ RUN ] TestMessageInternal.TestByteIdentical
arrow/cpp/src/arrow/testing/gtest_util.cc:241: Failure
Expected equality of these values:
buffer.size()
Which is: 228
expected.size()
Which is: 232
Mismatching buffer size

[ FAILED ] TestMessageInternal.TestByteIdentical (1 ms)
[----------] 1 test from TestMessageInternal (1 ms total)

[----------] Global test environment tear-down
[==========] 1 test from 1 test suite ran. (1 ms total)
[ PASSED ] 0 tests.
[ FAILED ] 1 test, listed below:
[ FAILED ] TestMessageInternal.TestByteIdentical

1 FAILED TEST

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@Vishwanatha-HD You must also undo your own changes.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think it's enough to only test Endianness::Little. Roundtripping is tested elsewhere.

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

Ok.. sure.. I will make the necessary changes and push the code again.. Thanks for your comments @pitrou.. !!

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

@pitrou, as per our discussion yesterday, I have made the necessary changes to message_internal_test.cc file to only test Endianness::Little.. I have reverted the code that I added for BE architecture. Thanks..

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@Vishwanatha-HD Are you sure you pushed your changes? I see lots of CI failures.

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

@pitrou.. Apologies.. It was my bad that I had both Endianness in the for loop.. I have made the necessary code changes and pushed the changes again.. Thanks for pointing this out.. !!

@pitrou

Copy link
Copy Markdown
Member

Also see #48239

@Vishwanatha-HD

Vishwanatha-HD commented Nov 24, 2025

Copy link
Copy Markdown
ContributorAuthor

Could you remove [Parquet] from the title? I think that this is not a Parquet-specific issue.

Hi @kiszk.. My idea of having the Parquet is that the overall changes are intended for Parquet component and in order to enable support to Parquet DB on s390x..

@github-actionsgithub-actionsBot added awaiting changes Awaiting changes and removed awaiting committer review Awaiting committer review labels Nov 24, 2025
Comment threadcpp/src/arrow/acero/hash_join.cc Outdated
@kiszk

Copy link
Copy Markdown
Member

Could you remove [Parquet] from the title? I think that this is not a Parquet-specific issue.

Hi @kiszk.. My idea of having the Parquet is that the overall changes are intended for Parquet component and in order to enable support to Parquet DB on s390x..

I understand your idea. On the other hand, this test case is not for Parquet. The current title may confuse others.

@Vishwanatha-HDVishwanatha-HD left a comment

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

I have addressed all the review comments. Thanks.

@pitrou

Copy link
Copy Markdown
Member

Hey @Vishwanatha-HD I have two requests:

  1. can you rebase/merge the latest git main into this?
  2. Please don't mark discussions as resolved as soon as you have answered them; they should only be marked resolved if there is common agreement that there's nothing to add

@Vishwanatha-HD

Vishwanatha-HD commented Nov 26, 2025

Copy link
Copy Markdown
ContributorAuthor

Hey @Vishwanatha-HD I have two requests:

  1. can you rebase/merge the latest git main into this?
  2. Please don't mark discussions as resolved as soon as you have answered them; they should only be marked resolved if there is common agreement that there's nothing to add

Hi @pitrou.. Sure.. I will do the rebase with the latest git main and get the latest changes into this..
Also, I am sorry for marking the discussions resolved, as I thought I should close it as soon as I work on it & resolve it..

@github-actionsgithub-actionsBot added awaiting change review Awaiting change review and removed awaiting changes Awaiting changes labels Nov 26, 2025
@Vishwanatha-HD

Copy link
Copy Markdown
ContributorAuthor

Hey @Vishwanatha-HD I have two requests:

  1. can you rebase/merge the latest git main into this?
  2. Please don't mark discussions as resolved as soon as you have answered them; they should only be marked resolved if there is common agreement that there's nothing to add

Hi @pitrou.. Sure.. I will do the rebase with the latest git main and get the latest changes into this.. Also, I am sorry for marking the discussions resolved, as I thought I should close it as soon as I work on it & resolve it..

@pitrou.. I did the git rebase to merge the latest git main changes into this..

@Vishwanatha-HD

Copy link
Copy Markdown
ContributorAuthor

With the changes done as part of #48272, the latest main works fine without the hash_join.cc changes on big-endian architecture.. Hence reverting the changes done as part of this PR..

@pitrou

Copy link
Copy Markdown
Member

Also, please fix the PR title and description to match the PR contents.

@Vishwanatha-HDVishwanatha-HD changed the title GH-48176: [C++][Parquet] Fix arrow-ipc-message-internal-test & arrow-acero-hash-join-node-test failuresGH-48176: [C++][Parquet] Fix arrow-ipc-message-internal-test failureDec 4, 2025
@Vishwanatha-HD

Copy link
Copy Markdown
ContributorAuthor

Also, please fix the PR title and description to match the PR contents.

@pitrou.. I have fixed the PR title and the description to match the PR contents as you rightly pointed out.. Thanks for that.. !!

@Vishwanatha-HD
Vishwanatha-HDforce-pushed the fixParqIssues1 branch 2 times, most recently from 758836a to b567a59CompareDecember 5, 2025 05:29

@pitroupitrou left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, I'll just wait for CI before merging

@pitrou
pitrou merged commit 01bc1bd into apache:mainDec 8, 2025
44 of 46 checks passed
@pitroupitrou removed the awaiting change review Awaiting change review label Dec 8, 2025
@conbench-apache-arrow

Copy link
Copy Markdown

After merging your PR, Conbench analyzed the 3 benchmarking runs that have been run so far on merge-commit 01bc1bd.

There were no benchmark performance regressions. 🎉

The full Conbench report has more details. It also includes information about 2 possible false positives for unstable benchmarks that are known to sometimes produce them.

Mottl pushed a commit to Mottl/arrow that referenced this pull request May 26, 2026
…ilure (apache#48166)
**Rationale for this change**
Fix `arrow-ipc-message-internal-test` on big endian systems by passing endianness explicitly.
**Are these changes tested?**
Yes. The changes are tested on s390x arch to make sure things are working fine. The fix is also tested on x86 arch, to make sure there is no new regression introduced.
**Are there any user-facing changes?**
No
* GitHub main Issue link: apache#48151
* GitHub Issue: apache#48176
Lead-authored-by: Vishwanatha-HD <Vishwanatha.HD@ibm.com>
Co-authored-by: Antoine Pitrou <antoine@python.org>
Signed-off-by: Antoine Pitrou <antoine@python.org>
Sign up for freeto 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.

5 participants

@Vishwanatha-HD@kiszk@pitrou@kou@zanmato1984
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Strip utm_, fbclid, gclid, etc. from all links on page\n(function() {\n var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content',\n 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid',\n 'ref', 'ref_src', 'source', 'medium', 'campaign'];\n \n function cleanUrl(url) {\n try {\n var u = new URL(url, window.location.origin);\n var changed = false;\n trackingParams.forEach(function(p) {\n if (u.searchParams.has(p)) {\n u.searchParams.delete(p);\n changed = true;\n }\n });\n return changed ? u.toString() : url;\n } catch (e) {\n return url;\n }\n }\n \n function cleanLinks() {\n document.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n \n cleanLinks();\n \n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1) {\n if (node.tagName === 'A') cleanLinks();\n node.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Remove Tracking Parameters from Links"); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + '
Skip to content

GH-48176: [C++][Parquet] Fix arrow-ipc-message-internal-test failure - #48166

Merged
pitrou merged 2 commits into
apache:mainfrom
Vishwanatha-HD:fixParqIssues1
Dec 8, 2025
Merged

GH-48176: [C++][Parquet] Fix arrow-ipc-message-internal-test failure#48166
pitrou merged 2 commits into
apache:mainfrom
Vishwanatha-HD:fixParqIssues1

Conversation

@Vishwanatha-HD

@Vishwanatha-HDVishwanatha-HD commented Nov 18, 2025

Copy link
Copy Markdown
Contributor

Rationale for this change

Fix arrow-ipc-message-internal-test on big endian systems by passing endianness explicitly.

Are these changes tested?

Yes. The changes are tested on s390x arch to make sure things are working fine. The fix is also tested on x86 arch, to make sure there is no new regression introduced.

Are there any user-facing changes?

No

@koukou changed the title GH-48151: [C++][Parquet] Fix arrow-ipc-message-internal-test & arrow-…GH-48166: [C++][Parquet] Fix arrow-ipc-message-internal-test & arrow-acero-hash-join-node-test failuresNov 19, 2025
@github-actions

Copy link
Copy Markdown

⚠️ GitHub issue #48166has been automatically assigned in GitHub to PR creator.

@koukou changed the title GH-48166: [C++][Parquet] Fix arrow-ipc-message-internal-test & arrow-acero-hash-join-node-test failuresGH-48176: [C++][Parquet] Fix arrow-ipc-message-internal-test & arrow-acero-hash-join-node-test failuresNov 19, 2025

@koukou left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Could you fix lint failure?

Comment threadcpp/src/arrow/acero/hash_join.cc Outdated
Comment on lines +316 to +317
// Check if the scalar is a BooleanScalar before casting
if (mask.scalar()->type->id() == Type::BOOL) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why do we need this check? This check didn't exist in the existing code.

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

@kou,
Please find the root cause of this issue on s390x platform below:

The test was failing with a std::bad_cast exception in the ProbeBatch_ResidualFilter function in hash_join.cc at line 309. The issue occurred when the code tried to cast a Datum's scalar to a BooleanScalar using:

const auto& mask_scalar = mask.scalar_as();

The problem was that the test uses literal(NullScalar()) as one of the filter expressions, which creates a NullScalar (of type NullType), not a BooleanScalar (of type BoolType). When the code tried to cast this to a BooleanScalar, it failed with std::bad_cast on s390x architecture

The Fix
I modified the ProbeBatch_ResidualFilter function to check the scalar's type before attempting the cast

@kiszkkiszkNov 24, 2025

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@Vishwanatha-HD I think that this change makes sense for both platforms: big and little endians. We do not need to use #if ... #else ... #endif.

Or, should we fix BooleanScalar to avoid throwing std::bad_cast? cc @pitrou

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.

This is a very detailed explanation. Thanks @Vishwanatha-HD .

As the author of the questioning test, I can say this is the issue of the test rather than of the hash join code. That is, using an filter expression evaluating to null-type null is invalid - it should be a boolean null. The hash join code itself arbitrarily assuming the expression being boolean is OK, though a DCHECK_EQ(mask.type()->id(), Type::BOOL) would be more preferable.

I think we should in turn fix the test by simply replacing the literal(NullScalar()) with a boolean null - literal(MakeNullScalar(boolean()))

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.

But one question remains: The test should be equally problematic for little-endian as well. Why is it passing?

I'm now looking into it.

@zanmato1984zanmato1984Nov 24, 2025

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.

OK, mystery solved: there are two implementations of hash join - regular and swiss. The regular one has wider range of supported types and platforms (including big-endian). The swiss one is more efficient, but restrictive in supported types and platform (only little-endian). So on big endian platform, the regular one is chosen which is more strict on filter expression type. Little-endian platform uses the swiss one which is less strict on filter expression type by explicitly allowing a null-type null - so our CI, always ran on little-endian platforms, has always been passing.

I'm the author of supporting residual filter in swiss join as well as the tests. I think allowing null-type null was a mistake (it was implemented at the beginning of my contribution to Arrow - and I was very naive then).

I think I can send out an issue/pr soon to address the issues discovered here:

  1. The test in question needs to be revised by replacing null-type null with boolean null, as mentioned in my previous comment (so it will pass on big-endian platforms);
  2. The swiss join code need to be updated by not allowing null-type.
  3. Add DCHECKs to enforce the filter expression checking. (optional)

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.

I filed #48268 to address this problem and I'll work on a PR very soon. Once it's fixed, there shouldn't be failures of this test on big-endian platforms. So as I mentioned before, this part of change is not need (and not quite correct). Thanks.

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.

Should be fixed by #48272 . @Vishwanatha-HD Could you first revert the change to hash_join.cc then rebase main to see if the hash join test is passing on big-endian? Thanks.

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

@zanmato1984.. I tried reverting my changes done to hash_join.cc.. With the latest main, the testcase is passing on the big-endian machine..

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.

That's great, thanks for the update!

Comment threadcpp/src/arrow/ipc/message_internal_test.cc Outdated
@Vishwanatha-HD

Copy link
Copy Markdown
ContributorAuthor

Could you fix lint failure?

I have fixed the lint failures. Thanks..

@Vishwanatha-HDVishwanatha-HD left a comment

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

I have taken care of the review comments and made necessary changes to the code. Pls review my changes. Thanks..

@kiszk

Copy link
Copy Markdown
Member

Could you remove [Parquet] from the title? I think that this is not a Parquet-specific issue.

Comment on lines +80 to +81
// On Big-endian systems, FlatBuffer serialization can produce slightly different
// output across different platforms and toolchains.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Er, ok, but there is a well-defined explanation to this: a Arrow schema has an endianness attached to it, and it defaults to the platform's endianness.

To obey the intent of this test case, you should instead change the schema instantiation above to:

auto schema = ::arrow::schema({f0}, Endianness::Little, metadata);

Does this change solve the issue on s390x?

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

@pitrou.. Thanks for your review comments. But this change didnt quite resolve the issue. Thanks..

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@Vishwanatha-HD You're right, but that should be fixed once #48239 is merged. So I would recommend waiting for that.

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

@pitrou.. With the #48239 getting merged into main, I tried making the changes to schema as you suggested above, but the testcase is not passing on s390x..

./debug/arrow-ipc-message-internal-test --gtest_filter="TestMessageInternal.TestByteIdentical"
Running main() from gmock_main.cc
Note: Google Test filter = TestMessageInternal.TestByteIdentical
[==========] Running 1 test from 1 test suite.
[----------] Global test environment set-up.
[----------] 1 test from TestMessageInternal
[ RUN ] TestMessageInternal.TestByteIdentical
arrow/cpp/src/arrow/testing/gtest_util.cc:241: Failure
Expected equality of these values:
buffer.size()
Which is: 228
expected.size()
Which is: 232
Mismatching buffer size

[ FAILED ] TestMessageInternal.TestByteIdentical (1 ms)
[----------] 1 test from TestMessageInternal (1 ms total)

[----------] Global test environment tear-down
[==========] 1 test from 1 test suite ran. (1 ms total)
[ PASSED ] 0 tests.
[ FAILED ] 1 test, listed below:
[ FAILED ] TestMessageInternal.TestByteIdentical

1 FAILED TEST

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@Vishwanatha-HD You must also undo your own changes.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think it's enough to only test Endianness::Little. Roundtripping is tested elsewhere.

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

Ok.. sure.. I will make the necessary changes and push the code again.. Thanks for your comments @pitrou.. !!

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

@pitrou, as per our discussion yesterday, I have made the necessary changes to message_internal_test.cc file to only test Endianness::Little.. I have reverted the code that I added for BE architecture. Thanks..

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@Vishwanatha-HD Are you sure you pushed your changes? I see lots of CI failures.

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

@pitrou.. Apologies.. It was my bad that I had both Endianness in the for loop.. I have made the necessary code changes and pushed the changes again.. Thanks for pointing this out.. !!

@pitrou

Copy link
Copy Markdown
Member

Also see #48239

@Vishwanatha-HD

Vishwanatha-HD commented Nov 24, 2025

Copy link
Copy Markdown
ContributorAuthor

Could you remove [Parquet] from the title? I think that this is not a Parquet-specific issue.

Hi @kiszk.. My idea of having the Parquet is that the overall changes are intended for Parquet component and in order to enable support to Parquet DB on s390x..

@github-actionsgithub-actionsBot added awaiting changes Awaiting changes and removed awaiting committer review Awaiting committer review labels Nov 24, 2025
Comment threadcpp/src/arrow/acero/hash_join.cc Outdated
@kiszk

Copy link
Copy Markdown
Member

Could you remove [Parquet] from the title? I think that this is not a Parquet-specific issue.

Hi @kiszk.. My idea of having the Parquet is that the overall changes are intended for Parquet component and in order to enable support to Parquet DB on s390x..

I understand your idea. On the other hand, this test case is not for Parquet. The current title may confuse others.

@Vishwanatha-HDVishwanatha-HD left a comment

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

I have addressed all the review comments. Thanks.

@pitrou

Copy link
Copy Markdown
Member

Hey @Vishwanatha-HD I have two requests:

  1. can you rebase/merge the latest git main into this?
  2. Please don't mark discussions as resolved as soon as you have answered them; they should only be marked resolved if there is common agreement that there's nothing to add

@Vishwanatha-HD

Vishwanatha-HD commented Nov 26, 2025

Copy link
Copy Markdown
ContributorAuthor

Hey @Vishwanatha-HD I have two requests:

  1. can you rebase/merge the latest git main into this?
  2. Please don't mark discussions as resolved as soon as you have answered them; they should only be marked resolved if there is common agreement that there's nothing to add

Hi @pitrou.. Sure.. I will do the rebase with the latest git main and get the latest changes into this..
Also, I am sorry for marking the discussions resolved, as I thought I should close it as soon as I work on it & resolve it..

@github-actionsgithub-actionsBot added awaiting change review Awaiting change review and removed awaiting changes Awaiting changes labels Nov 26, 2025
@Vishwanatha-HD

Copy link
Copy Markdown
ContributorAuthor

Hey @Vishwanatha-HD I have two requests:

  1. can you rebase/merge the latest git main into this?
  2. Please don't mark discussions as resolved as soon as you have answered them; they should only be marked resolved if there is common agreement that there's nothing to add

Hi @pitrou.. Sure.. I will do the rebase with the latest git main and get the latest changes into this.. Also, I am sorry for marking the discussions resolved, as I thought I should close it as soon as I work on it & resolve it..

@pitrou.. I did the git rebase to merge the latest git main changes into this..

@Vishwanatha-HD

Copy link
Copy Markdown
ContributorAuthor

With the changes done as part of #48272, the latest main works fine without the hash_join.cc changes on big-endian architecture.. Hence reverting the changes done as part of this PR..

@pitrou

Copy link
Copy Markdown
Member

Also, please fix the PR title and description to match the PR contents.

@Vishwanatha-HDVishwanatha-HD changed the title GH-48176: [C++][Parquet] Fix arrow-ipc-message-internal-test & arrow-acero-hash-join-node-test failuresGH-48176: [C++][Parquet] Fix arrow-ipc-message-internal-test failureDec 4, 2025
@Vishwanatha-HD

Copy link
Copy Markdown
ContributorAuthor

Also, please fix the PR title and description to match the PR contents.

@pitrou.. I have fixed the PR title and the description to match the PR contents as you rightly pointed out.. Thanks for that.. !!

@Vishwanatha-HD
Vishwanatha-HDforce-pushed the fixParqIssues1 branch 2 times, most recently from 758836a to b567a59CompareDecember 5, 2025 05:29

@pitroupitrou left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, I'll just wait for CI before merging

@pitrou
pitrou merged commit 01bc1bd into apache:mainDec 8, 2025
44 of 46 checks passed
@pitroupitrou removed the awaiting change review Awaiting change review label Dec 8, 2025
@conbench-apache-arrow

Copy link
Copy Markdown

After merging your PR, Conbench analyzed the 3 benchmarking runs that have been run so far on merge-commit 01bc1bd.

There were no benchmark performance regressions. 🎉

The full Conbench report has more details. It also includes information about 2 possible false positives for unstable benchmarks that are known to sometimes produce them.

Mottl pushed a commit to Mottl/arrow that referenced this pull request May 26, 2026
…ilure (apache#48166)
**Rationale for this change**
Fix `arrow-ipc-message-internal-test` on big endian systems by passing endianness explicitly.
**Are these changes tested?**
Yes. The changes are tested on s390x arch to make sure things are working fine. The fix is also tested on x86 arch, to make sure there is no new regression introduced.
**Are there any user-facing changes?**
No
* GitHub main Issue link: apache#48151
* GitHub Issue: apache#48176
Lead-authored-by: Vishwanatha-HD <Vishwanatha.HD@ibm.com>
Co-authored-by: Antoine Pitrou <antoine@python.org>
Signed-off-by: Antoine Pitrou <antoine@python.org>
Sign up for freeto 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.

5 participants

@Vishwanatha-HD@kiszk@pitrou@kou@zanmato1984
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Auto-enable theater mode on YouTube\n(function() {\n function tryTheater() {\n var btn = document.querySelector('button[aria-label=\"Theater mode\"], ytd-player #player button[title=\"Theater mode\"]');\n if (btn && !btn.classList.contains('activated')) {\n btn.click();\n }\n }\n \n // Try immediately\n tryTheater();\n \n // Try after navigation (SPA)\n var lastUrl = location.href;\n setInterval(function() {\n if (location.href !== lastUrl) {\n lastUrl = location.href;\n setTimeout(tryTheater, 500);\n }\n }, 1000);\n \n // Also try on player load\n var observer = new MutationObserver(tryTheater);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "YouTube Theater Mode Default"); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

GH-48176: [C++][Parquet] Fix arrow-ipc-message-internal-test failure - #48166

Merged
pitrou merged 2 commits into
apache:mainfrom
Vishwanatha-HD:fixParqIssues1
Dec 8, 2025
Merged

GH-48176: [C++][Parquet] Fix arrow-ipc-message-internal-test failure#48166
pitrou merged 2 commits into
apache:mainfrom
Vishwanatha-HD:fixParqIssues1

Conversation

@Vishwanatha-HD

@Vishwanatha-HDVishwanatha-HD commented Nov 18, 2025

Copy link
Copy Markdown
Contributor

Rationale for this change

Fix arrow-ipc-message-internal-test on big endian systems by passing endianness explicitly.

Are these changes tested?

Yes. The changes are tested on s390x arch to make sure things are working fine. The fix is also tested on x86 arch, to make sure there is no new regression introduced.

Are there any user-facing changes?

No

@koukou changed the title GH-48151: [C++][Parquet] Fix arrow-ipc-message-internal-test & arrow-…GH-48166: [C++][Parquet] Fix arrow-ipc-message-internal-test & arrow-acero-hash-join-node-test failuresNov 19, 2025
@github-actions

Copy link
Copy Markdown

⚠️ GitHub issue #48166has been automatically assigned in GitHub to PR creator.

@koukou changed the title GH-48166: [C++][Parquet] Fix arrow-ipc-message-internal-test & arrow-acero-hash-join-node-test failuresGH-48176: [C++][Parquet] Fix arrow-ipc-message-internal-test & arrow-acero-hash-join-node-test failuresNov 19, 2025

@koukou left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Could you fix lint failure?

Comment threadcpp/src/arrow/acero/hash_join.cc Outdated
Comment on lines +316 to +317
// Check if the scalar is a BooleanScalar before casting
if (mask.scalar()->type->id() == Type::BOOL) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why do we need this check? This check didn't exist in the existing code.

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

@kou,
Please find the root cause of this issue on s390x platform below:

The test was failing with a std::bad_cast exception in the ProbeBatch_ResidualFilter function in hash_join.cc at line 309. The issue occurred when the code tried to cast a Datum's scalar to a BooleanScalar using:

const auto& mask_scalar = mask.scalar_as();

The problem was that the test uses literal(NullScalar()) as one of the filter expressions, which creates a NullScalar (of type NullType), not a BooleanScalar (of type BoolType). When the code tried to cast this to a BooleanScalar, it failed with std::bad_cast on s390x architecture

The Fix
I modified the ProbeBatch_ResidualFilter function to check the scalar's type before attempting the cast

@kiszkkiszkNov 24, 2025

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@Vishwanatha-HD I think that this change makes sense for both platforms: big and little endians. We do not need to use #if ... #else ... #endif.

Or, should we fix BooleanScalar to avoid throwing std::bad_cast? cc @pitrou

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.

This is a very detailed explanation. Thanks @Vishwanatha-HD .

As the author of the questioning test, I can say this is the issue of the test rather than of the hash join code. That is, using an filter expression evaluating to null-type null is invalid - it should be a boolean null. The hash join code itself arbitrarily assuming the expression being boolean is OK, though a DCHECK_EQ(mask.type()->id(), Type::BOOL) would be more preferable.

I think we should in turn fix the test by simply replacing the literal(NullScalar()) with a boolean null - literal(MakeNullScalar(boolean()))

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.

But one question remains: The test should be equally problematic for little-endian as well. Why is it passing?

I'm now looking into it.

@zanmato1984zanmato1984Nov 24, 2025

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.

OK, mystery solved: there are two implementations of hash join - regular and swiss. The regular one has wider range of supported types and platforms (including big-endian). The swiss one is more efficient, but restrictive in supported types and platform (only little-endian). So on big endian platform, the regular one is chosen which is more strict on filter expression type. Little-endian platform uses the swiss one which is less strict on filter expression type by explicitly allowing a null-type null - so our CI, always ran on little-endian platforms, has always been passing.

I'm the author of supporting residual filter in swiss join as well as the tests. I think allowing null-type null was a mistake (it was implemented at the beginning of my contribution to Arrow - and I was very naive then).

I think I can send out an issue/pr soon to address the issues discovered here:

  1. The test in question needs to be revised by replacing null-type null with boolean null, as mentioned in my previous comment (so it will pass on big-endian platforms);
  2. The swiss join code need to be updated by not allowing null-type.
  3. Add DCHECKs to enforce the filter expression checking. (optional)

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.

I filed #48268 to address this problem and I'll work on a PR very soon. Once it's fixed, there shouldn't be failures of this test on big-endian platforms. So as I mentioned before, this part of change is not need (and not quite correct). Thanks.

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.

Should be fixed by #48272 . @Vishwanatha-HD Could you first revert the change to hash_join.cc then rebase main to see if the hash join test is passing on big-endian? Thanks.

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

@zanmato1984.. I tried reverting my changes done to hash_join.cc.. With the latest main, the testcase is passing on the big-endian machine..

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.

That's great, thanks for the update!

Comment threadcpp/src/arrow/ipc/message_internal_test.cc Outdated
@Vishwanatha-HD

Copy link
Copy Markdown
ContributorAuthor

Could you fix lint failure?

I have fixed the lint failures. Thanks..

@Vishwanatha-HDVishwanatha-HD left a comment

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

I have taken care of the review comments and made necessary changes to the code. Pls review my changes. Thanks..

@kiszk

Copy link
Copy Markdown
Member

Could you remove [Parquet] from the title? I think that this is not a Parquet-specific issue.

Comment on lines +80 to +81
// On Big-endian systems, FlatBuffer serialization can produce slightly different
// output across different platforms and toolchains.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Er, ok, but there is a well-defined explanation to this: a Arrow schema has an endianness attached to it, and it defaults to the platform's endianness.

To obey the intent of this test case, you should instead change the schema instantiation above to:

auto schema = ::arrow::schema({f0}, Endianness::Little, metadata);

Does this change solve the issue on s390x?

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

@pitrou.. Thanks for your review comments. But this change didnt quite resolve the issue. Thanks..

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@Vishwanatha-HD You're right, but that should be fixed once #48239 is merged. So I would recommend waiting for that.

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

@pitrou.. With the #48239 getting merged into main, I tried making the changes to schema as you suggested above, but the testcase is not passing on s390x..

./debug/arrow-ipc-message-internal-test --gtest_filter="TestMessageInternal.TestByteIdentical"
Running main() from gmock_main.cc
Note: Google Test filter = TestMessageInternal.TestByteIdentical
[==========] Running 1 test from 1 test suite.
[----------] Global test environment set-up.
[----------] 1 test from TestMessageInternal
[ RUN ] TestMessageInternal.TestByteIdentical
arrow/cpp/src/arrow/testing/gtest_util.cc:241: Failure
Expected equality of these values:
buffer.size()
Which is: 228
expected.size()
Which is: 232
Mismatching buffer size

[ FAILED ] TestMessageInternal.TestByteIdentical (1 ms)
[----------] 1 test from TestMessageInternal (1 ms total)

[----------] Global test environment tear-down
[==========] 1 test from 1 test suite ran. (1 ms total)
[ PASSED ] 0 tests.
[ FAILED ] 1 test, listed below:
[ FAILED ] TestMessageInternal.TestByteIdentical

1 FAILED TEST

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@Vishwanatha-HD You must also undo your own changes.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think it's enough to only test Endianness::Little. Roundtripping is tested elsewhere.

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

Ok.. sure.. I will make the necessary changes and push the code again.. Thanks for your comments @pitrou.. !!

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

@pitrou, as per our discussion yesterday, I have made the necessary changes to message_internal_test.cc file to only test Endianness::Little.. I have reverted the code that I added for BE architecture. Thanks..

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@Vishwanatha-HD Are you sure you pushed your changes? I see lots of CI failures.

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

@pitrou.. Apologies.. It was my bad that I had both Endianness in the for loop.. I have made the necessary code changes and pushed the changes again.. Thanks for pointing this out.. !!

@pitrou

Copy link
Copy Markdown
Member

Also see #48239

@Vishwanatha-HD

Vishwanatha-HD commented Nov 24, 2025

Copy link
Copy Markdown
ContributorAuthor

Could you remove [Parquet] from the title? I think that this is not a Parquet-specific issue.

Hi @kiszk.. My idea of having the Parquet is that the overall changes are intended for Parquet component and in order to enable support to Parquet DB on s390x..

@github-actionsgithub-actionsBot added awaiting changes Awaiting changes and removed awaiting committer review Awaiting committer review labels Nov 24, 2025
Comment threadcpp/src/arrow/acero/hash_join.cc Outdated
@kiszk

Copy link
Copy Markdown
Member

Could you remove [Parquet] from the title? I think that this is not a Parquet-specific issue.

Hi @kiszk.. My idea of having the Parquet is that the overall changes are intended for Parquet component and in order to enable support to Parquet DB on s390x..

I understand your idea. On the other hand, this test case is not for Parquet. The current title may confuse others.

@Vishwanatha-HDVishwanatha-HD left a comment

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

I have addressed all the review comments. Thanks.

@pitrou

Copy link
Copy Markdown
Member

Hey @Vishwanatha-HD I have two requests:

  1. can you rebase/merge the latest git main into this?
  2. Please don't mark discussions as resolved as soon as you have answered them; they should only be marked resolved if there is common agreement that there's nothing to add

@Vishwanatha-HD

Vishwanatha-HD commented Nov 26, 2025

Copy link
Copy Markdown
ContributorAuthor

Hey @Vishwanatha-HD I have two requests:

  1. can you rebase/merge the latest git main into this?
  2. Please don't mark discussions as resolved as soon as you have answered them; they should only be marked resolved if there is common agreement that there's nothing to add

Hi @pitrou.. Sure.. I will do the rebase with the latest git main and get the latest changes into this..
Also, I am sorry for marking the discussions resolved, as I thought I should close it as soon as I work on it & resolve it..

@github-actionsgithub-actionsBot added awaiting change review Awaiting change review and removed awaiting changes Awaiting changes labels Nov 26, 2025
@Vishwanatha-HD

Copy link
Copy Markdown
ContributorAuthor

Hey @Vishwanatha-HD I have two requests:

  1. can you rebase/merge the latest git main into this?
  2. Please don't mark discussions as resolved as soon as you have answered them; they should only be marked resolved if there is common agreement that there's nothing to add

Hi @pitrou.. Sure.. I will do the rebase with the latest git main and get the latest changes into this.. Also, I am sorry for marking the discussions resolved, as I thought I should close it as soon as I work on it & resolve it..

@pitrou.. I did the git rebase to merge the latest git main changes into this..

@Vishwanatha-HD

Copy link
Copy Markdown
ContributorAuthor

With the changes done as part of #48272, the latest main works fine without the hash_join.cc changes on big-endian architecture.. Hence reverting the changes done as part of this PR..

@pitrou

Copy link
Copy Markdown
Member

Also, please fix the PR title and description to match the PR contents.

@Vishwanatha-HDVishwanatha-HD changed the title GH-48176: [C++][Parquet] Fix arrow-ipc-message-internal-test & arrow-acero-hash-join-node-test failuresGH-48176: [C++][Parquet] Fix arrow-ipc-message-internal-test failureDec 4, 2025
@Vishwanatha-HD

Copy link
Copy Markdown
ContributorAuthor

Also, please fix the PR title and description to match the PR contents.

@pitrou.. I have fixed the PR title and the description to match the PR contents as you rightly pointed out.. Thanks for that.. !!

@Vishwanatha-HD
Vishwanatha-HDforce-pushed the fixParqIssues1 branch 2 times, most recently from 758836a to b567a59CompareDecember 5, 2025 05:29

@pitroupitrou left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, I'll just wait for CI before merging

@pitrou
pitrou merged commit 01bc1bd into apache:mainDec 8, 2025
44 of 46 checks passed
@pitroupitrou removed the awaiting change review Awaiting change review label Dec 8, 2025
@conbench-apache-arrow

Copy link
Copy Markdown

After merging your PR, Conbench analyzed the 3 benchmarking runs that have been run so far on merge-commit 01bc1bd.

There were no benchmark performance regressions. 🎉

The full Conbench report has more details. It also includes information about 2 possible false positives for unstable benchmarks that are known to sometimes produce them.

Mottl pushed a commit to Mottl/arrow that referenced this pull request May 26, 2026
…ilure (apache#48166)
**Rationale for this change**
Fix `arrow-ipc-message-internal-test` on big endian systems by passing endianness explicitly.
**Are these changes tested?**
Yes. The changes are tested on s390x arch to make sure things are working fine. The fix is also tested on x86 arch, to make sure there is no new regression introduced.
**Are there any user-facing changes?**
No
* GitHub main Issue link: apache#48151
* GitHub Issue: apache#48176
Lead-authored-by: Vishwanatha-HD <Vishwanatha.HD@ibm.com>
Co-authored-by: Antoine Pitrou <antoine@python.org>
Signed-off-by: Antoine Pitrou <antoine@python.org>
Sign up for freeto 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.

5 participants

@Vishwanatha-HD@kiszk@pitrou@kou@zanmato1984
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Remove or un-stick sticky/fixed headers that block content\n(function() {\n function unstick() {\n document.querySelectorAll('header, nav, [role=\"banner\"], .header, .navbar, .sticky, .fixed-top, [style*=\"position: fixed\"], [style*=\"position:sticky\"]').forEach(function(el) {\n if (el.style.position === 'fixed' || el.style.position === 'sticky' || \n getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') {\n el.style.position = 'static';\n el.style.top = 'auto';\n el.style.zIndex = 'auto';\n }\n });\n }\n \n unstick();\n \n var observer = new MutationObserver(unstick);\n observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] });\n})();", "Kill Sticky Headers"); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

GH-48176: [C++][Parquet] Fix arrow-ipc-message-internal-test failure - #48166

Merged
pitrou merged 2 commits into
apache:mainfrom
Vishwanatha-HD:fixParqIssues1
Dec 8, 2025
Merged

GH-48176: [C++][Parquet] Fix arrow-ipc-message-internal-test failure#48166
pitrou merged 2 commits into
apache:mainfrom
Vishwanatha-HD:fixParqIssues1

Conversation

@Vishwanatha-HD

@Vishwanatha-HDVishwanatha-HD commented Nov 18, 2025

Copy link
Copy Markdown
Contributor

Rationale for this change

Fix arrow-ipc-message-internal-test on big endian systems by passing endianness explicitly.

Are these changes tested?

Yes. The changes are tested on s390x arch to make sure things are working fine. The fix is also tested on x86 arch, to make sure there is no new regression introduced.

Are there any user-facing changes?

No

@koukou changed the title GH-48151: [C++][Parquet] Fix arrow-ipc-message-internal-test & arrow-…GH-48166: [C++][Parquet] Fix arrow-ipc-message-internal-test & arrow-acero-hash-join-node-test failuresNov 19, 2025
@github-actions

Copy link
Copy Markdown

⚠️ GitHub issue #48166has been automatically assigned in GitHub to PR creator.

@koukou changed the title GH-48166: [C++][Parquet] Fix arrow-ipc-message-internal-test & arrow-acero-hash-join-node-test failuresGH-48176: [C++][Parquet] Fix arrow-ipc-message-internal-test & arrow-acero-hash-join-node-test failuresNov 19, 2025

@koukou left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Could you fix lint failure?

Comment threadcpp/src/arrow/acero/hash_join.cc Outdated
Comment on lines +316 to +317
// Check if the scalar is a BooleanScalar before casting
if (mask.scalar()->type->id() == Type::BOOL) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why do we need this check? This check didn't exist in the existing code.

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

@kou,
Please find the root cause of this issue on s390x platform below:

The test was failing with a std::bad_cast exception in the ProbeBatch_ResidualFilter function in hash_join.cc at line 309. The issue occurred when the code tried to cast a Datum's scalar to a BooleanScalar using:

const auto& mask_scalar = mask.scalar_as();

The problem was that the test uses literal(NullScalar()) as one of the filter expressions, which creates a NullScalar (of type NullType), not a BooleanScalar (of type BoolType). When the code tried to cast this to a BooleanScalar, it failed with std::bad_cast on s390x architecture

The Fix
I modified the ProbeBatch_ResidualFilter function to check the scalar's type before attempting the cast

@kiszkkiszkNov 24, 2025

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@Vishwanatha-HD I think that this change makes sense for both platforms: big and little endians. We do not need to use #if ... #else ... #endif.

Or, should we fix BooleanScalar to avoid throwing std::bad_cast? cc @pitrou

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.

This is a very detailed explanation. Thanks @Vishwanatha-HD .

As the author of the questioning test, I can say this is the issue of the test rather than of the hash join code. That is, using an filter expression evaluating to null-type null is invalid - it should be a boolean null. The hash join code itself arbitrarily assuming the expression being boolean is OK, though a DCHECK_EQ(mask.type()->id(), Type::BOOL) would be more preferable.

I think we should in turn fix the test by simply replacing the literal(NullScalar()) with a boolean null - literal(MakeNullScalar(boolean()))

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.

But one question remains: The test should be equally problematic for little-endian as well. Why is it passing?

I'm now looking into it.

@zanmato1984zanmato1984Nov 24, 2025

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.

OK, mystery solved: there are two implementations of hash join - regular and swiss. The regular one has wider range of supported types and platforms (including big-endian). The swiss one is more efficient, but restrictive in supported types and platform (only little-endian). So on big endian platform, the regular one is chosen which is more strict on filter expression type. Little-endian platform uses the swiss one which is less strict on filter expression type by explicitly allowing a null-type null - so our CI, always ran on little-endian platforms, has always been passing.

I'm the author of supporting residual filter in swiss join as well as the tests. I think allowing null-type null was a mistake (it was implemented at the beginning of my contribution to Arrow - and I was very naive then).

I think I can send out an issue/pr soon to address the issues discovered here:

  1. The test in question needs to be revised by replacing null-type null with boolean null, as mentioned in my previous comment (so it will pass on big-endian platforms);
  2. The swiss join code need to be updated by not allowing null-type.
  3. Add DCHECKs to enforce the filter expression checking. (optional)

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.

I filed #48268 to address this problem and I'll work on a PR very soon. Once it's fixed, there shouldn't be failures of this test on big-endian platforms. So as I mentioned before, this part of change is not need (and not quite correct). Thanks.

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.

Should be fixed by #48272 . @Vishwanatha-HD Could you first revert the change to hash_join.cc then rebase main to see if the hash join test is passing on big-endian? Thanks.

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

@zanmato1984.. I tried reverting my changes done to hash_join.cc.. With the latest main, the testcase is passing on the big-endian machine..

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.

That's great, thanks for the update!

Comment threadcpp/src/arrow/ipc/message_internal_test.cc Outdated
@Vishwanatha-HD

Copy link
Copy Markdown
ContributorAuthor

Could you fix lint failure?

I have fixed the lint failures. Thanks..

@Vishwanatha-HDVishwanatha-HD left a comment

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

I have taken care of the review comments and made necessary changes to the code. Pls review my changes. Thanks..

@kiszk

Copy link
Copy Markdown
Member

Could you remove [Parquet] from the title? I think that this is not a Parquet-specific issue.

Comment on lines +80 to +81
// On Big-endian systems, FlatBuffer serialization can produce slightly different
// output across different platforms and toolchains.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Er, ok, but there is a well-defined explanation to this: a Arrow schema has an endianness attached to it, and it defaults to the platform's endianness.

To obey the intent of this test case, you should instead change the schema instantiation above to:

auto schema = ::arrow::schema({f0}, Endianness::Little, metadata);

Does this change solve the issue on s390x?

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

@pitrou.. Thanks for your review comments. But this change didnt quite resolve the issue. Thanks..

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@Vishwanatha-HD You're right, but that should be fixed once #48239 is merged. So I would recommend waiting for that.

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

@pitrou.. With the #48239 getting merged into main, I tried making the changes to schema as you suggested above, but the testcase is not passing on s390x..

./debug/arrow-ipc-message-internal-test --gtest_filter="TestMessageInternal.TestByteIdentical"
Running main() from gmock_main.cc
Note: Google Test filter = TestMessageInternal.TestByteIdentical
[==========] Running 1 test from 1 test suite.
[----------] Global test environment set-up.
[----------] 1 test from TestMessageInternal
[ RUN ] TestMessageInternal.TestByteIdentical
arrow/cpp/src/arrow/testing/gtest_util.cc:241: Failure
Expected equality of these values:
buffer.size()
Which is: 228
expected.size()
Which is: 232
Mismatching buffer size

[ FAILED ] TestMessageInternal.TestByteIdentical (1 ms)
[----------] 1 test from TestMessageInternal (1 ms total)

[----------] Global test environment tear-down
[==========] 1 test from 1 test suite ran. (1 ms total)
[ PASSED ] 0 tests.
[ FAILED ] 1 test, listed below:
[ FAILED ] TestMessageInternal.TestByteIdentical

1 FAILED TEST

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@Vishwanatha-HD You must also undo your own changes.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think it's enough to only test Endianness::Little. Roundtripping is tested elsewhere.

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

Ok.. sure.. I will make the necessary changes and push the code again.. Thanks for your comments @pitrou.. !!

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

@pitrou, as per our discussion yesterday, I have made the necessary changes to message_internal_test.cc file to only test Endianness::Little.. I have reverted the code that I added for BE architecture. Thanks..

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@Vishwanatha-HD Are you sure you pushed your changes? I see lots of CI failures.

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

@pitrou.. Apologies.. It was my bad that I had both Endianness in the for loop.. I have made the necessary code changes and pushed the changes again.. Thanks for pointing this out.. !!

@pitrou

Copy link
Copy Markdown
Member

Also see #48239

@Vishwanatha-HD

Vishwanatha-HD commented Nov 24, 2025

Copy link
Copy Markdown
ContributorAuthor

Could you remove [Parquet] from the title? I think that this is not a Parquet-specific issue.

Hi @kiszk.. My idea of having the Parquet is that the overall changes are intended for Parquet component and in order to enable support to Parquet DB on s390x..

@github-actionsgithub-actionsBot added awaiting changes Awaiting changes and removed awaiting committer review Awaiting committer review labels Nov 24, 2025
Comment threadcpp/src/arrow/acero/hash_join.cc Outdated
@kiszk

Copy link
Copy Markdown
Member

Could you remove [Parquet] from the title? I think that this is not a Parquet-specific issue.

Hi @kiszk.. My idea of having the Parquet is that the overall changes are intended for Parquet component and in order to enable support to Parquet DB on s390x..

I understand your idea. On the other hand, this test case is not for Parquet. The current title may confuse others.

@Vishwanatha-HDVishwanatha-HD left a comment

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

I have addressed all the review comments. Thanks.

@pitrou

Copy link
Copy Markdown
Member

Hey @Vishwanatha-HD I have two requests:

  1. can you rebase/merge the latest git main into this?
  2. Please don't mark discussions as resolved as soon as you have answered them; they should only be marked resolved if there is common agreement that there's nothing to add

@Vishwanatha-HD

Vishwanatha-HD commented Nov 26, 2025

Copy link
Copy Markdown
ContributorAuthor

Hey @Vishwanatha-HD I have two requests:

  1. can you rebase/merge the latest git main into this?
  2. Please don't mark discussions as resolved as soon as you have answered them; they should only be marked resolved if there is common agreement that there's nothing to add

Hi @pitrou.. Sure.. I will do the rebase with the latest git main and get the latest changes into this..
Also, I am sorry for marking the discussions resolved, as I thought I should close it as soon as I work on it & resolve it..

@github-actionsgithub-actionsBot added awaiting change review Awaiting change review and removed awaiting changes Awaiting changes labels Nov 26, 2025
@Vishwanatha-HD

Copy link
Copy Markdown
ContributorAuthor

Hey @Vishwanatha-HD I have two requests:

  1. can you rebase/merge the latest git main into this?
  2. Please don't mark discussions as resolved as soon as you have answered them; they should only be marked resolved if there is common agreement that there's nothing to add

Hi @pitrou.. Sure.. I will do the rebase with the latest git main and get the latest changes into this.. Also, I am sorry for marking the discussions resolved, as I thought I should close it as soon as I work on it & resolve it..

@pitrou.. I did the git rebase to merge the latest git main changes into this..

@Vishwanatha-HD

Copy link
Copy Markdown
ContributorAuthor

With the changes done as part of #48272, the latest main works fine without the hash_join.cc changes on big-endian architecture.. Hence reverting the changes done as part of this PR..

@pitrou

Copy link
Copy Markdown
Member

Also, please fix the PR title and description to match the PR contents.

@Vishwanatha-HDVishwanatha-HD changed the title GH-48176: [C++][Parquet] Fix arrow-ipc-message-internal-test & arrow-acero-hash-join-node-test failuresGH-48176: [C++][Parquet] Fix arrow-ipc-message-internal-test failureDec 4, 2025
@Vishwanatha-HD

Copy link
Copy Markdown
ContributorAuthor

Also, please fix the PR title and description to match the PR contents.

@pitrou.. I have fixed the PR title and the description to match the PR contents as you rightly pointed out.. Thanks for that.. !!

@Vishwanatha-HD
Vishwanatha-HDforce-pushed the fixParqIssues1 branch 2 times, most recently from 758836a to b567a59CompareDecember 5, 2025 05:29

@pitroupitrou left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, I'll just wait for CI before merging

@pitrou
pitrou merged commit 01bc1bd into apache:mainDec 8, 2025
44 of 46 checks passed
@pitroupitrou removed the awaiting change review Awaiting change review label Dec 8, 2025
@conbench-apache-arrow

Copy link
Copy Markdown

After merging your PR, Conbench analyzed the 3 benchmarking runs that have been run so far on merge-commit 01bc1bd.

There were no benchmark performance regressions. 🎉

The full Conbench report has more details. It also includes information about 2 possible false positives for unstable benchmarks that are known to sometimes produce them.

Mottl pushed a commit to Mottl/arrow that referenced this pull request May 26, 2026
…ilure (apache#48166)
**Rationale for this change**
Fix `arrow-ipc-message-internal-test` on big endian systems by passing endianness explicitly.
**Are these changes tested?**
Yes. The changes are tested on s390x arch to make sure things are working fine. The fix is also tested on x86 arch, to make sure there is no new regression introduced.
**Are there any user-facing changes?**
No
* GitHub main Issue link: apache#48151
* GitHub Issue: apache#48176
Lead-authored-by: Vishwanatha-HD <Vishwanatha.HD@ibm.com>
Co-authored-by: Antoine Pitrou <antoine@python.org>
Signed-off-by: Antoine Pitrou <antoine@python.org>
Sign up for freeto 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.

5 participants

@Vishwanatha-HD@kiszk@pitrou@kou@zanmato1984
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Universal Dark Mode - works on any site\n(function() {\n var enabled = true;\n \n function applyDarkMode() {\n if (!enabled) return;\n \n // Create style element if it doesn't exist\n var style = document.getElementById('universal-dark-mode-style');\n if (!style) {\n style = document.createElement('style');\n style.id = 'universal-dark-mode-style';\n document.head.appendChild(style);\n }\n \n // Dark mode CSS - inverts colors but preserves images/video\n style.textContent = '\n /* Invert everything except media */\n html {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #1a1a2e !important;\n }\n \n /* Restore images, videos, iframes, canvas */\n img, video, iframe, canvas, svg, picture, [style*=\"background-image\"] {\n filter: invert(1) hue-rotate(180deg) !important;\n }\n \n /* Preserve specific elements that should not be inverted */\n .no-dark-mode, .no-dark-mode *,\n [data-theme=\"light\"], [data-theme=\"light\"],\n .ace_editor, .ace_editor *,\n .CodeMirror, .CodeMirror *,\n .monaco-editor, .monaco-editor *,\n .markdown-body pre, .markdown-body pre *,\n .highlight, .highlight *,\n pre code, pre code * {\n filter: none !important;\n }\n \n /* Fix common UI elements */\n .modal, .popup, .dropdown-menu, .tooltip, .popover {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #2d2d44 !important;\n border-color: #444 !important;\n }\n \n /* Scrollbars */\n ::-webkit-scrollbar { background: #1a1a2e !important; }\n ::-webkit-scrollbar-thumb { background: #444 !important; }\n ::-webkit-scrollbar-thumb:hover { background: #555 !important; }\n \n /* Selection */\n ::selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ::-moz-selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ';\n }\n \n function removeDarkMode() {\n var style = document.getElementById('universal-dark-mode-style');\n if (style) style.remove();\n }\n \n // Toggle with Alt+Shift+D\n document.addEventListener('keydown', function(e) {\n if (e.altKey && e.shiftKey && e.key === 'D') {\n e.preventDefault();\n enabled = !enabled;\n if (enabled) {\n applyDarkMode();\n console.log('[Universal Dark Mode] Enabled');\n } else {\n removeDarkMode();\n console.log('[Universal Dark Mode] Disabled');\n }\n }\n });\n \n // Apply on load\n applyDarkMode();\n \n // Re-apply on dynamic content\n var observer = new MutationObserver(function(mutations) {\n if (enabled && !document.getElementById('universal-dark-mode-style')) {\n applyDarkMode();\n }\n });\n observer.observe(document.head, { childList: true });\n \n console.log('[Universal Dark Mode] Loaded - Press Alt+Shift+D to toggle');\n})();", "Universal Dark Mode"); } } catch(__e) { console.warn('[Userscript:Universal Dark Mode]', __e); } })(); })();
Skip to content

GH-48176: [C++][Parquet] Fix arrow-ipc-message-internal-test failure - #48166

Merged
pitrou merged 2 commits into
apache:mainfrom
Vishwanatha-HD:fixParqIssues1
Dec 8, 2025
Merged

GH-48176: [C++][Parquet] Fix arrow-ipc-message-internal-test failure#48166
pitrou merged 2 commits into
apache:mainfrom
Vishwanatha-HD:fixParqIssues1

Conversation

@Vishwanatha-HD

@Vishwanatha-HDVishwanatha-HD commented Nov 18, 2025

Copy link
Copy Markdown
Contributor

Rationale for this change

Fix arrow-ipc-message-internal-test on big endian systems by passing endianness explicitly.

Are these changes tested?

Yes. The changes are tested on s390x arch to make sure things are working fine. The fix is also tested on x86 arch, to make sure there is no new regression introduced.

Are there any user-facing changes?

No

@koukou changed the title GH-48151: [C++][Parquet] Fix arrow-ipc-message-internal-test & arrow-…GH-48166: [C++][Parquet] Fix arrow-ipc-message-internal-test & arrow-acero-hash-join-node-test failuresNov 19, 2025
@github-actions

Copy link
Copy Markdown

⚠️ GitHub issue #48166has been automatically assigned in GitHub to PR creator.

@koukou changed the title GH-48166: [C++][Parquet] Fix arrow-ipc-message-internal-test & arrow-acero-hash-join-node-test failuresGH-48176: [C++][Parquet] Fix arrow-ipc-message-internal-test & arrow-acero-hash-join-node-test failuresNov 19, 2025

@koukou left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Could you fix lint failure?

Comment threadcpp/src/arrow/acero/hash_join.cc Outdated
Comment on lines +316 to +317
// Check if the scalar is a BooleanScalar before casting
if (mask.scalar()->type->id() == Type::BOOL) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why do we need this check? This check didn't exist in the existing code.

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

@kou,
Please find the root cause of this issue on s390x platform below:

The test was failing with a std::bad_cast exception in the ProbeBatch_ResidualFilter function in hash_join.cc at line 309. The issue occurred when the code tried to cast a Datum's scalar to a BooleanScalar using:

const auto& mask_scalar = mask.scalar_as();

The problem was that the test uses literal(NullScalar()) as one of the filter expressions, which creates a NullScalar (of type NullType), not a BooleanScalar (of type BoolType). When the code tried to cast this to a BooleanScalar, it failed with std::bad_cast on s390x architecture

The Fix
I modified the ProbeBatch_ResidualFilter function to check the scalar's type before attempting the cast

@kiszkkiszkNov 24, 2025

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@Vishwanatha-HD I think that this change makes sense for both platforms: big and little endians. We do not need to use #if ... #else ... #endif.

Or, should we fix BooleanScalar to avoid throwing std::bad_cast? cc @pitrou

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.

This is a very detailed explanation. Thanks @Vishwanatha-HD .

As the author of the questioning test, I can say this is the issue of the test rather than of the hash join code. That is, using an filter expression evaluating to null-type null is invalid - it should be a boolean null. The hash join code itself arbitrarily assuming the expression being boolean is OK, though a DCHECK_EQ(mask.type()->id(), Type::BOOL) would be more preferable.

I think we should in turn fix the test by simply replacing the literal(NullScalar()) with a boolean null - literal(MakeNullScalar(boolean()))

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.

But one question remains: The test should be equally problematic for little-endian as well. Why is it passing?

I'm now looking into it.

@zanmato1984zanmato1984Nov 24, 2025

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.

OK, mystery solved: there are two implementations of hash join - regular and swiss. The regular one has wider range of supported types and platforms (including big-endian). The swiss one is more efficient, but restrictive in supported types and platform (only little-endian). So on big endian platform, the regular one is chosen which is more strict on filter expression type. Little-endian platform uses the swiss one which is less strict on filter expression type by explicitly allowing a null-type null - so our CI, always ran on little-endian platforms, has always been passing.

I'm the author of supporting residual filter in swiss join as well as the tests. I think allowing null-type null was a mistake (it was implemented at the beginning of my contribution to Arrow - and I was very naive then).

I think I can send out an issue/pr soon to address the issues discovered here:

  1. The test in question needs to be revised by replacing null-type null with boolean null, as mentioned in my previous comment (so it will pass on big-endian platforms);
  2. The swiss join code need to be updated by not allowing null-type.
  3. Add DCHECKs to enforce the filter expression checking. (optional)

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.

I filed #48268 to address this problem and I'll work on a PR very soon. Once it's fixed, there shouldn't be failures of this test on big-endian platforms. So as I mentioned before, this part of change is not need (and not quite correct). Thanks.

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.

Should be fixed by #48272 . @Vishwanatha-HD Could you first revert the change to hash_join.cc then rebase main to see if the hash join test is passing on big-endian? Thanks.

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

@zanmato1984.. I tried reverting my changes done to hash_join.cc.. With the latest main, the testcase is passing on the big-endian machine..

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.

That's great, thanks for the update!

Comment threadcpp/src/arrow/ipc/message_internal_test.cc Outdated
@Vishwanatha-HD

Copy link
Copy Markdown
ContributorAuthor

Could you fix lint failure?

I have fixed the lint failures. Thanks..

@Vishwanatha-HDVishwanatha-HD left a comment

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

I have taken care of the review comments and made necessary changes to the code. Pls review my changes. Thanks..

@kiszk

Copy link
Copy Markdown
Member

Could you remove [Parquet] from the title? I think that this is not a Parquet-specific issue.

Comment on lines +80 to +81
// On Big-endian systems, FlatBuffer serialization can produce slightly different
// output across different platforms and toolchains.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Er, ok, but there is a well-defined explanation to this: a Arrow schema has an endianness attached to it, and it defaults to the platform's endianness.

To obey the intent of this test case, you should instead change the schema instantiation above to:

auto schema = ::arrow::schema({f0}, Endianness::Little, metadata);

Does this change solve the issue on s390x?

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

@pitrou.. Thanks for your review comments. But this change didnt quite resolve the issue. Thanks..

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@Vishwanatha-HD You're right, but that should be fixed once #48239 is merged. So I would recommend waiting for that.

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

@pitrou.. With the #48239 getting merged into main, I tried making the changes to schema as you suggested above, but the testcase is not passing on s390x..

./debug/arrow-ipc-message-internal-test --gtest_filter="TestMessageInternal.TestByteIdentical"
Running main() from gmock_main.cc
Note: Google Test filter = TestMessageInternal.TestByteIdentical
[==========] Running 1 test from 1 test suite.
[----------] Global test environment set-up.
[----------] 1 test from TestMessageInternal
[ RUN ] TestMessageInternal.TestByteIdentical
arrow/cpp/src/arrow/testing/gtest_util.cc:241: Failure
Expected equality of these values:
buffer.size()
Which is: 228
expected.size()
Which is: 232
Mismatching buffer size

[ FAILED ] TestMessageInternal.TestByteIdentical (1 ms)
[----------] 1 test from TestMessageInternal (1 ms total)

[----------] Global test environment tear-down
[==========] 1 test from 1 test suite ran. (1 ms total)
[ PASSED ] 0 tests.
[ FAILED ] 1 test, listed below:
[ FAILED ] TestMessageInternal.TestByteIdentical

1 FAILED TEST

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@Vishwanatha-HD You must also undo your own changes.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think it's enough to only test Endianness::Little. Roundtripping is tested elsewhere.

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

Ok.. sure.. I will make the necessary changes and push the code again.. Thanks for your comments @pitrou.. !!

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

@pitrou, as per our discussion yesterday, I have made the necessary changes to message_internal_test.cc file to only test Endianness::Little.. I have reverted the code that I added for BE architecture. Thanks..

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@Vishwanatha-HD Are you sure you pushed your changes? I see lots of CI failures.

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

@pitrou.. Apologies.. It was my bad that I had both Endianness in the for loop.. I have made the necessary code changes and pushed the changes again.. Thanks for pointing this out.. !!

@pitrou

Copy link
Copy Markdown
Member

Also see #48239

@Vishwanatha-HD

Vishwanatha-HD commented Nov 24, 2025

Copy link
Copy Markdown
ContributorAuthor

Could you remove [Parquet] from the title? I think that this is not a Parquet-specific issue.

Hi @kiszk.. My idea of having the Parquet is that the overall changes are intended for Parquet component and in order to enable support to Parquet DB on s390x..

@github-actionsgithub-actionsBot added awaiting changes Awaiting changes and removed awaiting committer review Awaiting committer review labels Nov 24, 2025
Comment threadcpp/src/arrow/acero/hash_join.cc Outdated
@kiszk

Copy link
Copy Markdown
Member

Could you remove [Parquet] from the title? I think that this is not a Parquet-specific issue.

Hi @kiszk.. My idea of having the Parquet is that the overall changes are intended for Parquet component and in order to enable support to Parquet DB on s390x..

I understand your idea. On the other hand, this test case is not for Parquet. The current title may confuse others.

@Vishwanatha-HDVishwanatha-HD left a comment

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

I have addressed all the review comments. Thanks.

@pitrou

Copy link
Copy Markdown
Member

Hey @Vishwanatha-HD I have two requests:

  1. can you rebase/merge the latest git main into this?
  2. Please don't mark discussions as resolved as soon as you have answered them; they should only be marked resolved if there is common agreement that there's nothing to add

@Vishwanatha-HD

Vishwanatha-HD commented Nov 26, 2025

Copy link
Copy Markdown
ContributorAuthor

Hey @Vishwanatha-HD I have two requests:

  1. can you rebase/merge the latest git main into this?
  2. Please don't mark discussions as resolved as soon as you have answered them; they should only be marked resolved if there is common agreement that there's nothing to add

Hi @pitrou.. Sure.. I will do the rebase with the latest git main and get the latest changes into this..
Also, I am sorry for marking the discussions resolved, as I thought I should close it as soon as I work on it & resolve it..

@github-actionsgithub-actionsBot added awaiting change review Awaiting change review and removed awaiting changes Awaiting changes labels Nov 26, 2025
@Vishwanatha-HD

Copy link
Copy Markdown
ContributorAuthor

Hey @Vishwanatha-HD I have two requests:

  1. can you rebase/merge the latest git main into this?
  2. Please don't mark discussions as resolved as soon as you have answered them; they should only be marked resolved if there is common agreement that there's nothing to add

Hi @pitrou.. Sure.. I will do the rebase with the latest git main and get the latest changes into this.. Also, I am sorry for marking the discussions resolved, as I thought I should close it as soon as I work on it & resolve it..

@pitrou.. I did the git rebase to merge the latest git main changes into this..

@Vishwanatha-HD

Copy link
Copy Markdown
ContributorAuthor

With the changes done as part of #48272, the latest main works fine without the hash_join.cc changes on big-endian architecture.. Hence reverting the changes done as part of this PR..

@pitrou

Copy link
Copy Markdown
Member

Also, please fix the PR title and description to match the PR contents.

@Vishwanatha-HDVishwanatha-HD changed the title GH-48176: [C++][Parquet] Fix arrow-ipc-message-internal-test & arrow-acero-hash-join-node-test failuresGH-48176: [C++][Parquet] Fix arrow-ipc-message-internal-test failureDec 4, 2025
@Vishwanatha-HD

Copy link
Copy Markdown
ContributorAuthor

Also, please fix the PR title and description to match the PR contents.

@pitrou.. I have fixed the PR title and the description to match the PR contents as you rightly pointed out.. Thanks for that.. !!

@Vishwanatha-HD
Vishwanatha-HDforce-pushed the fixParqIssues1 branch 2 times, most recently from 758836a to b567a59CompareDecember 5, 2025 05:29

@pitroupitrou left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, I'll just wait for CI before merging

@pitrou
pitrou merged commit 01bc1bd into apache:mainDec 8, 2025
44 of 46 checks passed
@pitroupitrou removed the awaiting change review Awaiting change review label Dec 8, 2025
@conbench-apache-arrow

Copy link
Copy Markdown

After merging your PR, Conbench analyzed the 3 benchmarking runs that have been run so far on merge-commit 01bc1bd.

There were no benchmark performance regressions. 🎉

The full Conbench report has more details. It also includes information about 2 possible false positives for unstable benchmarks that are known to sometimes produce them.

Mottl pushed a commit to Mottl/arrow that referenced this pull request May 26, 2026
…ilure (apache#48166)
**Rationale for this change**
Fix `arrow-ipc-message-internal-test` on big endian systems by passing endianness explicitly.
**Are these changes tested?**
Yes. The changes are tested on s390x arch to make sure things are working fine. The fix is also tested on x86 arch, to make sure there is no new regression introduced.
**Are there any user-facing changes?**
No
* GitHub main Issue link: apache#48151
* GitHub Issue: apache#48176
Lead-authored-by: Vishwanatha-HD <Vishwanatha.HD@ibm.com>
Co-authored-by: Antoine Pitrou <antoine@python.org>
Signed-off-by: Antoine Pitrou <antoine@python.org>
Sign up for freeto 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.

5 participants

@Vishwanatha-HD@kiszk@pitrou@kou@zanmato1984