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

Anuja Mandlecha commented on CASSANDRA-6538:
--------------------------------------------

I looked into the code and as per you requirement of allowing only blob types 
as input to sizeof() we will have to check the datatype of providedArgs against 
BytesType which is used for BLOB using the condition
{code}
if(fun.name().equalsIgnoreCase("sizeof")&& 
!args.get(0).getType().equals(BytesType.instance))
                    throw new InvalidRequestException(String.format("Type 
error: %s cannot be passed as argument 0 of function %s of type blob", 
args.get(0), fun.name()));
{code}
But as we can see in attached CodeSnippet.txt, to apply the same condition in 
validateTpes() where other validations are being done, we need getType() of 
providedArgs which we cannot get here since it is an object of class that 
implements interface AssignementTestable.
Hence to resolve this there can be two approaches,
1. Add one more argument of type Function to isAssignable() and check for the 
functionName and valid types and return value accordingly.
2. Use the if condition before calling validateTypes() (i.e. in makeSelector() 
of Selection class)
Note: Approach 1 can result into a lot of code change since the function 
declaration is getting changed.
Please let me know your thoughts on this.

> Provide a read-time CQL function to display the data size of columns and rows
> -----------------------------------------------------------------------------
>
>                 Key: CASSANDRA-6538
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-6538
>             Project: Cassandra
>          Issue Type: Improvement
>            Reporter: Johnny Miller
>            Priority: Minor
>              Labels: cql
>         Attachments: 6538.patch, sizeFzt.PNG
>
>
> It would be extremely useful to be able to work out the size of rows and 
> columns via CQL. 



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to