Maxwell-Guo commented on code in PR #2957:
URL: https://github.com/apache/cassandra/pull/2957#discussion_r1415848445


##########
pylib/cqlshlib/copyutil.py:
##########
@@ -2130,6 +2136,7 @@ def convert_unknown(val, ct=cql_type):
             'map': convert_map,
             'tuple': convert_tuple,
             'frozen': convert_single_subtype,
+            VectorType.typename: convert_vector,

Review Comment:
   > @Maxwell-Guo you mean like using `convert_unknown` for vector and then 
convert vector in it? That would make sense, sure. But on the other hand, are 
not we abusing the usage of `convert_unknown` ? What is _unknown_ about 
_vector_? Nothing ... vector is perfectly known. So why would we use 
`convert_unknown` then ...
   
   I agree with what you have sad and I also think literal should be used. 
After roughly looking at the relevant code, I found that the type prefixed with 
“org.apache.cassandra.db.marshal” like UserType, ReserveType are all going into 
the convert_unknown function, So I just give a suggestion without modifying the 
 Python driver (I think the best way is modify the driver). Then we can keep  
the converters clean and get a right result. 
   
   As for whether it is an unknown type, there is also a way to say it, such as 
ReserveType is putting into convert_unknown, and see [the debug msg print 
](https://github.com/apache/cassandra/tree/trunk/pylib/cqlshlib#L2104) ,it 
seems that only those that enter convert_unknown and are not UserType and 
ReserveType are call Unknow type .
   
   Of course, just some personal opinions.  



##########
pylib/cqlshlib/copyutil.py:
##########
@@ -2130,6 +2136,7 @@ def convert_unknown(val, ct=cql_type):
             'map': convert_map,
             'tuple': convert_tuple,
             'frozen': convert_single_subtype,
+            VectorType.typename: convert_vector,

Review Comment:
   > @Maxwell-Guo you mean like using `convert_unknown` for vector and then 
convert vector in it? That would make sense, sure. But on the other hand, are 
not we abusing the usage of `convert_unknown` ? What is _unknown_ about 
_vector_? Nothing ... vector is perfectly known. So why would we use 
`convert_unknown` then ...
   
   I agree with what you have sad and I also think literal should be used. 
After roughly looking at the relevant code, I found that the type prefixed with 
“org.apache.cassandra.db.marshal” like UserType, ReserveType are all going into 
the convert_unknown function, So I just give a suggestion without modifying the 
 Python driver (I think the best way is modify the driver). Then we can keep  
the converters clean and get a right result. 
   
   As for whether it is an unknown type, there is also a way to say it, such as 
ReserveType is putting into convert_unknown, and see [the debug msg print 
](https://github.com/apache/cassandra/tree/trunk/pylib/cqlshlib#L2104) ,it 
seems that only those that enter convert_unknown and are not UserType and 
ReserveType are call Unknow type .
   
   Of course, just some personal opinions.  



-- 
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