diff --git a/.gitignore b/.gitignore index 2b1f9be522..1b892036dd 100644 --- a/.gitignore +++ b/.gitignore @@ -47,4 +47,6 @@ gen .java-version .worktrees -http-client.env.json \ No newline at end of file +http-client.env.json +/doctest/sql-cli/ +.factorypath diff --git a/ppl/src/main/java/org/opensearch/sql/ppl/parser/AstExpressionBuilder.java b/ppl/src/main/java/org/opensearch/sql/ppl/parser/AstExpressionBuilder.java index e56eae83a6..4ce9ce2789 100644 --- a/ppl/src/main/java/org/opensearch/sql/ppl/parser/AstExpressionBuilder.java +++ b/ppl/src/main/java/org/opensearch/sql/ppl/parser/AstExpressionBuilder.java @@ -182,7 +182,7 @@ public UnresolvedExpression visitWcFieldExpression(WcFieldExpressionContext ctx) @Override public UnresolvedExpression visitSortField(SortFieldContext ctx) { return new Field( - qualifiedName(ctx.sortFieldExpression().fieldExpression().getText()), + visit(ctx.sortFieldExpression().fieldExpression().qualifiedName()), ArgumentFactory.getArgumentList(ctx) ); } diff --git a/ppl/src/test/java/org/opensearch/sql/ppl/parser/AstExpressionBuilderTest.java b/ppl/src/test/java/org/opensearch/sql/ppl/parser/AstExpressionBuilderTest.java index 16a6ff63b4..3f3c0e50ba 100644 --- a/ppl/src/test/java/org/opensearch/sql/ppl/parser/AstExpressionBuilderTest.java +++ b/ppl/src/test/java/org/opensearch/sql/ppl/parser/AstExpressionBuilderTest.java @@ -301,6 +301,15 @@ public void testSortFieldWithMinusKeyword() { )); } + @Test + public void testSortFieldWithBackticks() { + assertEqual("source=t | sort `f`", + sort( + relation("t"), + field("f", defaultSortFieldArgs()) + )); + } + @Test public void testSortFieldWithAutoKeyword() { assertEqual("source=t | sort auto(f)",