@@ -78,12 +78,12 @@ public static void parseJoinCompareOperate(SqlNode condition, List<String> sqlJo
7878 parseJoinCompareOperate (sqlNode , sqlJoinCompareOperate );
7979 }
8080 } else {
81- String operator = parseOperator (joinCondition .getKind ());
81+ String operator = transformNotEqualsOperator (joinCondition .getKind ());
8282 sqlJoinCompareOperate .add (operator );
8383 }
8484 }
8585
86- public static String parseOperator (SqlKind sqlKind ) {
86+ public static String transformNotEqualsOperator (SqlKind sqlKind ) {
8787 if (StringUtils .equalsIgnoreCase (sqlKind .toString (), "NOT_EQUALS" )){
8888 return "!=" ;
8989 }
@@ -188,21 +188,8 @@ public static SqlNode replaceSelectFieldTabName(SqlNode selectNode, Map<String,S
188188 SqlNodeList thenOperands = sqlCase .getThenOperands ();
189189 SqlNode elseNode = sqlCase .getElseOperand ();
190190
191- for (int i =0 ; i <whenOperands .size (); i ++){
192- SqlNode oneOperand = whenOperands .get (i );
193- SqlNode replaceNode = replaceSelectFieldTabName (oneOperand , mapTab );
194- if (replaceNode != null ) {
195- whenOperands .set (i , replaceNode );
196- }
197- }
198-
199- for (int i =0 ; i <thenOperands .size (); i ++){
200- SqlNode oneOperand = thenOperands .get (i );
201- SqlNode replaceNode = replaceSelectFieldTabName (oneOperand , mapTab );
202- if (replaceNode != null ) {
203- thenOperands .set (i , replaceNode );
204- }
205- }
191+ replaceWhenOrThenSelectFieldTabName (mapTab , whenOperands );
192+ replaceWhenOrThenSelectFieldTabName (mapTab , thenOperands );
206193
207194 ((SqlCase ) selectNode ).setOperand (3 , replaceSelectFieldTabName (elseNode , mapTab ));
208195 return selectNode ;
@@ -214,6 +201,16 @@ public static SqlNode replaceSelectFieldTabName(SqlNode selectNode, Map<String,S
214201 }
215202 }
216203
204+ private static void replaceWhenOrThenSelectFieldTabName (Map <String , String > mapTab , SqlNodeList thenOperands ) {
205+ for (int i =0 ; i <thenOperands .size (); i ++){
206+ SqlNode oneOperand = thenOperands .get (i );
207+ SqlNode replaceNode = replaceSelectFieldTabName (oneOperand , mapTab );
208+ if (replaceNode != null ) {
209+ thenOperands .set (i , replaceNode );
210+ }
211+ }
212+ }
213+
217214 public static SqlNode replaceNodeInfo (SqlNode parseNode , Map <String , String > mapTab ) {
218215 if (parseNode .getKind () == IDENTIFIER ) {
219216 SqlIdentifier sqlIdentifier = (SqlIdentifier ) parseNode ;
0 commit comments