You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pr@cassandra.apache.org by "adelapena (via GitHub)" <gi...@apache.org> on 2023/04/03 12:33:29 UTC

[GitHub] [cassandra] adelapena commented on a diff in pull request #2236: CASSANDRA-18037 trunk: Use snake case for the names CQL native functions

adelapena commented on code in PR #2236:
URL: https://github.com/apache/cassandra/pull/2236#discussion_r1155900652


##########
src/java/org/apache/cassandra/cql3/functions/CastFcts.java:
##########
@@ -126,25 +130,38 @@ private static <I extends Number> java.util.function.Function<I, BigDecimal> get
     }
 
     /**
-     * Creates the name of the cast function use to cast to the specified type.
+     * Creates the snake-cased name of the cast function used to cast to the specified type.
      *
      * @param outputType the output type
-     * @return the name of the cast function use to cast to the specified type
+     * @return the name of the cast function used to cast to the specified type
      */
-    public static String getFunctionName(AbstractType<?> outputType)
+    public static String getFunctionName(CQL3Type outputType)
     {
-        return getFunctionName(outputType.asCQL3Type());
+        return FUNCTION_NAME_PREFIX + toLowerCaseString(outputType);
     }
 
     /**
-     * Creates the name of the cast function use to cast to the specified type.
+     * Creates the legacy camel-cased name of the cast function used to cast to the specified type.
      *
      * @param outputType the output type
-     * @return the name of the cast function use to cast to the specified type
+     * @return the legacy camel-cased name of the cast function used to cast to the specified type
      */
-    public static String getFunctionName(CQL3Type outputType)
+    private static String getLegacyFunctionName(CQL3Type outputType)
+    {
+        return LEGACY_FUNCTION_NAME_PREFIX + WordUtils.capitalize(toLowerCaseString(outputType));

Review Comment:
   It would, since the first word be capitalized independently of spaces or underscores. For example, `int` would become `Int`.
   
   What we could do here, by the way, is replacing the deprecated `WordUtils.capitalize` by the newer `StringUtils.capitalize`.



-- 
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: pr-unsubscribe@cassandra.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org