Skip to content

GH-50508: [C++] Support scalar values in AppendScalars#50584

Open
Moemenmohamed24 wants to merge 3 commits into
apache:mainfrom
Moemenmohamed24:GH-50508-append-scalars
Open

GH-50508: [C++] Support scalar values in AppendScalars#50584
Moemenmohamed24 wants to merge 3 commits into
apache:mainfrom
Moemenmohamed24:GH-50508-append-scalars

Conversation

@Moemenmohamed24

@Moemenmohamed24 Moemenmohamed24 commented Jul 21, 2026

Copy link
Copy Markdown

Rationale for this change

RunEndEncodedBuilder::AppendScalar accepts regular scalar values, such as float32 directly. However, RunEndEncodedBuilder::AppendScalars only handled RunEndEncodedScalar values.

This made the two APIs inconsistent. This PR updates AppendScalars to support regular scalar values consistently with AppendScalar.

What changes are included in this PR?

  • Updated RunEndEncodedBuilder::AppendScalars to process each scalar through AppendScalar.
  • Added tests covering regular scalar values and nested RunEndEncodedScalar values.
  • Added tests verifying the expected run ends and values.

Are these changes tested?

Yes. The relevant Run-End Encoded tests pass successfully.

Are there any user-facing changes?

Yes. RunEndEncodedBuilder::AppendScalars now accepts regular scalar values, such as float32, consistently with AppendScalar.

Breaking changes

No

Critical Fix

No.

@Moemenmohamed24
Moemenmohamed24 requested a review from pitrou as a code owner July 21, 2026 21:56
@github-actions

Copy link
Copy Markdown

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

@kou kou changed the title GH-50508: Support scalar values in AppendScalars GH-50508: [C++] Support scalar values in AppendScalars Jul 22, 2026
@kou
kou marked this pull request as draft July 22, 2026 00:14
@kou

kou commented Jul 22, 2026

Copy link
Copy Markdown
Member

Could you use our PR template and fix CI failures?
You can make this PR "ready for review" after them.

@Moemenmohamed24

Copy link
Copy Markdown
Author

Could you use our PR template and fix CI failures? You can make this PR "ready for review" after them.

Done. I updated the PR description using the project template and applied the required clang-format changes. The latest commit has been pushed, and the CI workflows are currently awaiting maintainer approval.

@kou

kou commented Jul 22, 2026

Copy link
Copy Markdown
Member

Approved.

FYI: You can check CI results on your fork by enabling GitHub Actions on your fork.

@kou

kou commented Jul 22, 2026

Copy link
Copy Markdown
Member

Done. I updated the PR description using the project template

It seems that the PR description isn't updated yet...

@Moemenmohamed24
Moemenmohamed24 marked this pull request as ready for review July 22, 2026 03:58
ASSERT_OK_AND_ASSIGN(auto v5, MakeScalar(float32(), 3.0f));

ScalarVector scalars = {v1, v2, v3, v4, v5};

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.

There's no need to add an empty line after each individual statement, can we compact this a bit and only keep empty lines to distinguish between logically different sequences?


ASSERT_EQ(builder->length(), 5);

ASSERT_OK_AND_ASSIGN(auto array, builder->Finish());

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.

Let's also validate the result:

Suggested change
ASSERT_OK_AND_ASSIGN(auto array, builder->Finish());
ASSERT_OK_AND_ASSIGN(auto array, builder->Finish());
ASSERT_OK(array->ValidateFull());

UpdateDimensions(committed_logical_length_, 0);
return Status::OK();
}

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.

OTOH, let's please keep an empty line between function and method definitions.

@pitrou

pitrou commented Jul 22, 2026

Copy link
Copy Markdown
Member

I've separately created #50596 to refactor the AppendScalar implementation as its architecture is currently very odd.

@github-actions github-actions Bot added awaiting committer review Awaiting committer review and removed awaiting review Awaiting review labels Jul 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants