Skip to content

Commit 8e019be

Browse files
authored
Revert "[8.19] Backport ES|QL sample processing command (#129617)" (#129797)
* Revert "[8.19] Backport ES|QL sample processing command (#129617)" This reverts commit 1d05947.
1 parent 11b5c78 commit 8e019be

File tree

66 files changed

+2606
-4718
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+2606
-4718
lines changed

docs/changelog/125570.yaml

Lines changed: 0 additions & 5 deletions
This file was deleted.

docs/changelog/129797.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 129797
2+
summary: "Revert \"[8.19] Backport ES|QL sample processing command\""
3+
area: ES|QL
4+
type: bug
5+
issues: []

docs/reference/esql/esql-commands.asciidoc

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ endif::[]
4646
* experimental:[] <<esql-lookup-join>>
4747
* experimental:[] <<esql-mv_expand>>
4848
* <<esql-rename>>
49-
* experimental:[] <<esql-sample>>
5049
* <<esql-sort>>
5150
* <<esql-stats-by>>
5251
* <<esql-where>>
@@ -71,7 +70,6 @@ include::processing-commands/limit.asciidoc[]
7170
include::processing-commands/lookup.asciidoc[]
7271
include::processing-commands/mv_expand.asciidoc[]
7372
include::processing-commands/rename.asciidoc[]
74-
include::processing-commands/sample.asciidoc[]
7573
include::processing-commands/sort.asciidoc[]
7674
include::processing-commands/stats.asciidoc[]
7775
include::processing-commands/where.asciidoc[]

docs/reference/esql/functions/description/date_trunc.asciidoc

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/reference/esql/functions/kibana/docs/date_trunc.md

Lines changed: 1 addition & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/reference/esql/functions/kibana/docs/sample.md

Lines changed: 0 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/reference/esql/functions/types/to_ip.asciidoc

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/reference/esql/processing-commands/sample.asciidoc

Lines changed: 0 additions & 30 deletions
This file was deleted.

docs/reference/rest-api/usage.asciidoc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -249,8 +249,7 @@ GET /_xpack/usage
249249
"lookup_join" : 0,
250250
"change_point" : 0,
251251
"completion": 0,
252-
"rerank": 0,
253-
"sample": 0
252+
"rerank": 0
254253
},
255254
"queries" : {
256255
"rest" : {

server/src/main/java/org/elasticsearch/TransportVersions.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,6 @@ static TransportVersion def(int id) {
244244
public static final TransportVersion SETTINGS_IN_DATA_STREAMS_8_19 = def(8_841_0_51);
245245
public static final TransportVersion ML_INFERENCE_CUSTOM_SERVICE_REMOVE_ERROR_PARSING_8_19 = def(8_841_0_52);
246246
public static final TransportVersion ML_INFERENCE_CUSTOM_SERVICE_EMBEDDING_BATCH_SIZE_8_19 = def(8_841_0_53);
247-
public static final TransportVersion RANDOM_SAMPLER_QUERY_BUILDER_8_19 = def(8_841_0_54);
248247

249248
/*
250249
* STOP! READ THIS FIRST! No, really,

server/src/main/java/org/elasticsearch/search/SearchModule.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,6 @@
137137
import org.elasticsearch.search.aggregations.bucket.sampler.UnmappedSampler;
138138
import org.elasticsearch.search.aggregations.bucket.sampler.random.InternalRandomSampler;
139139
import org.elasticsearch.search.aggregations.bucket.sampler.random.RandomSamplerAggregationBuilder;
140-
import org.elasticsearch.search.aggregations.bucket.sampler.random.RandomSamplingQueryBuilder;
141140
import org.elasticsearch.search.aggregations.bucket.terms.DoubleTerms;
142141
import org.elasticsearch.search.aggregations.bucket.terms.LongRareTerms;
143142
import org.elasticsearch.search.aggregations.bucket.terms.LongTerms;
@@ -1210,9 +1209,6 @@ private void registerQueryParsers(List<SearchPlugin> plugins) {
12101209
registerQuery(new QuerySpec<>(ExactKnnQueryBuilder.NAME, ExactKnnQueryBuilder::new, parser -> {
12111210
throw new IllegalArgumentException("[exact_knn] queries cannot be provided directly");
12121211
}));
1213-
registerQuery(
1214-
new QuerySpec<>(RandomSamplingQueryBuilder.NAME, RandomSamplingQueryBuilder::new, RandomSamplingQueryBuilder::fromXContent)
1215-
);
12161212

12171213
registerFromPlugin(plugins, SearchPlugin::getQueries, this::registerQuery);
12181214

server/src/main/java/org/elasticsearch/search/aggregations/bucket/sampler/random/RandomSamplingQuery.java

Lines changed: 5 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -43,34 +43,14 @@ public final class RandomSamplingQuery extends Query {
4343
* can be generated
4444
*/
4545
public RandomSamplingQuery(double p, int seed, int hash) {
46-
checkProbabilityRange(p);
46+
if (p <= 0.0 || p >= 1.0) {
47+
throw new IllegalArgumentException("RandomSampling probability must be between 0.0 and 1.0, was [" + p + "]");
48+
}
4749
this.p = p;
4850
this.seed = seed;
4951
this.hash = hash;
5052
}
5153

52-
/**
53-
* Verifies that the probability is within the (0.0, 1.0) range.
54-
* @throws IllegalArgumentException in case of an invalid probability.
55-
*/
56-
public static void checkProbabilityRange(double p) throws IllegalArgumentException {
57-
if (p <= 0.0 || p >= 1.0) {
58-
throw new IllegalArgumentException("RandomSampling probability must be strictly between 0.0 and 1.0, was [" + p + "]");
59-
}
60-
}
61-
62-
public double probability() {
63-
return p;
64-
}
65-
66-
public int seed() {
67-
return seed;
68-
}
69-
70-
public int hash() {
71-
return hash;
72-
}
73-
7454
@Override
7555
public String toString(String field) {
7656
return "RandomSamplingQuery{" + "p=" + p + ", seed=" + seed + ", hash=" + hash + '}';
@@ -117,13 +97,13 @@ public void visit(QueryVisitor visitor) {
11797
/**
11898
* A DocIDSetIter that skips a geometrically random number of documents
11999
*/
120-
public static class RandomSamplingIterator extends DocIdSetIterator {
100+
static class RandomSamplingIterator extends DocIdSetIterator {
121101
private final int maxDoc;
122102
private final double p;
123103
private final FastGeometric distribution;
124104
private int doc = -1;
125105

126-
public RandomSamplingIterator(int maxDoc, double p, IntSupplier rng) {
106+
RandomSamplingIterator(int maxDoc, double p, IntSupplier rng) {
127107
this.maxDoc = maxDoc;
128108
this.p = p;
129109
this.distribution = new FastGeometric(rng, p);

server/src/main/java/org/elasticsearch/search/aggregations/bucket/sampler/random/RandomSamplingQueryBuilder.java

Lines changed: 0 additions & 149 deletions
This file was deleted.

server/src/test/java/org/elasticsearch/search/SearchModuleTests.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -449,7 +449,6 @@ public CheckedBiConsumer<ShardSearchRequest, StreamOutput, IOException> getReque
449449
"range",
450450
"regexp",
451451
"knn_score_doc",
452-
"random_sampling",
453452
"script",
454453
"script_score",
455454
"simple_query_string",

0 commit comments

Comments
 (0)