Skip to content

Commit

Permalink
Allow backtick around fields in sort cmd (#1688) (#1689)
Browse files Browse the repository at this point in the history
* Allow backtick around fields in sort cmd

Signed-off-by: Joshua Li <[email protected]>

* Add test

Signed-off-by: Joshua Li <[email protected]>

* Update test setup

Signed-off-by: Joshua Li <[email protected]>

* revert ignoring sql-cli repo if exists

Signed-off-by: Joshua Li <[email protected]>

---------

Signed-off-by: Joshua Li <[email protected]>
(cherry picked from commit 691012d)

Co-authored-by: Joshua Li <[email protected]>
  • Loading branch information
opensearch-trigger-bot[bot] and joshuali925 authored May 31, 2023
1 parent 86ae687 commit c6e0ee3
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,6 @@ gen

.java-version
.worktrees
http-client.env.json
http-client.env.json
/doctest/sql-cli/
.factorypath
Original file line number Diff line number Diff line change
Expand Up @@ -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)
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)",
Expand Down

0 comments on commit c6e0ee3

Please sign in to comment.