Map Builders should preserve order
See original GitHub issueObject Builders for maps use an InternalMap
which is a sub-class of a hash map:
Hash maps are unordered, the order is defined by the internal hashing function and can be different for different runtime environments. Although the JSON standard does not define dictionaries to be ordered, it would be good to switch to a linked hash map with insertion order:
- for a user the order might have a meaning and it is easier for them if the order is preserved the way the user specified it, e.g. the output might be a ML job or transform configuration
- in some cases order can be important at runtime: https://github.com/elastic/elasticsearch/issues/82350
Because this does not seems performance-critical, I suggest to switch to a linked hash map with insertion order
Issue Analytics
- State:
- Created 2 years ago
- Comments:9 (5 by maintainers)
Top Results From Across the Web
Map that could be iterated in the order of values - Stack Overflow
I would do this with Guava as follows: Ordering<Map.Entry<Key, Value>> entryOrdering = Ordering.from(valueComparator) .onResultOf(new Function<Entry<Key, ...
Read more >YOUR GUIDE TO MAPMAKER - National Geographic Society
Manage your maps: Each map you save is stored under Menu > My Maps. To delete a map, select the trash can icon...
Read more >TABS Map Creator TUTORIAL - How to Use + Tips and Tricks!
TABS Map Creator TUTORIAL - How to Use + Tips and Tricks! 54K views · 1 month ago ...more. Plastic Scot. 83.4K. Subscribe....
Read more >Configure the form—ArcGIS Field Maps | Documentation
If you use Map Viewer to edit or save the map, the form you configured in the Field Maps web app will be...
Read more >Immutable objects
Without ordering annotations, ordered sets and maps attributes will be generated as regular attributes to support construction with custom comparators, etc. All ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
We have discussed the underlying issue in the backend team:
The transform API parses/stores/serializes the configuration in question in a way that preserves order, this works if the REST API is used directly. This is out of the specification and inconsistent to other parts of the stack. The reason for this feature is performance. Starting with 7.15 transform has some builtin optimizations for improving performance by optimizing the group by query. That’s one of the reasons why we’ve decided to keep the API the way it is and not change/enhance the syntax (make it order-aware or add sort criteria). We will rather spend more time on improving the optimizations. As a result we will adjust the documentation accordingly. If you are using REST it will still preserve order, but that’s considered an implementation detail.
That’s for the technical aspect of it. From a usability perspective I still think that consistent order helps UX. But that’s not my decision.
Thanks for your time, I will close the corresponding HLRC issue.
Let’s take this offline, it looks like gh is not the right place to discuss this, we seem to discuss different issues. I am very aware that JSON dictionaries do not define an order, I’ve never claimed so.
We will discuss in backend and get in touch afterwards.