dcapwell commented on code in PR #2310:
URL: https://github.com/apache/cassandra/pull/2310#discussion_r1194053099


##########
src/java/org/apache/cassandra/cql3/Vectors.java:
##########
@@ -0,0 +1,216 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.cassandra.cql3;
+
+import java.nio.ByteBuffer;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.cassandra.cql3.functions.Function;
+import org.apache.cassandra.db.marshal.AbstractType;
+import org.apache.cassandra.db.marshal.ByteBufferAccessor;
+import org.apache.cassandra.db.marshal.ReversedType;
+import org.apache.cassandra.db.marshal.VectorType;
+import org.apache.cassandra.exceptions.InvalidRequestException;
+import org.apache.cassandra.serializers.MarshalException;
+import org.apache.cassandra.transport.ProtocolVersion;
+import org.apache.cassandra.utils.ByteBufferUtil;
+
+public class Vectors

Review Comment:
   > Ok, looking at this again, I can see that a vector method has been added 
to allow the usage of vectors in CQLTester
   
   CQLTester does *not* use the schema to figure out how to serialize bind 
values, it uses java types to figure that out; for this reason `List` can be 
confusing, so added a `Vector` type in `CQLTester` only for this work.
   
   > but I'm still slightly confused about what the drivers will eventually 
accept for binding values
   
   I believe this is up to drivers... the CQL syntax matches `list`, so to me 
accepting the same types makes sense.  Java driver *could* accept array, but 
that adds a lot of complexity to the driver I would think as you would need a 
serializer for every primitive as well.  
   
   I guess this all boils down to how driver works; if you know the schema then 
it doesn't matter too much, but if you do not know the schema (such as 
`CQLTester`) then you would need type support to figure this out... I *feel* 
like we have to know the schema as stuff like `python` would need this?  Not 
familiar with that layer so can not say...
   
   I feel the worst case scenario is to add a `Vector` type to each driver, 
similar to how tuples/udts work... I would personally find that more annoying 
than working with a `List` in java, but it does solve the type mapping to 
serializer if we don't leverage the schema.
   
   > As in what is the wire representation going to be?
   
   There are 2 different protocols: fixed length, and variable length.
   
   For fixed length types, the format is `N` sequence of bytes where those 
bytes are the serialized format of the type; below is a int example
   
   ```
   int
   int
   int
   ...
   int
   ```
   
   For variable length types, the format is the same as `ListType`, but without 
the list size prefix at the top, so its
   
   ```
   (
   element_size: int
   element_bytes: byte[]
   )+
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to