Skip to content

Add ingestion of matrices #1150

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

joakimlinde
Copy link
Contributor

No description provided.

@joakimlinde
Copy link
Contributor Author

joakimlinde commented May 13, 2025

Looking at R API issue... Fixed.

Copy link
Collaborator

@krlmlr krlmlr left a comment

Choose a reason for hiding this comment

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

Thanks. Is there a good way to make this feature opt-in, based on ConvertOpts ?

I see this adds some support for complex numbers. Could this have been a separate PR? Same question regarding opt-in behavior.

src/scan.cpp Outdated
break;

case RType::INTEGER64: //REALSXP
AppendMatrixSegmentAtomic<int64_t, int64_t, RInteger64Type>(((int64_t *)DATAPTR(source_data)),
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should this be DATAPTR_RO() here and elsewhere?

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. Fixed.

src/utils.cpp Outdated
@@ -111,6 +111,9 @@ static void AppendColumnSegment(SRC *source_data, Vector &result, idx_t count) {
}

R_len_t RApiTypes::GetVecSize(RType rtype, SEXP coldata) {
if (rtype.id() == RTypeId::MATRIX) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should this check and the while loop be swapped?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, I can swap them. You mean that if I have a matrix inside a structure it would work better? Not sure if I've thought about that case... Is that a case we want to support?

@joakimlinde joakimlinde force-pushed the feature/array-ingestion branch from f91148d to 2b6bf5b Compare May 13, 2025 19:49
@codecov-commenter
Copy link

codecov-commenter commented May 13, 2025

Codecov Report

Attention: Patch coverage is 87.05882% with 11 lines in your changes missing coverage. Please review.

Project coverage is 52.62%. Comparing base (5c88c6f) to head (a2b189e).
Report is 1539 commits behind head on main.

Files with missing lines Patch % Lines
src/scan.cpp 83.33% 8 Missing ⚠️
src/types.cpp 90.90% 3 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##             main    #1150       +/-   ##
===========================================
- Coverage   63.61%   52.62%   -10.99%     
===========================================
  Files         123      146       +23     
  Lines        5266    10025     +4759     
===========================================
+ Hits         3350     5276     +1926     
- Misses       1916     4749     +2833     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@joakimlinde
Copy link
Contributor Author

joakimlinde commented May 13, 2025

Is there a good way to make this feature opt-in, based on ConvertOpts ?

No, I don't think so. Here is why. If the user gives me a matrix I only have two options. Either reject it as "I don't know what to do with a matrix" or slice up the matrix into arrays and push that into the database. The intent is clear from the user - he/she is giving me a matrix and there is only one constructive thing I can do with it. If the user had given me lists instead it would have been different. In that case I would have to know what to do with them, either create lists or arrays in the database. In that case the user would have to give me additional direction through options.

I see this adds some support for complex numbers. Could this have been a separate PR? Same question regarding opt-in behavior.

I added support so I can generate an error message saying that complex numbers are not supported. I could do it in a different way by looking at the SEXP type instead if that works better for you. It would break the pattern in scan.cpp though — look a little bit as a quick-and-dirty.

@joakimlinde joakimlinde force-pushed the feature/array-ingestion branch from 2b6bf5b to f8fd4e7 Compare May 13, 2025 22:23
@joakimlinde
Copy link
Contributor Author

joakimlinde commented May 13, 2025

The Ubuntu-22.04 (4.2) check fails. Seems like the snapshot files didn't make it across to Ubuntu. Can I ask you to manually rerun the test?

UPDATE: After triggering a few reruns (using dummy changes) the tests are now passing.

@joakimlinde joakimlinde force-pushed the feature/array-ingestion branch 2 times, most recently from 3b2b940 to 4bf92f4 Compare May 15, 2025 17:35
@joakimlinde joakimlinde force-pushed the feature/array-ingestion branch from 4bf92f4 to a2b189e Compare May 15, 2025 18:04
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