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-43183: [C++] Add date{32,64} to date{32,64} cast #43192

Merged
merged 7 commits into from
Jul 10, 2024

Conversation

Fokko
Copy link
Contributor

@Fokko Fokko commented Jul 8, 2024

Rationale for this change

This one seems to be missing, see #43183

What changes are included in this PR?

Are these changes tested?

I'm not sure what the best place is to test this, please advise

Are there any user-facing changes?

Copy link

github-actions bot commented Jul 8, 2024

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

@Fokko Fokko changed the title GH-43183: [C++] Add date to date cast GH-43183: [C++] Add date{32,64} to date{32,64} cast Jul 8, 2024
Copy link
Contributor

@llama90 llama90 left a comment

Choose a reason for hiding this comment

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

I saw you added tests for Python. Shouldn't we also add tests for C++?

We could put them in scalar_cast_test.cc. There is a test called TEST(Cast, DateToDate) in that file we can look at for help.

cpp/src/arrow/compute/kernels/scalar_cast_temporal.cc Outdated Show resolved Hide resolved
@github-actions github-actions bot added awaiting committer review Awaiting committer review and removed awaiting review Awaiting review labels Jul 9, 2024
@llama90
Copy link
Contributor

llama90 commented Jul 9, 2024

@Fokko Thank you for your effort!

I think LGTM. For more detailed review, @kou (reviewed similar casting logic implementations I did before) or @felipecrv might be able to take a look.

@Fokko
Copy link
Contributor Author

Fokko commented Jul 9, 2024

Thanks for jumping in here @llama90 appreciate it 👍

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.

Thank you for reporting and fixing this @Fokko ! Here are some comments.

cpp/src/arrow/compute/kernels/scalar_cast_temporal.cc Outdated Show resolved Hide resolved
cpp/src/arrow/compute/kernels/scalar_cast_temporal.cc Outdated Show resolved Hide resolved
@@ -1199,6 +1199,25 @@ def make_batches():
reader = pa.RecordBatchReader.from_batches(None, batches)
pass

# https://github.com/apache/arrow/issues/43183
Copy link
Member

Choose a reason for hiding this comment

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

If we really want to test this on the Python side, it would be more logical to add a test to test_compute.py as this is not IPC-related at all.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That makes sense, thanks 👍

Copy link
Member

@zeroshade zeroshade left a comment

Choose a reason for hiding this comment

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

LGTM

@zeroshade zeroshade requested a review from pitrou July 9, 2024 17:00
@github-actions github-actions bot added awaiting merge Awaiting merge and removed awaiting committer review Awaiting committer review labels Jul 9, 2024
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

Comment on lines 1849 to 1859
schema = pa.schema([
('date32', pa.date32()),
('date64', pa.date64()),
])

batch = pa.RecordBatch.from_arrays(data, schema=schema)

table = pa.RecordBatchReader.from_batches(
schema,
[batch]
).cast(schema).read_all()
Copy link
Member

Choose a reason for hiding this comment

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

Why do we need to create a table here?
Can we use pc.cast() or Array.cast like other tests do?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, certainly. I've been using this code since it was exactly the code that caused issues on my end. I've updated the test 👍

@pitrou pitrou merged commit 5e451d8 into apache:main Jul 10, 2024
39 of 40 checks passed
@pitrou pitrou removed the awaiting merge Awaiting merge label Jul 10, 2024
@github-actions github-actions bot added the awaiting committer review Awaiting committer review label Jul 10, 2024
@Fokko Fokko deleted the fd-date-cast branch July 10, 2024 12:34
Copy link

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

There were no benchmark performance regressions. 🎉

The full Conbench report has more details. It also includes information about 1 possible false positive 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.

5 participants