Skip to content

Commit

Permalink
Addressed comments in PR 5.
Browse files Browse the repository at this point in the history
Signed-off-by: Mitchell Gale <Mitchell.Gale@improving.com>
  • Loading branch information
MitchellGale committed Aug 9, 2023
1 parent ec7035e commit f93a82d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public List<NamedExpression> visitAlias(Alias node, AnalysisContext context) {
* The Alias could be
*
* <ol>
* <li>1. SELECT name, AVG(age) FROM s BY name -> Project(Alias("name", expr), Alias("AVG(age)",
* <li>SELECT name, AVG(age) FROM s BY name -> Project(Alias("name", expr), Alias("AVG(age)",
* aggExpr)) Agg(Alias("AVG(age)", aggExpr))
* <li>SELECT length(name), AVG(age) FROM s BY length(name) Project(Alias("name", expr),
* Alias("AVG(age)", aggExpr)) Agg(Alias("AVG(age)", aggExpr))
Expand Down
12 changes: 8 additions & 4 deletions core/src/main/java/org/opensearch/sql/ast/dsl/AstDSL.java
Original file line number Diff line number Diff line change
Expand Up @@ -249,23 +249,27 @@ public static Function function(String funcName, UnresolvedExpression... funcArg
}

/**
* CASE<br>
* &emsp; WHEN search_condition THEN result_expr<br>
* &emsp; [WHEN search_condition THEN result_expr] ...<br>
* &emsp; [ELSE result_expr]<br>
* <pre>
* CASE
* WHEN search_condition THEN result_expr<br>
* [WHEN search_condition THEN result_expr] ...
* [ELSE result_expr]
* END
* </pre>
*/
public UnresolvedExpression caseWhen(UnresolvedExpression elseClause,
When... whenClauses) {
return caseWhen(null, elseClause, whenClauses);
}

/**
* <pre>
* CASE case_value_expr
* WHEN compare_expr THEN result_expr
* [WHEN compare_expr THEN result_expr] ...
* [ELSE result_expr]
* END
* </pre>
*/
public UnresolvedExpression caseWhen(UnresolvedExpression caseValueExpr,
UnresolvedExpression elseClause,
Expand Down

0 comments on commit f93a82d

Please sign in to comment.