|
11 | 11 | import org.elasticsearch.common.io.stream.StreamInput; |
12 | 12 | import org.elasticsearch.common.io.stream.StreamOutput; |
13 | 13 | import org.elasticsearch.common.io.stream.Writeable; |
| 14 | +import org.elasticsearch.core.Nullable; |
14 | 15 | import org.elasticsearch.xpack.esql.EsqlIllegalArgumentException; |
15 | 16 | import org.elasticsearch.xpack.esql.core.capabilities.Resolvables; |
16 | 17 | import org.elasticsearch.xpack.esql.core.expression.Attribute; |
17 | 18 | import org.elasticsearch.xpack.esql.core.expression.Expression; |
18 | 19 |
|
19 | 20 | import java.io.IOException; |
20 | 21 | import java.util.List; |
21 | | -import java.util.Objects; |
22 | 22 |
|
23 | 23 | /** |
24 | | - * Configuration for a {@code JOIN} style operation. |
| 24 | + * @param type type of join |
| 25 | + * @param leftFields fields from the left child to join on |
| 26 | + * @param rightFields fields from the right child to join on |
| 27 | + * @param joinOnConditions join conditions for expression based joins. If null, we assume equi-join on the left/right fields |
25 | 28 | */ |
26 | | -public final class JoinConfig implements Writeable { |
27 | | - private final JoinType type; |
28 | | - private final List<Attribute> leftFields; |
29 | | - private final List<Attribute> rightFields; |
30 | | - private final Expression joinOnConditions; |
31 | | - |
32 | | - /** |
33 | | - * @param type type of join |
34 | | - * @param leftFields fields from the left child to join on |
35 | | - * @param rightFields fields from the right child to join on |
36 | | - * @param joinOnConditions join conditions for expression based joins. If null, we assume equi-join on the left/right fields |
37 | | - */ |
38 | | - public JoinConfig(JoinType type, List<Attribute> leftFields, List<Attribute> rightFields, Expression joinOnConditions) { |
39 | | - this.type = type; |
40 | | - this.leftFields = leftFields; |
41 | | - this.rightFields = rightFields; |
42 | | - this.joinOnConditions = joinOnConditions; |
43 | | - } |
| 29 | +public record JoinConfig(JoinType type, List<Attribute> leftFields, List<Attribute> rightFields, @Nullable Expression joinOnConditions) |
| 30 | + implements |
| 31 | + Writeable { |
44 | 32 |
|
45 | 33 | /** |
46 | 34 | * Legacy constructor that included the match fields, which were always the left fields. |
@@ -97,38 +85,6 @@ public boolean expressionsResolved() { |
97 | 85 | && (joinOnConditions == null || joinOnConditions.resolved()); |
98 | 86 | } |
99 | 87 |
|
100 | | - public JoinType type() { |
101 | | - return type; |
102 | | - } |
103 | | - |
104 | | - public List<Attribute> leftFields() { |
105 | | - return leftFields; |
106 | | - } |
107 | | - |
108 | | - public List<Attribute> rightFields() { |
109 | | - return rightFields; |
110 | | - } |
111 | | - |
112 | | - public Expression joinOnConditions() { |
113 | | - return joinOnConditions; |
114 | | - } |
115 | | - |
116 | | - @Override |
117 | | - public boolean equals(Object obj) { |
118 | | - if (obj == this) return true; |
119 | | - if (obj == null || obj.getClass() != this.getClass()) return false; |
120 | | - var that = (JoinConfig) obj; |
121 | | - return Objects.equals(this.type, that.type) |
122 | | - && Objects.equals(this.leftFields, that.leftFields) |
123 | | - && Objects.equals(this.rightFields, that.rightFields) |
124 | | - && Objects.equals(this.joinOnConditions, that.joinOnConditions); |
125 | | - } |
126 | | - |
127 | | - @Override |
128 | | - public int hashCode() { |
129 | | - return Objects.hash(type, leftFields, rightFields, joinOnConditions); |
130 | | - } |
131 | | - |
132 | 88 | @Override |
133 | 89 | public String toString() { |
134 | 90 | return "JoinConfig[" |
|
0 commit comments