-
Notifications
You must be signed in to change notification settings - Fork 57
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
data: support duplicate Field names in a Frame #83
Conversation
Is the proposal here to always have the prefix number? Maybe we can check and append (if necessary) before making a frame? |
Idea is always as part of the to/from arrow process. Has to be always, or can't tell if it is our prefix or name that looks like our prefix. |
Can we add a constraint that the names must be unique? And add a helper to append indicies when necessary? (Then we don't need to modify on the read side) |
Can do it via documentation, and maybe helper functions. However, this awkward is standard wide time series response. You have a metric name that would be repeated, but different Labels on the frame for that repeated name.
I don't understand what you are saying here. |
Also this means that Tables that don't have names, and just positions can't be represented. Because |
If I understand this PR, it will throw an error for any dataframe that does not have a field name that matches "${index}: ${string}" -- that seems pretty rough. Perhaps the long/wide syncing could assume that fields named: with changing the name to "${index}: ${string}" it seems we may as well name it a UUID and get the name from elsewhere |
I like the UUID idea and just using metadata for name in arrow. Can work on that tomorrow. |
i am reluctant to have the names be totally arbitrary -- if we need a mode where they are, that seems fine, but name==UUID seems weird. This would be the first choice that makes it so an arbitrary arrow file would not "just work" |
If I understand the feature request in this PR is that you want to be able to represent multiple fields with the same name in arrow Table, not just the fields? |
I don't understand the "not just the fields" part... But yes, the idea is that a Dataframe supports multiple Fields with the same Name, so the name doesn't have to be unique (or set) within a dataframe. |
Consider:
|
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 -- what else needs updated in core before while we bump the version?
if len(sp) == 2 { | ||
return sp[1] | ||
} | ||
return name |
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 don't really have any preferences, but if arrow have this restriction I don't see why we shouldn't have this resctriction. |
There are less abnormal examples. For example a CSV file with no headers (name is absent), or maybe everything in the frame is the same "name", so the frame gets a name, but you want to leave all the column names default (""). |
I can't think so. Once you have a Frontend PR ready that goes with this. I will merge it, tag it, and then update your PR to use this. |
Sure. The question is how Grafana should be able to handle it if the idea is that Grafana should remove the identifier. Can Grafana handle two fields named the same? |
Yes -- there is a warning that if you have two fields with the same name some things -- like using template variables for display (ie: ${frame.name[2]}) won't work |
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.
👍
❤️ golen test files
Great. Just want to make sure I understand everything. So what would the field type of a "merged" field be in Grafana - none? |
Front end change exists it seems: grafana/grafana#22705 |
This reverts commit 90efbdc.
data.Frame's Field's Name prefixing hack is now no longer needed, Arrow now allows for duplicate Field names, at least in our use cases. * Revert "data: support duplicate Field names in a Frame (#83)" This reverts commit 90efbdc * Update to newer version of go Arrow lib that allows duplicate field names and add a test that panicked before the upgrade. Also add duplicate field to golden file. fixes #137
Add fieldIdx prefix to arrow field Name to keep the names unique.
Front-end will need to do the same removal of the prefix.
for #59