Skip to content

fix: align boolean parsing with Iceberg Java - #951

Open
manuzhang wants to merge 1 commit into
apache:mainfrom
manuzhang:agent/parse-boolean-util
Open

manuzhang wants to merge 1 commit into
apache:mainfrom
manuzhang:agent/parse-boolean-util

Conversation

@manuzhang

@manuzhang manuzhang commented Sep 21, 2026

Copy link
Copy Markdown
Member

What

Adds three boolean helpers, named and shaped after their Java counterparts, and reads every boolean through them:

  • StringUtils::ParseBoolean(std::string_view) -> bool — mirrors Boolean.parseBoolean.
  • PropertyUtil::PropertyAsBoolean(properties, key, default_value) -> bool — mirrors PropertyUtil.propertyAsBoolean.
  • PropertyUtil::PropertyAsOptionalBoolean(properties, key) -> std::optional<bool> — mirrors PropertyUtil.propertyAsNullableBoolean, keeping an unset property distinct from an explicit "false", which the S3 path needs.

Updated call sites: arrow_s3_file_io.cc, util/config.h, auth/auth_managers.cc, rest_catalog.cc. avro_schema_util.cc compares an Avro node attribute (adjust-to-utc) rather than a user-supplied property, so it is left alone.

Why

StringUtils covered only numbers — ParseNumber<T> even excludes bool — so every site spelled out the "true"/"false" literals itself, and the four sites did not agree on what a malformed value meant:

Site Behavior on a value that is not a boolean
arrow_s3_file_io.cc (ParseOptionalBool) error
util/config.h (DefaultFromString<bool>) false
auth/auth_managers.cc (rest.sigv4-enabled) false
rest_catalog.cc (rest-metrics-reporting-enabled) false

Java has one contract for all of these, so this settles the codebase on it.

Behavior change

"true" ignoring case is true and every other value is false, everywhere.

s3.path-style-access and s3.ssl.enabled are the sites that change. A malformed value such as s3.ssl.enabled=ture used to fail the FileIO build with kInvalidArgument; it now reads as false. That matches Java, where S3FileIOProperties reads both properties with PropertyUtil.propertyAsBoolean. A typo in an S3 connection property is therefore no longer reported.

The other three sites were already lenient and are unchanged.

Testing

  • StringUtilsTest.ParseBoolean — accepted spellings, and everything else reading as false.
  • New property_util_test.cc — defaulting when absent, case-insensitivity, and non-boolean values reading as false rather than falling back to the default.
  • ArrowS3FileIOTest.InvalidBooleanPropertyReadsAsFalse — replaces RejectsInvalidBooleanProperties, which pinned the old behavior.
  • ConfigTest.ParseBooleanIgnoringCase — unchanged and still passing, pinning the lenient contract for every Entry<bool>.

🤖 Generated with Claude Code

Copilot AI lite review requested due to automatic review settings September 21, 2026 07:14

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@manuzhang
manuzhang force-pushed the agent/parse-boolean-util branch from b9aa294 to 17b40e4 Compare September 21, 2026 07:23
Copilot AI review requested due to automatic review settings September 21, 2026 07:23

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@manuzhang
manuzhang force-pushed the agent/parse-boolean-util branch from 17b40e4 to e96193c Compare September 21, 2026 07:29
Copilot AI review requested due to automatic review settings September 21, 2026 07:29

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI review requested due to automatic review settings September 21, 2026 07:38
@manuzhang
manuzhang force-pushed the agent/parse-boolean-util branch from e96193c to 207c159 Compare September 21, 2026 07:38

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@manuzhang
manuzhang force-pushed the agent/parse-boolean-util branch from 207c159 to 2edf780 Compare September 21, 2026 07:43
Copilot AI review requested due to automatic review settings September 21, 2026 07:43

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@manuzhang
manuzhang force-pushed the agent/parse-boolean-util branch from 2edf780 to d479f23 Compare September 21, 2026 08:03
Copilot AI review requested due to automatic review settings September 21, 2026 08:03

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@manuzhang manuzhang changed the title refactor: parse booleans through a single shared helper fix: align boolean parsing with Iceberg Java Sep 21, 2026
Boolean values were parsed ad hoc in four places, and not consistently:
`arrow_s3_file_io.cc` rejected anything that was not "true" or "false",
while `config.h`, `auth_managers.cc` and `rest_catalog.cc` read any
unrecognized value as false. Each site spelled out the "true"/"false"
literals itself, and `StringUtils` covered only numbers.

Add `StringUtils::ParseBoolean()`, which mirrors Java's
Boolean.parseBoolean, and `PropertyUtil::PropertyAsBoolean()` /
`PropertyUtil::PropertyAsOptionalBoolean()`, which mirror Java's
PropertyUtil.propertyAsBoolean and propertyAsNullableBoolean, and read
every boolean through them.

That settles the codebase on Java's contract: "true" ignoring case reads
as true, and every other value reads as false. `s3.path-style-access` and
`s3.ssl.enabled` change behavior accordingly: a malformed value used to
fail the FileIO build and now reads as false, as it does in Java, whose
S3FileIOProperties reads both with PropertyUtil.propertyAsBoolean. The
test that pinned the old behavior is rewritten to pin the new one.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@manuzhang
manuzhang force-pushed the agent/parse-boolean-util branch from d479f23 to be4cb1d Compare September 21, 2026 08:24
Copilot AI review requested due to automatic review settings September 21, 2026 08:24

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@manuzhang
manuzhang requested a review from wgtmac September 21, 2026 08:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants