Skip to content

Commit f33b994

Browse files
committed
Disallow removal of regex extracted fields
1 parent 4985a61 commit f33b994

File tree

1 file changed

+5
-3
lines changed
  • x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/session

1 file changed

+5
-3
lines changed

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/session/EsqlSession.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -600,9 +600,11 @@ static PreAnalysisResult fieldNames(LogicalPlan parsed, Set<String> enrichPolicy
600600

601601
parsed.forEachDown(p -> {// go over each plan top-down
602602
if (p instanceof RegexExtract re) { // for Grok and Dissect
603-
// remove other down-the-tree references to the extracted fields
604-
for (Attribute extracted : re.extractedFields()) {
605-
referencesBuilder.removeIf(attr -> matchByName(attr, extracted.name(), false));
603+
if (canRemoveAliases[0]) {
604+
// remove other down-the-tree references to the extracted fields
605+
for (Attribute extracted : re.extractedFields()) {
606+
referencesBuilder.removeIf(attr -> matchByName(attr, extracted.name(), false));
607+
}
606608
}
607609
// but keep the inputs needed by Grok/Dissect
608610
referencesBuilder.addAll(re.input().references());

0 commit comments

Comments
 (0)