Skip to content

Commit 5e6b23b

Browse files
Merge branch 'main' into indexLike_final
2 parents d1610e6 + 172637b commit 5e6b23b

File tree

24 files changed

+719
-190
lines changed

24 files changed

+719
-190
lines changed

muted-tests.yml

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -546,39 +546,12 @@ tests:
546546
- class: org.elasticsearch.xpack.esql.qa.single_node.GenerativeIT
547547
method: test
548548
issue: https://github.com/elastic/elasticsearch/issues/130067
549-
- class: org.elasticsearch.xpack.esql.action.EnrichIT
550-
method: testForPushDownEnrichRule
551-
issue: https://github.com/elastic/elasticsearch/issues/130426
552-
- class: org.elasticsearch.xpack.esql.action.EnrichIT
553-
method: testAvgDurationByArtist
554-
issue: https://github.com/elastic/elasticsearch/issues/130790
555-
- class: org.elasticsearch.xpack.esql.action.EnrichIT
556-
method: testRejection
557-
issue: https://github.com/elastic/elasticsearch/issues/130791
558-
- class: org.elasticsearch.xpack.esql.action.EnrichIT
559-
method: testManyDocuments
560-
issue: https://github.com/elastic/elasticsearch/issues/130792
561-
- class: org.elasticsearch.xpack.esql.action.EnrichIT
562-
method: testListeningRatio
563-
issue: https://github.com/elastic/elasticsearch/issues/130793
564549
- class: org.elasticsearch.xpack.esql.action.EsqlRemoteErrorWrapIT
565550
method: testThatRemoteErrorsAreWrapped
566551
issue: https://github.com/elastic/elasticsearch/issues/130794
567-
- class: org.elasticsearch.xpack.esql.action.EnrichIT
568-
method: testProfile
569-
issue: https://github.com/elastic/elasticsearch/issues/130270
570-
- class: org.elasticsearch.xpack.esql.action.EnrichIT
571-
method: testSumDurationByArtist
572-
issue: https://github.com/elastic/elasticsearch/issues/130788
573-
- class: org.elasticsearch.xpack.esql.action.EnrichIT
574-
method: testTopN
575-
issue: https://github.com/elastic/elasticsearch/issues/130122
576552
- class: org.elasticsearch.xpack.esql.qa.multi_node.EsqlSpecIT
577553
method: test {ints.InCast SYNC}
578554
issue: https://github.com/elastic/elasticsearch/issues/130796
579-
- class: org.elasticsearch.xpack.esql.action.EnrichIT
580-
method: testFilterAfterEnrich
581-
issue: https://github.com/elastic/elasticsearch/issues/130827
582555
- class: org.elasticsearch.backwards.MixedClusterClientYamlTestSuiteIT
583556
method: test {p0=mtermvectors/10_basic/Tests catching other exceptions per item}
584557
issue: https://github.com/elastic/elasticsearch/issues/122414

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,8 @@ static TransportVersion def(int id) {
334334
public static final TransportVersion ML_INFERENCE_IBM_WATSONX_COMPLETION_ADDED = def(9_115_0_00);
335335
public static final TransportVersion ESQL_SPLIT_ON_BIG_VALUES = def(9_116_0_00);
336336
public static final TransportVersion ESQL_LOCAL_RELATION_WITH_NEW_BLOCKS = def(9_117_0_00);
337-
public static final TransportVersion ESQL_FIXED_INDEX_LIKE = def(9_118_0_00);
337+
public static final TransportVersion ML_INFERENCE_CUSTOM_SERVICE_EMBEDDING_TYPE = def(9_118_0_00);
338+
public static final TransportVersion ESQL_FIXED_INDEX_LIKE = def(9_119_0_00);
338339

339340
/*
340341
* STOP! READ THIS FIRST! No, really,

x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/lucene/read/ValuesFromSingleReader.java

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -65,22 +65,27 @@ public int get(int i) {
6565
return;
6666
}
6767
int[] forwards = docs.shardSegmentDocMapForwards();
68-
loadFromSingleLeaf(target, new BlockLoader.Docs() {
69-
@Override
70-
public int count() {
71-
return docs.getPositionCount();
72-
}
68+
Block[] unshuffled = new Block[target.length];
69+
try {
70+
loadFromSingleLeaf(unshuffled, new BlockLoader.Docs() {
71+
@Override
72+
public int count() {
73+
return docs.getPositionCount();
74+
}
7375

74-
@Override
75-
public int get(int i) {
76-
return docs.docs().getInt(forwards[i]);
77-
}
78-
});
79-
final int[] backwards = docs.shardSegmentDocMapBackwards();
80-
for (int i = 0; i < target.length; i++) {
81-
try (Block in = target[i]) {
82-
target[i] = in.filter(backwards);
76+
@Override
77+
public int get(int i) {
78+
return docs.docs().getInt(forwards[i]);
79+
}
80+
});
81+
final int[] backwards = docs.shardSegmentDocMapBackwards();
82+
for (int i = 0; i < unshuffled.length; i++) {
83+
target[i] = unshuffled[i].filter(backwards);
84+
unshuffled[i].close();
85+
unshuffled[i] = null;
8386
}
87+
} finally {
88+
Releasables.closeExpectNoException(unshuffled);
8489
}
8590
}
8691

x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/lucene/read/ValuesReader.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ public Block[] next() {
3636
boolean success = false;
3737
try {
3838
load(target, offset);
39+
if (target[0].getPositionCount() != docs.getPositionCount()) {
40+
throw new IllegalStateException("partial pages not yet supported");
41+
}
3942
success = true;
4043
for (Block b : target) {
4144
operator.valuesLoaded += b.getTotalValueCount();

x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/lucene/read/ValuesSourceReaderOperatorTests.java

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
import org.elasticsearch.common.bytes.BytesReference;
3030
import org.elasticsearch.common.lucene.Lucene;
3131
import org.elasticsearch.common.settings.Settings;
32-
import org.elasticsearch.common.unit.ByteSizeValue;
3332
import org.elasticsearch.compute.data.Block;
3433
import org.elasticsearch.compute.data.BlockFactory;
3534
import org.elasticsearch.compute.data.BooleanBlock;
@@ -446,12 +445,6 @@ protected void assertSimpleOutput(List<Page> input, List<Page> results) {
446445
assertThat(sum, equalTo(expectedSum));
447446
}
448447

449-
@Override
450-
protected ByteSizeValue enoughMemoryForSimple() {
451-
assumeFalse("strange exception in the test, fix soon", true);
452-
return ByteSizeValue.ofKb(1);
453-
}
454-
455448
public void testLoadAll() {
456449
DriverContext driverContext = driverContext();
457450
loadSimpleAndAssert(

x-pack/plugin/esql/compute/test/src/main/java/org/elasticsearch/compute/test/OperatorTestCase.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,16 @@ protected ByteSizeValue enoughMemoryForSimple() {
9898
* all pages.
9999
*/
100100
public final void testSimpleCircuitBreaking() {
101-
ByteSizeValue memoryLimitForSimple = enoughMemoryForSimple();
102-
Operator.OperatorFactory simple = simple(new SimpleOptions(true));
101+
/*
102+
* Build the input before building `simple` to handle the rare
103+
* cases where `simple` need some state from the input - mostly
104+
* this is ValuesSourceReaderOperator.
105+
*/
103106
DriverContext inputFactoryContext = driverContext();
104107
List<Page> input = CannedSourceOperator.collectPages(simpleInput(inputFactoryContext.blockFactory(), between(1_000, 10_000)));
108+
109+
ByteSizeValue memoryLimitForSimple = enoughMemoryForSimple();
110+
Operator.OperatorFactory simple = simple(new SimpleOptions(true));
105111
try {
106112
ByteSizeValue limit = BreakerTestUtil.findBreakerLimit(memoryLimitForSimple, l -> runWithLimit(simple, input, l));
107113
ByteSizeValue testWithSize = ByteSizeValue.ofBytes(randomLongBetween(0, limit.getBytes()));

x-pack/plugin/esql/src/internalClusterTest/java/org/elasticsearch/xpack/esql/action/EnrichIT.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@
5050
import org.elasticsearch.xpack.esql.core.type.DataType;
5151
import org.elasticsearch.xpack.esql.enrich.EnrichLookupService;
5252
import org.elasticsearch.xpack.esql.plan.logical.Enrich;
53-
import org.elasticsearch.xpack.esql.plugin.EsqlPlugin;
5453
import org.junit.After;
5554
import org.junit.Before;
5655

@@ -81,8 +80,8 @@ public class EnrichIT extends AbstractEsqlIntegTestCase {
8180

8281
@Override
8382
protected Collection<Class<? extends Plugin>> nodePlugins() {
84-
List<Class<? extends Plugin>> plugins = new ArrayList<>(super.nodePlugins());
85-
plugins.add(EsqlPlugin.class);
83+
List<Class<? extends Plugin>> plugins = new ArrayList<>();
84+
plugins.add(EsqlActionBreakerIT.EsqlTestPluginWithMockBlockFactory.class);
8685
plugins.add(InternalExchangePlugin.class);
8786
plugins.add(LocalStateEnrich.class);
8887
plugins.add(IngestCommonPlugin.class);

x-pack/plugin/inference/src/main/java/org/elasticsearch/xpack/inference/services/ServiceUtils.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1085,5 +1085,11 @@ public static void validateInputTypeAgainstAllowlist(
10851085
}
10861086
}
10871087

1088+
public static void checkByteBounds(short value) {
1089+
if (value < Byte.MIN_VALUE || value > Byte.MAX_VALUE) {
1090+
throw new IllegalArgumentException("Value [" + value + "] is out of range for a byte");
1091+
}
1092+
}
1093+
10881094
private ServiceUtils() {}
10891095
}

x-pack/plugin/inference/src/main/java/org/elasticsearch/xpack/inference/services/custom/CustomModel.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public CustomModel(
4646
inferenceId,
4747
taskType,
4848
service,
49-
CustomServiceSettings.fromMap(serviceSettings, context, taskType, inferenceId),
49+
CustomServiceSettings.fromMap(serviceSettings, context, taskType),
5050
CustomTaskSettings.fromMap(taskSettings),
5151
CustomSecretSettings.fromMap(secrets)
5252
);
@@ -66,7 +66,7 @@ public CustomModel(
6666
inferenceId,
6767
taskType,
6868
service,
69-
CustomServiceSettings.fromMap(serviceSettings, context, taskType, inferenceId),
69+
CustomServiceSettings.fromMap(serviceSettings, context, taskType),
7070
CustomTaskSettings.fromMap(taskSettings),
7171
CustomSecretSettings.fromMap(secrets),
7272
chunkingSettings

x-pack/plugin/inference/src/main/java/org/elasticsearch/xpack/inference/services/custom/CustomService.java

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -333,12 +333,7 @@ private static CustomServiceSettings getCustomServiceSettings(CustomModel custom
333333
var similarityToUse = similarityFromModel == null ? SimilarityMeasure.DOT_PRODUCT : similarityFromModel;
334334

335335
return new CustomServiceSettings(
336-
new CustomServiceSettings.TextEmbeddingSettings(
337-
similarityToUse,
338-
embeddingSize,
339-
serviceSettings.getMaxInputTokens(),
340-
serviceSettings.elementType()
341-
),
336+
new CustomServiceSettings.TextEmbeddingSettings(similarityToUse, embeddingSize, serviceSettings.getMaxInputTokens()),
342337
serviceSettings.getUrl(),
343338
serviceSettings.getHeaders(),
344339
serviceSettings.getQueryParameters(),

0 commit comments

Comments
 (0)