-
Notifications
You must be signed in to change notification settings - Fork 557
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
InferredView fixes and enhancements #3851
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## develop #3851 +/- ##
===========================================
+ Coverage 15.53% 15.57% +0.03%
===========================================
Files 731 729 -2
Lines 81497 81005 -492
Branches 1087 1075 -12
===========================================
- Hits 12664 12615 -49
+ Misses 68833 68390 -443
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
}, | ||
}; | ||
} else if (isPrimitiveType(dominantType) && readOnly) { | ||
} else if (isPrimitiveType(dominantType || "") && readOnly) { |
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.
This is probably the crux of the fix, but I find it very hard to follow. Its odd that getDominantType()
returns null(ish) values? A variable name or comment indicating that the ||
is due to it being an empty array (isn't that the only case where this happens?
Also I realize we're using existing utils here, but I'd rather have metadata be in object form than functions, the data is already there so its a bit odd to call functions to get at it:
const value = "foo";
const typeInfo = getTypeInfoForValue(value);
// typeInfo.isArray => false
// typeInfo.dominantType => null (rename to typeInfo.arrayItemDominantType)
// typeInfo.isPrimitive => true
// typeInfo.value => "foo"
// typeInfo.isNullish => false
// typeInfo.type => string
// etc
Both of these a minor comments, but thought they might be useful feedback.
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.
Yah, that's right. dominantType will be unknown for an empty array. Planning to use something like one of view in future for unknown type but it can potentially be a nested object.
Not too sure about the second half of the comment. The generate-schema
(I should probably rename to inferSchemaUsingValue(value)
is only used for InferredView
to generate a SchemaIO
compatible schema based only on a value.
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.
LGTM
b59597d
to
9b8fa04
Compare
What changes are proposed in this pull request?
Fix exceptions for unknown value type and ensure defaults are propagated correctly
How is this patch tested? If it is not, please explain why.
Using an operator with InferredView rendering a deeply nested object
Release Notes
Is this a user-facing change that should be mentioned in the release notes?
notes for FiftyOne users.
(Details in 1-2 sentences. You can just refer to another PR with a description
if this PR is part of a larger change.)
What areas of FiftyOne does this PR affect?
fiftyone
Python library changes