-
Notifications
You must be signed in to change notification settings - Fork 24.9k
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
Introduce chunked version of ToXContentObject #92549
Changes from 3 commits
b404141
dcc52dd
1310da9
93221fc
f27ac78
f64ad95
ac33123
c2de951
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
package org.elasticsearch.common.xcontent; | ||
|
||
public interface ChunkedToXContentObject extends ChunkedToXContent { | ||
|
||
@Override | ||
default boolean isFragment() { | ||
return false; | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -162,4 +162,8 @@ public int hashCode() { | |
return Objects.hash(super.hashCode(), reduceScript, aggregations); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "InternalScriptedMetric{" + reduceScript + "}"; | ||
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. Had to do something here since the parent class's |
||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,12 +44,13 @@ private static Map<String, DiskUsage> randomDiskUsage() { | |
Map<String, DiskUsage> builder = new HashMap<>(numEntries); | ||
for (int i = 0; i < numEntries; i++) { | ||
String key = randomAlphaOfLength(32); | ||
final int totalBytes = randomIntBetween(0, Integer.MAX_VALUE); | ||
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. Had to fix this to use plausible values, otherwise |
||
DiskUsage diskUsage = new DiskUsage( | ||
randomAlphaOfLength(4), | ||
randomAlphaOfLength(4), | ||
randomAlphaOfLength(4), | ||
randomIntBetween(0, Integer.MAX_VALUE), | ||
randomIntBetween(0, Integer.MAX_VALUE) | ||
totalBytes, | ||
randomIntBetween(0, totalBytes) | ||
); | ||
builder.put(key, diskUsage); | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,8 +27,6 @@ | |
import java.util.function.Predicate; | ||
|
||
import static org.elasticsearch.common.xcontent.XContentHelper.toXContent; | ||
import static org.hamcrest.Matchers.emptyString; | ||
import static org.hamcrest.Matchers.not; | ||
|
||
public class AggregationProfileShardResultTests extends AbstractXContentSerializingTestCase<AggregationProfileShardResult> { | ||
|
||
|
@@ -120,10 +118,4 @@ public void testToXContent() throws IOException { | |
}"""), xContent.utf8ToString()); | ||
} | ||
|
||
public void testToString() { | ||
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. Moved to the parent now to deal with this for all the things we serialize |
||
final String toString = createTestInstance().toString(); | ||
assertNotNull(toString); | ||
assertThat(toString, not(emptyString())); | ||
} | ||
|
||
} |
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.
Not great but we shouldn't throw on
toString
ever so we have to have some breakout here for the un-merged case that doesn't allowtoXContent
.