Skip to content

Commit

Permalink
EQL: Remove "yet" from unsupported pipe error message (#74850) (#74875)
Browse files Browse the repository at this point in the history
Co-authored-by: Andrei Stefan <astefan@users.noreply.github.com>
  • Loading branch information
elasticsearchmachine and astefan committed Jul 2, 2021
1 parent a03c8e4 commit 7856090
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@

public abstract class LogicalPlanBuilder extends ExpressionBuilder {

private static final String FILTER_PIPE = "filter", HEAD_PIPE = "head", TAIL_PIPE = "tail";
static final String FILTER_PIPE = "filter", HEAD_PIPE = "head", TAIL_PIPE = "tail";

private static final Set<String> SUPPORTED_PIPES = Sets.newHashSet("count", FILTER_PIPE, HEAD_PIPE, "sort", TAIL_PIPE, "unique",
static final Set<String> SUPPORTED_PIPES = Sets.newHashSet("count", FILTER_PIPE, HEAD_PIPE, "sort", TAIL_PIPE, "unique",
"unique_count");

private final UnresolvedRelation RELATION = new UnresolvedRelation(synthetic("<relation>"), null, "", false, "");
Expand Down Expand Up @@ -348,7 +348,7 @@ private LogicalPlan pipe(PipeContext ctx, LogicalPlan plan) {
return new Tail(source(ctx), tailLimit, plan);

default:
throw new ParsingException(source(ctx), "Pipe [{}] is not supported yet", name);
throw new ParsingException(source(ctx), "Pipe [{}] is not supported", name);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,11 @@
import java.util.List;

import static org.elasticsearch.xpack.eql.parser.AbstractBuilder.unquoteString;
import static org.elasticsearch.xpack.eql.parser.LogicalPlanBuilder.HEAD_PIPE;
import static org.elasticsearch.xpack.eql.parser.LogicalPlanBuilder.SUPPORTED_PIPES;
import static org.elasticsearch.xpack.eql.parser.LogicalPlanBuilder.TAIL_PIPE;
import static org.elasticsearch.xpack.ql.TestUtils.UTC;
import static org.hamcrest.Matchers.endsWith;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.instanceOf;
import static org.hamcrest.Matchers.is;
Expand Down Expand Up @@ -509,4 +513,11 @@ public void testChainedComparisonsDisallowed() {
+ "'regex', 'regex~', ':', '+', '-', '*', '/', '%', '.', '['}",
e.getMessage());
}

public void testUnsupportedPipes() {
String pipe = randomValueOtherThanMany(Arrays.asList(HEAD_PIPE, TAIL_PIPE)::contains, () -> randomFrom(SUPPORTED_PIPES));
ParsingException pe = expectThrows(ParsingException.class, "Expected parsing exception",
() -> parser.createStatement("process where foo == true | " + pipe));
assertThat(pe.getMessage(), endsWith("Pipe [" + pipe + "] is not supported"));
}
}

0 comments on commit 7856090

Please sign in to comment.