Skip to content

Commit 4bded60

Browse files
committed
when aliasing to null, use alias'es id for subsequent aliases
1 parent 2a3c2b1 commit 4bded60

File tree

1 file changed

+6
-4
lines changed
  • x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/optimizer/rules

1 file changed

+6
-4
lines changed

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/optimizer/rules/RuleUtils.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,11 @@ public final class RuleUtils {
3030
private RuleUtils() {}
3131

3232
/**
33-
* Returns a tuple of two lists:
34-
* 1. A list of aliases to null literals for those data types in the {@param outputAttributes} that {@param shouldBeReplaced}.
35-
* 2. A list of named expressions where attributes that match the predicate are replaced with their corresponding null alias.
33+
* @return a tuple of two lists:
34+
* <ol>
35+
* <li>A list of aliases to null literals for those data types in the {@code outputAttributes} that {@code shouldBeReplaced}.</li>
36+
* <li>A list of named expressions where attributes that match the predicate are replaced with their corresponding null alias.</li>
37+
* </ol>
3638
*
3739
* @param outputAttributes The original output attributes.
3840
* @param shouldBeReplaced A predicate to determine which attributes should be replaced with null aliases.
@@ -63,7 +65,7 @@ public static Tuple<List<Alias>, List<NamedExpression>> aliasedNulls(
6365
}
6466
// otherwise point to it since this avoids creating field copies
6567
else {
66-
projection = new Alias(attr.source(), attr.name(), nullAlias.toAttribute(), attr.id());
68+
projection = new Alias(attr.source(), attr.name(), nullAlias.toAttribute(), nullAlias.id());
6769
}
6870
} else {
6971
projection = attr;

0 commit comments

Comments
 (0)