You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "Andres de la Peña (Jira)" <ji...@apache.org> on 2023/03/21 14:13:00 UTC

[jira] [Commented] (CASSANDRA-18037) Use snake case for the names CQL native functions

    [ https://issues.apache.org/jira/browse/CASSANDRA-18037?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17703224#comment-17703224 ] 

Andres de la Peña commented on CASSANDRA-18037:
-----------------------------------------------

Here is the patch adopting the new naming conventions for native CQL functions:

||PR||CI||
|[trunk|https://github.com/apache/cassandra/pull/2236]|[j8|https://app.circleci.com/pipelines/github/adelapena/cassandra/2721/workflows/ec2cb321-5cea-4364-9ba7-3048c19ae706] [j11|https://app.circleci.com/pipelines/github/adelapena/cassandra/2721/workflows/1513002f-d37e-49a4-9ef7-c76b77ecab84]|
|[dtest|https://github.com/apache/cassandra-dtest/pull/217]||

The approach for compatibility with old function names consists on simply having two instances of each renamed function, one with the new name and another with the old name.

The reason for not simply having duplicated entries on [{{NativeFunctions.functions}}|https://github.com/apache/cassandra/blob/trunk/src/java/org/apache/cassandra/cql3/functions/NativeFunctions.java#L53] pointing to the same function instance is that the functions use their own names to produce the associated column names in query results, print error messages, etc.

The list of new function names is:

||Old name||New name||
|castAsAscii|cast_as_ascii|
|castAsBigint|cast_as_bigint|
|castAsDate|cast_as_date|
|castAsDecimal|cast_as_decimal|
|castAsDouble|cast_as_double|
|castAsFloat|cast_as_float|
|castAsInt|cast_as_int|
|castAsSmallint|cast_as_smallint|
|castAsText|cast_as_text|
|castAsTimestamp|cast_as_timestamp|
|castAsTinyint|cast_as_tinyint|
|castAsVarint|cast_as_varint|
|blobasascii|blob_as_ascii|
|blobasbigint|blob_as_bigint|
|blobasboolean|blob_as_boolean|
|blobascounter|blob_as_counter|
|blobasdate|blob_as_date|
|blobasdecimal|blob_as_decimal|
|blobasdouble|blob_as_double|
|blobasduration|blob_as_duration|
|blobasempty|blob_as_empty|
|blobasfloat|blob_as_float|
|blobasinet|blob_as_inet|
|blobasint|blob_as_int|
|blobassmallint|blob_as_smallint|
|blobastext|blob_as_text|
|blobastime|blob_as_time|
|blobastimestamp|blob_as_timestamp|
|blobastimeuuid|blob_as_timeuuid|
|blobastinyint|blob_as_tinyint|
|blobasuuid|blob_as_uuid|
|blobasvarchar|blob_as_varchar|
|blobasvarint|blob_as_varint|
|asciiasblob|ascii_as_blob|
|bigintasblob|bigint_as_blob|
|booleanasblob|boolean_as_blob|
|counterasblob|counter_as_blob|
|dateasblob|date_as_blob|
|decimalasblob|decimal_as_blob|
|doubleasblob|double_as_blob|
|durationasblob|duration_as_blob|
|emptyasblob|empty_as_blob|
|floatasblob|float_as_blob|
|inetasblob|inet_as_blob|
|intasblob|int_as_blob|
|smallintasblob|smallint_as_blob|
|textasblob|text_as_blob|
|timeasblob|time_as_blob|
|timestampasblob|timestamp_as_blob|
|timeuuidasblob|timeuuid_as_blob|
|tinyintasblob|tinyint_as_blob|
|uuidasblob|uuid_as_blob|
|varcharasblob|varchar_as_blob|
|varintasblob|varint_as_blob|
|countRows|count_rows|
|maxtimeuuid|max_timeuuid|
|mintimeuuid|min_timeuuid|
|currentdate|current_date|
|currenttime|current_time|
|currenttimestamp|current_timestamp|
|currenttimeuuid|current_timeuuid|
|todate|to_date|
|totimestamp|to_timestamp|
|tounixtimestamp|to_unix_timestamp|


> Use snake case for the names CQL native functions
> -------------------------------------------------
>
>                 Key: CASSANDRA-18037
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-18037
>             Project: Cassandra
>          Issue Type: Improvement
>          Components: CQL/Syntax
>            Reporter: Andres de la Peña
>            Assignee: Andres de la Peña
>            Priority: Normal
>
> Most native functions are named all lower case, without underscore nor
> hyphen to separate words. That's the case, for example, of "intasblob" or
> "blobasint".
> We also have some functions using camel case, as in "castAsInt" or
> "castAsTimestamp". Note that the came cased names require quoting due to
> CQL's case insensitivity.
> Differently to CQL native functions, system keyspaces, tables and columns
> consistently use snake case. For example, we have "system_schema",
> "dropped_columns", "default_time_to_live".
> As discussed in [this thread|https://lists.apache.org/thread/k9ml1k4fg6o7mfby1nr3y0mnq9r90dym], we should adopt snake_case for CQL native function names. Also we should provide aliases for the current function names, so we don't break compatibility.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

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