-
Notifications
You must be signed in to change notification settings - Fork 47
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
Handle case where there is a 'time' data key. #699
Comments
[Copied from Slack] This is the place to start: databroker/databroker/mongo_normalized.py Lines 87 to 113 in a2a5d66
|
Closed
In databroker-intake the event.data.time overrides event.time |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In databroker, we make a best effort to fit the streaming "document model" into standard PyData types.
In v1, we use DataFrames (
.table(...)
) or generators (.data(...)
). In v2, we use xarray Datasets. They have different trade-offs. DataFrames do not handle image (or in general N-dimensional) data well. Datasets do.Both provide a concept of special columns that are used for alignment. DataFrames call it "index"; Datasets call it "coordinates". They are related conceptually and in terms of their implementation (xarray uses pandas.Index internally). But they have some semantic differences. DataFrames' indexes live in a separate namespace from columns, so there is no worry about name collisions. Datasets put their columns ("variables") and their indexes ("coordinates") in one namespace, and so the same name cannot be used for both a variable and a coordinate.
For databroker, this means that if the user uses
"time"
as a data key in an Event document, it will collide with the Event time like this:And in v2 we currently do not handle that gracefully. @tacaswell has proposed that we leave the user-defined name alone and add underscopes to the front of our coordinate
time
, trying first_time
and then__time
and then___time
(etc.) until we find a name that doesn't collide. Hopefully_time
will usually be enough, but this retry-based approach is guaranteed to avoid a collision even if some user decides to use bothtime
and_time
for example.The text was updated successfully, but these errors were encountered: