From 4e851c29c849a6478024b3e3ab395789d6e004c8 Mon Sep 17 00:00:00 2001 From: Kould Date: Fri, 17 Jan 2025 14:22:02 +0800 Subject: [PATCH] chore: remove `TryExpr::analyzeImpl` & add more test cases on test_try --- .../java/com/starrocks/analysis/TryExpr.java | 4 ---- test/sql/test_function/R/test_try | 24 +++++++++++++++++++ test/sql/test_function/T/test_try | 9 +++++++ 3 files changed, 33 insertions(+), 4 deletions(-) diff --git a/fe/fe-core/src/main/java/com/starrocks/analysis/TryExpr.java b/fe/fe-core/src/main/java/com/starrocks/analysis/TryExpr.java index 6d64a8eb0a007..5a1b1d169961a 100644 --- a/fe/fe-core/src/main/java/com/starrocks/analysis/TryExpr.java +++ b/fe/fe-core/src/main/java/com/starrocks/analysis/TryExpr.java @@ -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(); diff --git a/test/sql/test_function/R/test_try b/test/sql/test_function/R/test_try index 96bec94b6e3a0..9c5ee5c988a9b 100644 --- a/test/sql/test_function/R/test_try +++ b/test/sql/test_function/R/test_try @@ -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: diff --git a/test/sql/test_function/T/test_try b/test/sql/test_function/T/test_try index 7821b37dbdb64..2c933abe18389 100644 --- a/test/sql/test_function/T/test_try +++ b/test/sql/test_function/T/test_try @@ -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';