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-35914: [MATLAB] Integrate the latest libmexclass changes to support error-handling #35918

Merged
merged 7 commits into from
Jun 8, 2023

Conversation

sgilmore10
Copy link
Member

@sgilmore10 sgilmore10 commented Jun 5, 2023

Rationale for this change

This change integrates the latest version of mathworks/libmexclass into the MATLAB interface which enables throwing MATLAB errors.

The 77f3d72 in libmexclass introduced the following changes:

  1. Added a new class called libmexclass::error::Error.
  2. Added a new field called error on the libmexclass::proxy::method::Context which is a std::optional<libmexclass::proxy::Error>. By default, this is a std::nullopt. To make MATLAB throw an error, set this optional.
  3. To support throwing errors at construction, libmexclass now requires all Proxy subclasses to define a static make method: static libmexclass::proxy::MakeResult make(const libmexclass::proxy::FunctionArguments& constructor_arguments). This workflow is similar to using an arrow::Result<T>object.

Examples of throwing errors in MATLAB can be found on lines 45 and 94 in libmexclass/example/proxy/Car.cpp

What changes are included in this PR?

  1. Pulled in the latest version of libmexclass: 77f3d72.
  2. Added static libmexclass::proxy::MakeResult make(const libmexclass::proxy::FunctionArguments& constructor_arguments) to arrow::matlab::proxy::NumericArray<Type>.
  3. Throw an error when trying to create an unknown proxy class.

Are these changes tested?

  1. Added a new test class called tGateway.m that verifies libmexclass.proxy.gateway("Create", ...) errors if given the name of an unknown proxy class.

Are there any user-facing changes?

No.

sgilmore10 and others added 2 commits June 5, 2023 13:33
2. Define error message ids as static const std::string variables.

Co-authored-by: Kevin Gurney <kgurney@mathworks.com>
matlab/src/cpp/arrow/matlab/array/proxy/numeric_array.h Outdated Show resolved Hide resolved
matlab/src/cpp/arrow/matlab/array/proxy/numeric_array.h Outdated Show resolved Hide resolved
matlab/src/cpp/arrow/matlab/error/error.h Outdated Show resolved Hide resolved
matlab/test/arrow/gateway/tGateway.m Outdated Show resolved Hide resolved
matlab/test/arrow/gateway/tGateway.m Outdated Show resolved Hide resolved
@github-actions github-actions bot added awaiting changes Awaiting changes and removed awaiting review Awaiting review labels Jun 6, 2023
sgilmore10 and others added 2 commits June 6, 2023 09:06
Co-authored-by: Sutou Kouhei <kou@cozmixng.org>
Co-authored-by: Sutou Kouhei <kou@cozmixng.org>
@github-actions github-actions bot added awaiting change review Awaiting change review and removed awaiting changes Awaiting changes labels Jun 6, 2023
Copy link
Member

@kou kou left a comment

Choose a reason for hiding this comment

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

+1

@kou kou merged commit 4074233 into apache:main Jun 8, 2023
8 checks passed
@github-actions github-actions bot added awaiting merge Awaiting merge and removed awaiting change review Awaiting change review labels Jun 8, 2023
@ursabot
Copy link

ursabot commented Jun 9, 2023

Benchmark runs are scheduled for baseline = 16328f0 and contender = 4074233. 4074233 is a master commit associated with this PR. Results will be available as each benchmark for each run completes.
Conbench compare runs links:
[Finished ⬇️0.0% ⬆️0.0%] ec2-t3-xlarge-us-east-2
[Finished ⬇️0.5% ⬆️0.06%] test-mac-arm
[Failed ⬇️0.98% ⬆️0.0%] ursa-i9-9960x
[Failed] ursa-thinkcentre-m75q
Buildkite builds:
[Finished] 40742339 ec2-t3-xlarge-us-east-2
[Finished] 40742339 test-mac-arm
[Finished] 40742339 ursa-i9-9960x
[Failed] 40742339 ursa-thinkcentre-m75q
[Finished] 16328f0c ec2-t3-xlarge-us-east-2
[Finished] 16328f0c test-mac-arm
[Failed] 16328f0c ursa-i9-9960x
[Failed] 16328f0c ursa-thinkcentre-m75q
Supported benchmarks:
ec2-t3-xlarge-us-east-2: Supported benchmark langs: Python, R. Runs only benchmarks with cloud = True
test-mac-arm: Supported benchmark langs: C++, Python, R
ursa-i9-9960x: Supported benchmark langs: Python, R, JavaScript
ursa-thinkcentre-m75q: Supported benchmark langs: C++, Java

@sgilmore10 sgilmore10 deleted the GH-35914 branch June 27, 2023 23:51
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.

[MATLAB] Integrate the latest libmexclass changes to support error-handling
3 participants