Fix coordinator's dataSource api with full parameter#5662
Fix coordinator's dataSource api with full parameter#5662gianm merged 5 commits intoapache:masterfrom
Conversation
|
@jihoonson - does the returned JSON match what 0.11.0 & earlier returned? If so, this patch looks good to me. |
|
@gianm good point. Fixed the result format. |
|
|
||
| if (full != null) { | ||
| return Response.ok(dataSource).build(); | ||
| final Map<String, Object> fullResult = ImmutableMap.of( |
There was a problem hiding this comment.
Instead of this, how about having @JsonProperty on the getSegments() method, and having the @JsonCreator constructor accept segments and make the map out of it? It should be equivalent but cleaner -- usually we try to handle serde through annotations.
|
@jihoonson this Travis failure seems related, I think it would be fixed if you used the suggestion from #5662 (comment). |
|
@gianm thanks. Addressed your comment. I also fixed the result order - it was previously always sorted. |
| ImmutableMap.of(), | ||
| ImmutableMap.copyOf(segmentMap) | ||
| ); | ||
| return new ImmutableDruidDataSource(dataSourceName, Collections.emptyMap(), segmentMap); |
There was a problem hiding this comment.
Minor, I think: if we're building the segmentMap from scratch here anyway, might as well start it off as an ImmutableSortedMap. That way ImmutableSortedMap.copyOfSorted is a no-op and we avoid the extra copy.
There was a problem hiding this comment.
This causes the below error because the same segments can be added to the segmentMap multiple times. Reverted this change.
java.lang.IllegalArgumentException: Multiple entries with same key: datasource1_2010-01-22T00:00:00.000Z_2010-01-23T00:00:00.000Z_null=DataSegment{size=20, shardSpec=NoneShardSpec, metrics=[], dimensions=[], version='null', loadSpec=null, interval=2010-01-22T00:00:00.000Z/2010-01-23T00:00:00.000Z, dataSource='datasource1', binaryVersion='9'} and datasource1_2010-01-22T00:00:00.000Z_2010-01-23T00:00:00.000Z_null=DataSegment{size=20, shardSpec=NoneShardSpec, metrics=[], dimensions=[], version='null', loadSpec=null, interval=2010-01-22T00:00:00.000Z/2010-01-23T00:00:00.000Z, dataSource='datasource1', binaryVersion='9'}
at io.druid.server.http.DatasourcesResourceTest.testSimpleGetTheDataSourceManyTiers(DatasourcesResourceTest.java:404)
|
Thanks - merging! |
* Fix coordinator's dataSource api with full parameter * address comment * Add a constructor for json serde and fix result order * Change to immutableSortedMap * Revert immutableSortedMap to treeMap
Fixes #5661.
This change is