Skip to content

Commit ddcb35d

Browse files
authored
Merge branch 'main' into fix/134809-1
2 parents d15d84d + 9600127 commit ddcb35d

File tree

40 files changed

+893
-654
lines changed

40 files changed

+893
-654
lines changed

docs/changelog/134952.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
pr: 134952
2+
summary: Add support for expressions with LOOKUP JOIN in tech preview
3+
area: ES|QL
4+
type: enhancement
5+
issues: [ ]
6+
highlight:
7+
title: Add support for expressions with LOOKUP JOIN in tech preview
8+
body: |-
9+
Enable Lookup Join on Expression Tech Preview
10+
FROM index1 | LOOKUP JOIN lookup_index on left_field1 > right_field1 AND left_field2 <= right_field2
11+
notable: true

docs/changelog/134960.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 134960
2+
summary: Adding custom headers support openai text embeddings
3+
area: Machine Learning
4+
type: enhancement
5+
issues: []

docs/changelog/135235.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 135235
2+
summary: Fix systemd notify to use a shared arena
3+
area: Infra/Node Lifecycle
4+
type: bug
5+
issues: []

docs/reference/query-languages/esql/_snippets/commands/layout/lookup-join.md

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,22 @@ FROM <source_index>
1919
FROM <source_index>
2020
| LOOKUP JOIN <lookup_index> ON <field_name1>, <field_name2>, <field_name3>
2121
```
22+
```esql
23+
FROM <source_index>
24+
| LOOKUP JOIN <lookup_index> ON <left_field1> >= <lookup_field1> AND <left_field2> == <lookup_field2>
25+
```
2226

2327
**Parameters**
2428

2529
`<lookup_index>`
2630
: The name of the lookup index. This must be a specific index name - wildcards, aliases, and remote cluster references are not supported. Indices used for lookups must be configured with the [`lookup` index mode](/reference/elasticsearch/index-settings/index-modules.md#index-mode-setting).
2731

28-
`<field_name>` or `<field_name1>, <field_name2>, <field_name3>`
29-
: The field(s) to join on. Can be either:
30-
* A single field name
31-
* A comma-separated list of field names {applies_to}`stack: ga 9.2`
32-
: These fields must exist in both your current query results and in the lookup index. If the fields contains multi-valued entries, those entries will not match anything (the added fields will contain `null` for those rows).
32+
`<field_name>` or `<field_name1>, <field_name2>, <field_name3>` or `<left_field1> >= <lookup_field1> AND <left_field2> == <lookup_field2>`
33+
: The join condition. Can be one of the following:
34+
* A single field name
35+
* A comma-separated list of field names {applies_to}`stack: ga 9.2`
36+
* An expression with one or more join conditions linked by `AND`. Each condition compares a field from the left index with a field from the lookup index using [binary operators](/reference/query-languages/esql/functions-operators/operators.md#esql-binary-operators) (`==`, `>=`, `<=`, `>`, `<`, `!=`). Each field name in the join condition must exist in only one of the indexes. Use RENAME to resolve naming conflicts. {applies_to}`stack: preview 9.2` {applies_to}`serverless: preview`
37+
: If using join on a single field or a field list, the fields used must exist in both your current query results and in the lookup index. If the fields contains multi-valued entries, those entries will not match anything (the added fields will contain `null` for those rows).
3338

3439

3540
**Description**

docs/reference/query-languages/esql/esql-lookup-join.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,15 @@ The `LOOKUP JOIN` command adds fields from the lookup index as new columns to yo
3434

3535
The command requires two parameters:
3636
* The name of the lookup index (which must have the `lookup` [`index.mode setting`](/reference/elasticsearch/index-settings/index-modules.md#index-mode-setting))
37-
* The field(s) to join on. Can be either:
38-
* A single field name
39-
* A comma-separated list of field names {applies_to}`stack: ga 9.2`
37+
* The join condition. Can be one of the following:
38+
* A single field name
39+
* A comma-separated list of field names {applies_to}`stack: ga 9.2`
40+
* An expression with one or more join conditions linked by `AND`. Each condition compares a field from the left index with a field from the lookup index using [binary operators](/reference/query-languages/esql/functions-operators/operators.md#esql-binary-operators) (`==`, `>=`, `<=`, `>`, `<`, `!=`). Each field name in the join condition must exist in only one of the indexes. Use RENAME to resolve naming conflicts. {applies_to}`stack: preview 9.2` {applies_to}`serverless: preview`
4041

4142
```esql
4243
LOOKUP JOIN <lookup_index> ON <field_name> # Join on a single field
4344
LOOKUP JOIN <lookup_index> ON <field_name1>, <field_name2>, <field_name3> # Join on multiple fields
45+
LOOKUP JOIN <lookup_index> ON <left_field1> >= <lookup_field1> AND <left_field2> == <lookup_field2> # Join on expression
4446
```
4547

4648
:::{image} ../images/esql-lookup-join.png

libs/native/src/main/java/org/elasticsearch/nativeaccess/AbstractNativeAccess.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,15 @@ public Zstd getZstd() {
4646
}
4747

4848
@Override
49-
public CloseableByteBuffer newBuffer(int len) {
49+
public CloseableByteBuffer newSharedBuffer(int len) {
5050
assert len > 0;
51-
return javaLib.newBuffer(len);
51+
return javaLib.newSharedBuffer(len);
52+
}
53+
54+
@Override
55+
public CloseableByteBuffer newConfinedBuffer(int len) {
56+
assert len > 0;
57+
return javaLib.newConfinedBuffer(len);
5258
}
5359

5460
@Override

libs/native/src/main/java/org/elasticsearch/nativeaccess/LinuxNativeAccess.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ record Arch(
9898
this.systemd = null; // not running under systemd
9999
} else {
100100
logger.debug("Systemd socket path: {}", socketPath);
101-
var buffer = newBuffer(64);
101+
var buffer = newSharedBuffer(64);
102102
this.systemd = new Systemd(libraryProvider.getLibrary(PosixCLibrary.class), socketPath, buffer);
103103
}
104104
}

libs/native/src/main/java/org/elasticsearch/nativeaccess/NativeAccess.java

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,12 +88,20 @@ default WindowsFunctions getWindowsFunctions() {
8888
Optional<VectorSimilarityFunctions> getVectorSimilarityFunctions();
8989

9090
/**
91-
* Creates a new {@link CloseableByteBuffer}. The buffer must be used within the same thread
92-
* that it is created.
91+
* Creates a new {@link CloseableByteBuffer} using a shared arena. The buffer can be used
92+
* across multiple threads.
9393
* @param len the number of bytes the buffer should allocate
9494
* @return the buffer
9595
*/
96-
CloseableByteBuffer newBuffer(int len);
96+
CloseableByteBuffer newSharedBuffer(int len);
97+
98+
/**
99+
* Creates a new {@link CloseableByteBuffer} using a confined arena. The buffer must be
100+
* used within the same thread that it is created.
101+
* @param len the number of bytes the buffer should allocate
102+
* @return the buffer
103+
*/
104+
CloseableByteBuffer newConfinedBuffer(int len);
97105

98106
/**
99107
* Possible stats for execution filtering.

libs/native/src/main/java/org/elasticsearch/nativeaccess/NoopNativeAccess.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,13 @@ public Zstd getZstd() {
7878
}
7979

8080
@Override
81-
public CloseableByteBuffer newBuffer(int len) {
81+
public CloseableByteBuffer newSharedBuffer(int len) {
82+
logger.warn("cannot allocate buffer because native access is not available");
83+
return null;
84+
}
85+
86+
@Override
87+
public CloseableByteBuffer newConfinedBuffer(int len) {
8288
logger.warn("cannot allocate buffer because native access is not available");
8389
return null;
8490
}

libs/native/src/main/java/org/elasticsearch/nativeaccess/jdk/JdkCloseableByteBuffer.java

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,16 @@ class JdkCloseableByteBuffer implements CloseableByteBuffer {
2020
final MemorySegment segment;
2121
private final ByteBuffer bufferView;
2222

23-
JdkCloseableByteBuffer(int len) {
24-
this.arena = Arena.ofConfined();
23+
static JdkCloseableByteBuffer ofShared(int len) {
24+
return new JdkCloseableByteBuffer(len, true);
25+
}
26+
27+
static JdkCloseableByteBuffer ofConfined(int len) {
28+
return new JdkCloseableByteBuffer(len, false);
29+
}
30+
31+
private JdkCloseableByteBuffer(int len, boolean shared) {
32+
this.arena = shared ? Arena.ofShared() : Arena.ofConfined();
2533
this.segment = arena.allocate(len);
2634
this.bufferView = segment.asByteBuffer();
2735
}

0 commit comments

Comments
 (0)