twalthr commented on a change in pull request #18858:
URL: https://github.com/apache/flink/pull/18858#discussion_r812628434



##########
File path: 
flink-table/flink-table-planner/src/main/java/org/apache/flink/table/planner/functions/sql/BuiltInSqlOperator.java
##########
@@ -74,4 +74,16 @@ static String toQualifiedName(SqlOperator operator) {
         }
         return qualifyFunctionName(operator.getName(), DEFAULT_VERSION);
     }
+
+    static String extractNameFromQualifiedName(String qualifiedName) {
+        // supports all various kinds of qualified names
+        // $FUNC$1 => FUNC
+        // $IS NULL$1 => IS NULL
+        // $$CALCITE_INTERNAL$1 => $CALCITE_INTERNAL
+        int versionPos = qualifiedName.length() - 1;
+        while (Character.isDigit(qualifiedName.charAt(versionPos))) {
+            versionPos--;
+        }
+        return qualifiedName.substring(1, versionPos);
+    }

Review comment:
       This logic does not break with UTF-16 strings. both `length()` and 
`charAt` work with special characters. And special characters should also never 
occur in built-in functions as the INTERNAL_NAME_PATTERN (see above) only 
allows `A-Z`.




-- 
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