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

Nikhil edited comment on CASSANDRA-19890 at 9/17/24 7:00 AM:
-------------------------------------------------------------

Hello [~dcapwell],

Firstly, this is my first time in trying to make contribution in the opensource 
project.

I tried to look at the code and the issue you have mentioned and tried to run 
it.
 # I am able to insert the data in case of DurationType and 
ListType(DurationType) and as per the functionality not able to create the 
index on "with_duration".
 # but I am not able to insert the data in case of 
'CompositeType(ListType(DurationType))', can you please help me in this how can 
I insert the data in this case?
 # !image-2024-09-07-22-22-00-382.png!

!image-2024-09-07-22-20-38-433.png!

!image-2024-09-07-22-18-35-109.png!

Is it like you want that when we create the DurationType inside the 
CompositeType then at time of Defining the INDEX using "CREATE INDEX" it should 
throw the error?

 


was (Author: JIRAUSER306929):
Hello [~dcapwell],

Firstly, this is my first time in trying to make contribution in the opensource 
project.

I tried to look at the code and the issue you have mentioned and tried to run 
it.
 # I am able to insert the data in case of DurationType and 
ListType(DurationType) and as per the functionality not able to create the 
index on "with_duration".
 # but I am not able to insert the data in case of 
'CompositeType(ListType(DurationType))', can you please help me in this how can 
I insert the data in this case?
 # !image-2024-09-07-22-22-00-382.png!

!image-2024-09-07-22-20-38-433.png!

!image-2024-09-07-22-18-35-109.png!

Is it like you want that when we create the DurationType inside the 
CompositeType then at time of Defining the INDEX using "CREATE INDEX" it should 
through the error?

 

> type system contains check for duration does not work for hidden types
> ----------------------------------------------------------------------
>
>                 Key: CASSANDRA-19890
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-19890
>             Project: Cassandra
>          Issue Type: Bug
>          Components: CQL/Interpreter
>            Reporter: David Capwell
>            Priority: Normal
>             Fix For: 5.x
>
>         Attachments: image-2024-09-07-22-18-35-109.png, 
> image-2024-09-07-22-20-38-433.png, image-2024-09-07-22-22-00-382.png
>
>
> The function 
> "org.apache.cassandra.db.marshal.AbstractType#referencesDuration” relies on 
> type overriding for detecting if the type contains a duration, but the hidden 
> types like Composite or DynamicComposite don’t override this… this means that 
> we will be able to create a 2i index for these columns (unless we use SAI as 
> it properly detects this)
> {code}
> CREATE TABLE "tbl" (
>     "pk1" int,
>     "with_duration" 'CompositeType(ListType(DurationType))',
>     PRIMARY KEY ("pk1")
> );
> CREATE INDEX ON "tbl"("with_duration");
> {code}
> This is able to create the 2i index even though we shouldn’t be able to due 
> to duration not being allowed in indexes.
> We have a test method that is able to detect if a type exists in complex 
> types:
> {code}
> AbstractTypeGenerators.contains(type, DurationType.instance);
> {code}
> Could leverage the same logic to avoid maintenance burden with inheritance 



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

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

Reply via email to