-
Notifications
You must be signed in to change notification settings - Fork 302
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
allow a hash method to be present for numpy arrays #2649
allow a hash method to be present for numpy arrays #2649
Conversation
Thank you for opening this pull request! 🙌 These tips will help get your PR across the finish line:
|
flytekit/types/numpy/ndarray.py
Outdated
elif isinstance(aa, HashMethod): | ||
continue | ||
else: | ||
raise TypeTransformerFailedError(f"{t}'s metadata needs to be of type kwtypes.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
raise TypeTransformerFailedError(f"{t}'s metadata needs to be of type kwtypes.") | |
raise TypeTransformerFailedError(f"The metadata for {t} must be of type kwtypes or HashMethod.") |
shouldn't you also import HashMethod
from flytekit?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I forgot the import in the PR, probably the reason for some (but definitely not all) test fails.
@samhita-alla Quick question here, you added HashMethod in error message, but how does kwtypes relate to the code, where the check looks for an OrderedDict, not kwtypes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you're right, flytekit's kwtypes is an ordered dict. let's replace kwtypes with ordereddict.
could you add some test cases to the https://github.com/flyteorg/flytekit/blob/master/tests/flytekit/unit/types/numpy/test_ndarray.py file? looks like the existing test cases are failing. would you mind taking a look at the failures as well? |
@samhita-alla I added some tests, and I guess numpy UTs were failing because my check for an existing metadata was flawed. FYI: Running |
i think this error is just because of error formatting between the different python versions. i can repro locally using 3.12. a possibly heavyhanded patch would be something like
|
also the error matching doesn't need to be that precise. it's okay just to get a few keywords in there. |
only the formating of OrderedDict changed a bit in python 3.12 I repleaced the exact formatting with a regex expression. This should now fix it. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #2649 +/- ##
==========================================
- Coverage 78.77% 74.62% -4.15%
==========================================
Files 187 187
Lines 19149 19160 +11
Branches 3993 3997 +4
==========================================
- Hits 15085 14299 -786
- Misses 3374 4156 +782
- Partials 690 705 +15 ☔ View full report in Codecov by Sentry. |
Congrats on merging your first pull request! 🎉 |
Signed-off-by: Yee Hing Tong <[email protected]> Signed-off-by: mao3267 <[email protected]>
Tracking issue
Closes flyteorg/flyte#5630
Why are the changes needed?
See above issue.
What changes were proposed in this pull request?
Code diff is minimal, changes were made in a consistent way, following code from
structured_dataset.py
, specifically theextract_cols_and_format
function.How was this patch tested?
I only tested this with my custom setup, modifying the files in the
site-packages
in place. I'll leave proper testing up to the devs.Setup process
Screenshots
Check all the applicable boxes
Related PRs
Docs link