forked from elastic/elasticsearch
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ESQL: Fix attribute set equals (elastic#118823) (elastic#119048)
Also add a test that uses this, for lookup join field attribute ids.
- Loading branch information
1 parent
023f73f
commit 2ae5911
Showing
5 changed files
with
85 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
pr: 118823 | ||
summary: Fix attribute set equals | ||
area: ES|QL | ||
type: bug | ||
issues: [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
...ql-core/src/test/java/org/elasticsearch/xpack/esql/core/expression/AttributeSetTests.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* | ||
* 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; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
package org.elasticsearch.xpack.esql.core.expression; | ||
|
||
import org.elasticsearch.test.ESTestCase; | ||
|
||
import java.util.List; | ||
|
||
import static org.elasticsearch.xpack.esql.core.expression.AttributeMapTests.a; | ||
|
||
public class AttributeSetTests extends ESTestCase { | ||
|
||
public void testEquals() { | ||
Attribute a1 = a("1"); | ||
Attribute a2 = a("2"); | ||
|
||
AttributeSet first = new AttributeSet(List.of(a1, a2)); | ||
assertEquals(first, first); | ||
|
||
AttributeSet second = new AttributeSet(); | ||
second.add(a1); | ||
second.add(a2); | ||
|
||
assertEquals(first, second); | ||
assertEquals(second, first); | ||
|
||
AttributeSet third = new AttributeSet(); | ||
third.add(a("1")); | ||
third.add(a("2")); | ||
|
||
assertNotEquals(first, third); | ||
assertNotEquals(third, first); | ||
|
||
assertEquals(AttributeSet.EMPTY, AttributeSet.EMPTY); | ||
assertEquals(AttributeSet.EMPTY, first.intersect(third)); | ||
assertEquals(third.intersect(first), AttributeSet.EMPTY); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters