-
Notifications
You must be signed in to change notification settings - Fork 225
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
Support dynamic stream metadata #493
Merged
Merged
Changes from 4 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -90,9 +90,14 @@ tape('parseStreamTimeSeries#simple', t => { | |
|
||
testData.forEach(d => schemaValidator.validate('core/timeseries_state', d)); | ||
|
||
const result = parseStreamTimeSeries(testData, new Map()); | ||
let result = parseStreamTimeSeries(testData, new Map()); | ||
t.deepEquals(result, expected, 'time_series parsed properly'); | ||
|
||
setXVIZConfig({DYNAMIC_STREAM_METADATA: true}); | ||
result = parseStreamTimeSeries(testData, new Map()); | ||
t.is(result['/test/doubles'].__metadata.category, 'TIME_SERIES', 'metadata generated'); | ||
t.is(result['/test/doubles'].__metadata.scalar_type, 'FLOAT', 'metadata generated'); | ||
|
||
t.end(); | ||
}); | ||
|
||
|
@@ -133,15 +138,19 @@ tape('parseStreamVariable#simple v2', t => { | |
time: 1001, | ||
variable: [ | ||
{ | ||
type: 'FLOAT', | ||
values: [10, 11, 12] | ||
}, | ||
{ | ||
type: 'INT32', | ||
values: [10, 11, 12] | ||
}, | ||
{ | ||
type: 'BOOL', | ||
values: [true, false, true] | ||
}, | ||
{ | ||
type: 'STRING', | ||
values: ['one', 'two', 'three'], | ||
id: '123' | ||
} | ||
|
@@ -153,6 +162,10 @@ tape('parseStreamVariable#simple v2', t => { | |
const result = parseStreamVariable(testData, '/test', time); | ||
t.deepEquals(result, expected, 'variables parsed properly'); | ||
|
||
setXVIZConfig({DYNAMIC_STREAM_METADATA: true}); | ||
const {__metadata} = parseStreamVariable(testData, '/test', time); | ||
t.is(__metadata.category, 'VARIABLE', 'metadata generated'); | ||
|
||
t.end(); | ||
}); | ||
|
||
|
@@ -181,6 +194,10 @@ tape('parseStreamUIPrimitives#simple v2', t => { | |
const result = parseStreamUIPrimitives(testData, '/test', time); | ||
t.deepEquals(result, expected, 'variables parsed properly'); | ||
|
||
setXVIZConfig({DYNAMIC_STREAM_METADATA: true}); | ||
const {__metadata} = parseStreamUIPrimitives(testData, '/test', time); | ||
t.is(__metadata.category, 'UI_PRIMITIVE', 'metadata generated'); | ||
|
||
t.end(); | ||
}); | ||
|
||
|
@@ -233,6 +250,10 @@ tape('parseStreamVariable#simple v1', t => { | |
t.deepEquals(result, testCase.expected, `variables type ${testCase.name} parsed properly`); | ||
}); | ||
|
||
setXVIZConfig({DYNAMIC_STREAM_METADATA: true}); | ||
const {__metadata} = parseStreamVariable(testSet[0].xviz, '/test', time); | ||
t.is(__metadata.category, 'VARIABLE', 'metadata generated'); | ||
|
||
t.end(); | ||
}); | ||
|
||
|
@@ -278,7 +299,7 @@ tape('parseXVIZStream#variable no-data entries', t => { | |
|
||
tape('parseXVIZStream#primitive no-data entries', t => { | ||
resetXVIZConfigAndSettings(); | ||
setXVIZConfig({currentMajorVersion: 1}); | ||
setXVIZConfig({currentMajorVersion: 1, DYNAMIC_STREAM_METADATA: true}); | ||
|
||
const data = [ | ||
{ | ||
|
@@ -314,7 +335,8 @@ tape('parseXVIZStream#primitive no-data entries', t => { | |
pointCloud: null, | ||
images: [], | ||
components: [], | ||
time: 100.5425 | ||
time: 100.5425, | ||
__metadata: {category: 'PRIMITIVE', primitive_type: 'polygon2d'} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
}, | ||
{ | ||
lookAheads: [], | ||
|
@@ -324,7 +346,8 @@ tape('parseXVIZStream#primitive no-data entries', t => { | |
pointCloud: null, | ||
images: [], | ||
components: [], | ||
time: 101.84 | ||
time: 101.84, | ||
__metadata: {category: 'PRIMITIVE', primitive_type: null} | ||
} | ||
]; | ||
|
||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Should
scalar_type
be verified here?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.
How does
scalar_type
in metadata work when there are multiple types in this stream?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.
Ideally there shouldn't be.
The intention was that the multiple elements only really make sense if you assign an
object_id
so you can associate the values with something meaningful (if they share the stream id like/object/speed_prediction
)Otherwise I don't know how you interpret or use the elements, like if I have
/object/velocity_prediction
with multiple entries but w/o an object_id for each one, I don't know how to make sense of the data then.The same issue fundamentally happens with
primitives
in that we assume each primitive is of a singleprimitive_type
. Like you can't have/object/ufo
as both circles and polygons. It doesn't look like the Schema enforces this restriction, but i'm pretty sure our code won't really handle them right.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.
I am saying, either the relationship is implicit, and the
variable
would have only 1 entry, or it must be explicit with anobject_id
and multiple entries. Otherwise it is hard to see how the data is useful.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.
I'd be fine with taking the type of the first entry. It is likely what we do elsewhere if necessary.
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.
Looks like
getVariableData()
returns the first entry if finds too