Browse Source

ESQL: Fix double lookup and HashJoinExec.addedFields (#115616) (#117338)

Fix a bug in HashJoinExec.addedFields that caused multiple LOOKUPs in a query to fail.

Co-authored-by: Jack Pan <35284546+jackpan123@users.noreply.github.com>
Alexander Spies 10 months ago
parent
commit
892d4ffb5b

+ 6 - 0
docs/changelog/115616.yaml

@@ -0,0 +1,6 @@
+pr: 115616
+summary: Fix double lookup failure on ESQL
+area: ES|QL
+type: bug
+issues:
+  - 111398

+ 1 - 1
x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/plan/physical/HashJoinExec.java

@@ -91,7 +91,7 @@ public class HashJoinExec extends BinaryExec implements EstimatesRowSize {
 
     public Set<Attribute> addedFields() {
         if (lazyAddedFields == null) {
-            lazyAddedFields = outputSet();
+            lazyAddedFields = new AttributeSet(output());
             lazyAddedFields.removeAll(left().output());
         }
         return lazyAddedFields;