Skip to content

Commit

Permalink
chore: remove TryExpr::analyzeImpl & add more test cases on test_try
Browse files Browse the repository at this point in the history
  • Loading branch information
KKould committed Jan 17, 2025
1 parent db5e4ee commit 4e851c2
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 4 deletions.
4 changes: 0 additions & 4 deletions fe/fe-core/src/main/java/com/starrocks/analysis/TryExpr.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,6 @@ public TryExpr(Expr child, NodePosition pos) {
setType(child.getType());
}

@Override
protected void analyzeImpl(Analyzer analyzer) throws AnalysisException {
}

@Override
public Type getType() {
return getChild(0).getType();
Expand Down
24 changes: 24 additions & 0 deletions test/sql/test_function/R/test_try
Original file line number Diff line number Diff line change
@@ -1,3 +1,27 @@
-- name: test_try_normal_expr
set sql_dialect='trino';
-- result:
-- !result
select try(1);
-- result:
1
-- !result
select try(-1);
-- result:
-1
-- !result
select try(1 + 1);
-- result:
2
-- !result
select try(cast('1' as int));
-- result:
1
-- !result
select try(array[1, 2, 3][3]);
-- result:
3
-- !result
-- name: test_try_index_out_of_bound
set sql_dialect='trino';
-- result:
Expand Down
9 changes: 9 additions & 0 deletions test/sql/test_function/T/test_try
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
-- name: test_try_normal_expr
set sql_dialect='trino';

select try(1);
select try(-1);
select try(1 + 1);
select try(cast('1' as int));
select try(array[1, 2, 3][3]);

-- name: test_try_index_out_of_bound
set sql_dialect='trino';

Expand Down

0 comments on commit 4e851c2

Please sign in to comment.