Hisoka-X commented on code in PR #6484:
URL: https://github.com/apache/seatunnel/pull/6484#discussion_r1524157779


##########
seatunnel-transforms-v2/src/main/java/org/apache/seatunnel/transform/sql/zeta/ZetaSQLFunction.java:
##########
@@ -199,8 +202,29 @@ public Object computeForValue(Expression expression, 
Object[] inputFields) {
             return ((StringValue) expression).getValue();
         }
         if (expression instanceof Column) {
-            int idx = inputRowType.indexOf(((Column) 
expression).getColumnName());
-            return inputFields[idx];
+            Column columnExp = (Column) expression;
+            try {
+                String columnName = columnExp.getColumnName();
+                int idx = inputRowType.indexOf(columnName);
+                return inputFields[idx];
+            } catch (IllegalArgumentException e) {

Review Comment:
   Can you add a new `indexOf` method in `SeaTunnelRowType` which no 
IllegalArgumentException exception is thrown. Then use the result of the index 
to determine whether there is a corresponding fieldname. Because data 
processing is performed through try catch at now, the performance is 
particularly bad.



##########
seatunnel-e2e/seatunnel-transforms-v2-e2e/seatunnel-transforms-v2-e2e-part-2/src/test/java/org/apache/seatunnel/e2e/transform/TestSQLIT.java:
##########
@@ -58,4 +60,14 @@ public void testSQLTransform(TestContainer container) throws 
IOException, Interr
         Container.ExecResult caseWhenSql = 
container.executeJob("/sql_transform/case_when.conf");
         Assertions.assertEquals(0, caseWhenSql.getExitCode());
     }
+
+    @TestTemplate
+    @DisabledOnContainer(
+            value = {},
+            type = {EngineType.SPARK})

Review Comment:
   Hi @liunaijie . Why disabled on spark?



##########
seatunnel-transforms-v2/src/main/java/org/apache/seatunnel/transform/sql/zeta/ZetaSQLType.java:
##########
@@ -101,8 +102,32 @@ public SeaTunnelDataType<?> getExpressionType(Expression 
expression) {
             return BasicType.STRING_TYPE;
         }
         if (expression instanceof Column) {
-            String columnName = ((Column) expression).getColumnName();
-            return inputRowType.getFieldType(inputRowType.indexOf(columnName));
+            Column columnExp = (Column) expression;
+            try {
+                String columnName = columnExp.getColumnName();
+                return 
inputRowType.getFieldType(inputRowType.indexOf(columnName));
+            } catch (IllegalArgumentException e) {

Review Comment:
   ditto



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to