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

Andres de la Peña edited comment on CASSANDRA-18613 at 6/20/23 6:05 PM:
------------------------------------------------------------------------

Just updated the patch for supporting vectors of variable-length elements, such 
as {{{}varint{}}}, {{{}text{}}}, etc. The patch is 
[here|https://github.com/adelapena/cassandra/commit/07e11b091fa3df03a10913e8a101c76df3f7796f].

By the way, I think that vectors of variable-length elements are [not currently 
supported by the Java 
driver|https://github.com/datastax/java-driver/blob/cfeb55f8ba9c35bd3b19c9442b429a564b565440/core/src/main/java/com/datastax/oss/driver/internal/core/type/codec/CqlVectorCodec.java#L91-L95].

The driver uses a dedicated 
[{{CqlVector}}|https://github.com/datastax/java-driver/blob/cfeb55f8ba9c35bd3b19c9442b429a564b565440/core/src/main/java/com/datastax/oss/driver/api/core/data/CqlVector.java]
 class to represent vector values. However, for the UDF codec I have preferred 
to just represent vectors as Java lists. The reason is that I think that it's 
easier for users writing a UDF to simply generate new vector values as 
instances of a standard Java class. Using a non-standard class can be a bit 
cumbersome when trying to fit code in the restricted environment of a UDF, and 
it doesn't seem to provide any additional value.


was (Author: adelapena):
Just updated the patch for supporting vectors of variable-length elements, such 
as {{{}varint{}}}, {{{}text{}}}, etc. The patch is 
[here|https://github.com/adelapena/cassandra/commit/07e11b091fa3df03a10913e8a101c76df3f7796f].

By the way, I think that vectors of variable-length elements are [not currently 
supported by the Java 
driver|https://github.com/datastax/java-driver/blob/cfeb55f8ba9c35bd3b19c9442b429a564b565440/core/src/main/java/com/datastax/oss/driver/internal/core/type/codec/CqlVectorCodec.java#L91-L95].

The driver uses a dedicated 
[{{CqlVector}}|https://github.com/datastax/java-driver/blob/cfeb55f8ba9c35bd3b19c9442b429a564b565440/core/src/main/java/com/datastax/oss/driver/api/core/data/CqlVector.java]
 class to represent vector values. However, for the UDF codec I have preferred 
to just represent vectors as a list. The reason is that I think that it's 
easier for users writing a UDF to simply generate new vector values as standard 
Java lists. Using a non-standard class can be a bit cumbersome when trying to 
fit code in the restricted environment of a UDF, and it doesn't seem to provide 
any additional value.

> Add support for vectors on UDFs
> -------------------------------
>
>                 Key: CASSANDRA-18613
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-18613
>             Project: Cassandra
>          Issue Type: New Feature
>          Components: Cluster/Schema
>            Reporter: Andres de la Peña
>            Assignee: Andres de la Peña
>            Priority: Normal
>             Fix For: 5.x
>
>
> CASSANDRA-18504 will add a new vector type, but [it won't be supported on 
> UDFs|https://github.com/apache/cassandra/blob/5027e688da006e5d5bf9bfdf4719caddbf85986a/test/unit/org/apache/cassandra/cql3/validation/operations/CQLVectorTest.java#L248-L271].
>  The goal of this ticket is to add that support.
> This will require adding a new {{o.a.c.cql3.functions.types.TypeCodec}} for 
> vectors. Those codecs are mostly duplicates of the codecs on the Java driver. 
> They are used for UDFs instead of the regular {{AbstractType}} to prevent 
> pulling too many internal dependencies. The driver's vector codec has 
> recently been added by 
> [JAVA-3060|https://datastax-oss.atlassian.net/browse/JAVA-3060].



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

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to