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-45344: [C++][Testing] Generic StepGenerator #45345

Merged
merged 12 commits into from
Feb 10, 2025

Conversation

zanmato1984
Copy link
Contributor

@zanmato1984 zanmato1984 commented Jan 24, 2025

Rationale for this change

#45344

What changes are included in this PR?

Make the StepGenerator generic.

Are these changes tested?

UT included.

Are there any user-facing changes?

None.

Copy link

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

@zanmato1984
Copy link
Contributor Author

Hi @pitrou @westonpace , does this make sense? Thanks.

ARROW_TESTING_EXPORT std::shared_ptr<ArrayGenerator> Step(T start = 0, T step = 1) {
class StepGenerator : public ArrayGenerator {
public:
// Use [[maybe_unused]] to avoid a compiler warning in Clang versions before 15 that
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is weird but it seems to be a clang bug.

CI failure: https://github.com/apache/arrow/actions/runs/12952919478/job/36131370510?pr=45345

/arrow/cpp/src/arrow/testing/generator.h:313:11: error: unused type alias 'ArrowType' [-Werror,-Wunused-local-typedef]
    using ArrowType = typename CTypeTraits<T>::ArrowType;
          ^

A SO thread: https://stackoverflow.com/questions/50205243/clang-emits-an-unused-type-alias-warning-for-a-type-alias-that-is-used

Reproduction on Clang 14: https://godbolt.org/z/hsnh6cGh8

Clang 15 (works fine): https://godbolt.org/z/x5zTe7j64

@github-actions github-actions bot added awaiting committer review Awaiting committer review and removed awaiting review Awaiting review labels Jan 24, 2025
Copy link
Member

@westonpace westonpace left a comment

Choose a reason for hiding this comment

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

Looks like a cool and useful utility. Thanks!

@github-actions github-actions bot added awaiting merge Awaiting merge and removed awaiting committer review Awaiting committer review labels Jan 29, 2025
@@ -23,6 +23,7 @@
#include <vector>

#include "arrow/array/array_base.h"
#include "arrow/builder.h"
Copy link
Member

Choose a reason for hiding this comment

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

This is a very large inclusion, can we avoid it here? Perhaps only include arrow/array/builder_primitive.h?

Copy link
Member

Choose a reason for hiding this comment

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

Or you can perhaps just rely on TypedBufferBuilder<T> below.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you. I have changed to arrow/buffer_builder.h (for TypedBufferBuilder) + arrow/array/util.h (for MakeArray). This reduced the preprocessing result from 4.0M to 3.7M.

Copy link
Member

@pitrou pitrou left a comment

Choose a reason for hiding this comment

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

Just a small suggestion, otherwise LGTM

cpp/src/arrow/testing/generator_test.cc Show resolved Hide resolved
@zanmato1984 zanmato1984 merged commit d1bf856 into apache:main Feb 10, 2025
38 checks passed
@zanmato1984 zanmato1984 removed the awaiting merge Awaiting merge label Feb 10, 2025
@zanmato1984 zanmato1984 deleted the generalize-step-gen branch February 10, 2025 12:04
Copy link

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

There were no benchmark performance regressions. 🎉

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

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.

3 participants