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

vincent royer edited comment on CASSANDRA-13267 at 3/16/17 9:40 PM:
--------------------------------------------------------------------

Well, deserializer.toString() returns a string representation that fit my needs 
(ByteType = signed decimal integer, BytesType = hexadecimal string), but as 
suggested by Sylvain, here is a working proposal to be able to support 
pluggable generic CQL functions, only for SELECT statement. 

By default, toJson would be the only registered generic function, but anyone 
could programmatically register other generic functions by calling 
GenericFunctionRegistry.registerFunction, or implements the 
IGenericFunction.Loader to automatically register functions available in the 
classpath. This would require to add a file 
META-INF/services/org.apache.cassandra.cql3.functions.IGenericFunction$Loader 
containing function classes (see java.util.ServiceLoader) and anyone could drop 
a jar file in cassandra lib directory to add some CQL generic functions 
(including my private weird functions, toString + toJsonArray ;-)).

include unit tests OK, branch available at 
https://github.com/strapdata/cassandra/tree/cassandra-13267



was (Author: vroyer59):
Well, deserializer.toString() returns a string representation that fit my needs 
(ByteType = signed decimal integer, BytesType = hexadecimal string), but as 
suggested by Sylvain, here is a working proposal to be able to support 
pluggable generic CQL functions, only for SELECT statement. 

By default, toJson would be the only registered generic function, but anyone 
could programmatically registers other generic functions by calling 
GenericFunctionRegistry.registerFunction, or implements the 
IGenericFunction.Loader to automatically register functions available in the 
classpath. This would require to add a file 
META-INF/services/org.apache.cassandra.cql3.functions.IGenericFunction$Loader 
containing function classes (see java.util.ServiceLoader) and anyone could drop 
a jar file in cassandra lib directory to add some CQL generic functions 
(including my private weird functions, toString + toJsonArray ;-)).

include unit tests OK, branch available at 
https://github.com/strapdata/cassandra/tree/cassandra-13267


> Add new CQL functions
> ---------------------
>
>                 Key: CASSANDRA-13267
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-13267
>             Project: Cassandra
>          Issue Type: Improvement
>          Components: CQL
>            Reporter: vincent royer
>            Priority: Trivial
>              Labels: features
>             Fix For: 3.0.x
>
>         Attachments: 0001-CASSANDRA-13267-Add-CQL-functions.patch, 
> 0001-CASSANDRA-13267-generic-function.patch
>
>
> Introduce 2 new CQL functions :
> -toString(x) converts a column to its string representation.
> -toJsonArray(x, y, z...) generates a JSON array of JSON string.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to