Skip to content

Commit 045baee

Browse files
committed
refactor
Signed-off-by: Lantao Jin <ltjin@amazon.com>
1 parent 351730d commit 045baee

1 file changed

Lines changed: 11 additions & 15 deletions

File tree

ppl/src/main/java/org/opensearch/sql/ppl/utils/ArgumentFactory.java

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -168,20 +168,16 @@ public static Argument getArgumentValue(OpenSearchPPLParser.JoinTypeContext ctx)
168168
}
169169

170170
public static Join.JoinType getJoinType(OpenSearchPPLParser.SqlLikeJoinTypeContext ctx) {
171-
try {
172-
if (ctx == null) return Join.JoinType.INNER;
173-
if (ctx.INNER() != null) return Join.JoinType.valueOf(ctx.INNER().getText());
174-
if (ctx.SEMI() != null) return Join.JoinType.valueOf(ctx.SEMI().getText());
175-
if (ctx.ANTI() != null) return Join.JoinType.valueOf(ctx.ANTI().getText());
176-
if (ctx.LEFT() != null) return Join.JoinType.valueOf(ctx.LEFT().getText());
177-
if (ctx.RIGHT() != null) return Join.JoinType.valueOf(ctx.RIGHT().getText());
178-
if (ctx.CROSS() != null) return Join.JoinType.valueOf(ctx.CROSS().getText());
179-
if (ctx.FULL() != null) return Join.JoinType.valueOf(ctx.FULL().getText());
180-
if (ctx.OUTER() != null) return Join.JoinType.LEFT; // Special case
181-
return Join.JoinType.INNER; // Default case
182-
} catch (Exception e) {
183-
throw new SemanticCheckException(String.format("Unsupported join type %s", ctx.getText()));
184-
}
171+
if (ctx == null) return Join.JoinType.INNER;
172+
if (ctx.INNER() != null) return Join.JoinType.INNER;
173+
if (ctx.SEMI() != null) return Join.JoinType.SEMI;
174+
if (ctx.ANTI() != null) return Join.JoinType.ANTI;
175+
if (ctx.LEFT() != null) return Join.JoinType.LEFT;
176+
if (ctx.RIGHT() != null) return Join.JoinType.RIGHT;
177+
if (ctx.CROSS() != null) return Join.JoinType.CROSS;
178+
if (ctx.FULL() != null) return Join.JoinType.FULL;
179+
if (ctx.OUTER() != null) return Join.JoinType.LEFT;
180+
throw new SemanticCheckException(String.format("Unsupported join type %s", ctx.getText()));
185181
}
186182

187183
public static Join.JoinType getJoinType(OpenSearchPPLParser.JoinTypeContext ctx) {
@@ -193,7 +189,7 @@ public static Join.JoinType getJoinType(OpenSearchPPLParser.JoinTypeContext ctx)
193189
if (ctx.RIGHT() != null) return Join.JoinType.RIGHT;
194190
if (ctx.CROSS() != null) return Join.JoinType.CROSS;
195191
if (ctx.FULL() != null) return Join.JoinType.FULL;
196-
if (ctx.OUTER() != null) return Join.JoinType.LEFT; // Special case
192+
if (ctx.OUTER() != null) return Join.JoinType.LEFT;
197193
throw new SemanticCheckException(String.format("Unsupported join type %s", ctx.getText()));
198194
}
199195

0 commit comments

Comments
 (0)