Skip to content

Commit

Permalink
Add test for checking an invalid number of samples
Browse files Browse the repository at this point in the history
Signed-off-by: James Duong <[email protected]>
  • Loading branch information
jduo committed Nov 7, 2024
1 parent 8d7bc7c commit 566f8cd
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import static java.util.Collections.emptyList;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertThrows;
import static org.opensearch.sql.ast.dsl.AstDSL.agg;
import static org.opensearch.sql.ast.dsl.AstDSL.aggregate;
import static org.opensearch.sql.ast.dsl.AstDSL.alias;
Expand Down Expand Up @@ -61,6 +62,7 @@
import org.opensearch.sql.ast.tree.Kmeans;
import org.opensearch.sql.ast.tree.ML;
import org.opensearch.sql.ast.tree.RareTopN.CommandType;
import org.opensearch.sql.common.antlr.SyntaxCheckException;
import org.opensearch.sql.ppl.antlr.PPLSyntaxParser;

public class AstBuilderTest {
Expand Down Expand Up @@ -728,6 +730,11 @@ public void testTrendlineNoAlias() {
computation(5, field("test_field"), "test_field_trendline", SMA)));
}

@Test
public void testTrendlineTooFewSamples() {
assertThrows(SyntaxCheckException.class, () -> plan("source=t | trendline sma(0, test_field)"));
}

@Test
public void testDescribeCommand() {
assertEqual("describe t", relation(mappingTable("t")));
Expand Down

0 comments on commit 566f8cd

Please sign in to comment.