Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GH-37567: [C++] Migrate JSON Integration code to Result<> #37573

Merged
merged 3 commits into from
Sep 5, 2023

Conversation

pitrou
Copy link
Member

@pitrou pitrou commented Sep 5, 2023

Rationale for this change

The JSON Integration APIs still use the old-style of returning Status together with a T* out-parameter.
While those are internal APIs, it would still improve ease of us to migrate them to the newer idiom of returning a Result<T>.

What changes are included in this PR?

Migrate the relevant APIs from Status to Result. Since the APIs are internal, no deprecation period is introduced.

Also, some very minor style and testing cleanups here and there.

Are these changes tested?

By existing tests.

Are there any user-facing changes?

No.

@pitrou pitrou requested a review from bkietz September 5, 2023 15:11
@@ -764,6 +764,10 @@ def integration(with_all=False, random_seed=12345, **args):
enabled_languages += 1

if gen_path:
# XXX this option is only used by the JS test suite.
Copy link
Member

Choose a reason for hiding this comment

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

maybe put up a follow-up?

@github-actions github-actions bot added awaiting merge Awaiting merge and removed awaiting review Awaiting review labels Sep 5, 2023

private:
IntegrationJsonReader(MemoryPool* pool, const std::shared_ptr<Buffer>& data);
IntegrationJsonReader(MemoryPool* pool, std::shared_ptr<Buffer> data);
Copy link
Member

Choose a reason for hiding this comment

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

Not for this PR, but food for future thought: a pattern which maintains access control for the constructor but enables usage of factories like make_unique is the private tag:

Suggested change
IntegrationJsonReader(MemoryPool* pool, std::shared_ptr<Buffer> data);
private:
class Tag {
Tag() = default;
friend class IntegrationJsonReader;
};
public:
IntegrationJsonReader(Tag, MemoryPool* pool, std::shared_ptr<Buffer> data);

... probably not worth the boilerplate

Copy link
Member Author

Choose a reason for hiding this comment

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

Ha. Yes, I suppose it might be nice for heavily-used public classes, but that's a lot of boilerplate for a small convenience.

Copy link
Member

@bkietz bkietz left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for cleaning this up!

@github-actions github-actions bot added awaiting changes Awaiting changes awaiting merge Awaiting merge and removed awaiting merge Awaiting merge awaiting changes Awaiting changes labels Sep 5, 2023
@pitrou
Copy link
Member Author

pitrou commented Sep 5, 2023

CI failure is unrelated.

@pitrou pitrou merged commit d5cc9d9 into apache:main Sep 5, 2023
36 of 37 checks passed
@pitrou pitrou removed the awaiting merge Awaiting merge label Sep 5, 2023
@pitrou pitrou deleted the gh37567-json-integration-result branch September 5, 2023 18:05
@conbench-apache-arrow
Copy link

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

There were no benchmark performance regressions. 🎉

The full Conbench report has more details.

loicalleyne pushed a commit to loicalleyne/arrow that referenced this pull request Nov 13, 2023
…he#37573)

### Rationale for this change

The JSON Integration APIs still use the old-style of returning `Status` together with a `T*` out-parameter.
While those are internal APIs, it would still improve ease of us to migrate them to the newer idiom of returning a `Result<T>`.

### What changes are included in this PR?

Migrate the relevant APIs from `Status` to `Result`. Since the APIs are internal, no deprecation period is introduced.

Also, some very minor style and testing cleanups here and there.

### Are these changes tested?

By existing tests.

### Are there any user-facing changes?

No.

* Closes: apache#37567

Authored-by: Antoine Pitrou <antoine@python.org>
Signed-off-by: Antoine Pitrou <antoine@python.org>
dgreiss pushed a commit to dgreiss/arrow that referenced this pull request Feb 19, 2024
…he#37573)

### Rationale for this change

The JSON Integration APIs still use the old-style of returning `Status` together with a `T*` out-parameter.
While those are internal APIs, it would still improve ease of us to migrate them to the newer idiom of returning a `Result<T>`.

### What changes are included in this PR?

Migrate the relevant APIs from `Status` to `Result`. Since the APIs are internal, no deprecation period is introduced.

Also, some very minor style and testing cleanups here and there.

### Are these changes tested?

By existing tests.

### Are there any user-facing changes?

No.

* Closes: apache#37567

Authored-by: Antoine Pitrou <antoine@python.org>
Signed-off-by: Antoine Pitrou <antoine@python.org>
Sign up for free to 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.

[C++] Migrate JSON Integration code to Result<>
3 participants