You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@seatunnel.apache.org by "zhangxiang-ola (via GitHub)" <gi...@apache.org> on 2024/09/19 10:43:24 UTC

Re: [I] [Bug] [transfor-v2] SQL transform plugin reports error when parsing fields starting with numbers [seatunnel]

zhangxiang-ola commented on issue #7505:
URL: https://github.com/apache/seatunnel/issues/7505#issuecomment-2360640242

   Version 2.3.7 can solve my problem.
    version 2.3.5 Zetaengine parse SelectExpressionItem:
   `SelectExpressionItem expressionItem = (SelectExpressionItem) selectItem;
                   Expression expression = expressionItem.getExpression();
   
                   if (expressionItem.getAlias() != null) {
                       fieldNames[idx] = expressionItem.getAlias().getName();
                   } else {
                       if (expression instanceof Column) {
                           fieldNames[idx] = ((Column) expression).getColumnName();
                       } else {
                           fieldNames[idx] = expression.toString();
                       }
                   }`
   
   version 2.3.7 Zetaengine parse SelectExpressionItem:
   ` SelectExpressionItem expressionItem = (SelectExpressionItem) selectItem;
                   Expression expression = expressionItem.getExpression();
                   if (expressionItem.getAlias() != null) {
                       String aliasName = expressionItem.getAlias().getName();
                       if (aliasName.startsWith(ESCAPE_IDENTIFIER)
                               && aliasName.endsWith(ESCAPE_IDENTIFIER)) {
                           aliasName = aliasName.substring(1, aliasName.length() - 1);
                       }
                       fieldNames[idx] = aliasName;
                   } else {
                       if (expression instanceof Column) {
                           fieldNames[idx] = ((Column) expression).getColumnName();
                       } else {
                           fieldNames[idx] = expression.toString();
                       }
                   }`


-- 
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: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org