Allow empty string in collections with COPY FROM in cqlsh

Patch by Aleksandr Soromoukov, reviewed by brandonwilliams for
CASSANDRA-16372
This commit is contained in:
Aleksandr Sorokoumov 2021-01-09 16:53:51 +01:00 committed by Brandon Williams
parent c1008cc1ea
commit a542b86504
2 changed files with 5 additions and 2 deletions

View File

@ -1,4 +1,5 @@
3.0.24:
* Allow empty string in collections with COPY FROM in cqlsh (CASSANDRA-16372)
* Fix skipping on pre-3.0 created compact storage sstables due to missing primary key liveness (CASSANDRA-16226)
* Fix DecimalDeserializer#toString OOM (CASSANDRA-14925)
* Extend the exclusion of replica filtering protection to other indices instead of just SASI (CASSANDRA-16311)

View File

@ -45,7 +45,7 @@ from util import profile_on, profile_off
from cassandra import OperationTimedOut
from cassandra.cluster import Cluster, DefaultConnection
from cassandra.cqltypes import ReversedType, UserType
from cassandra.cqltypes import ReversedType, UserType, VarcharType
from cassandra.metadata import protect_name, protect_names, protect_value
from cassandra.policies import RetryPolicy, WhiteListRoundRobinPolicy, DCAwareRoundRobinPolicy, FallthroughRetryPolicy
from cassandra.query import BatchStatement, BatchType, SimpleStatement, tuple_factory
@ -1841,7 +1841,9 @@ class ImportConversion(object):
def convert_mandatory(t, v):
v = unprotect(v)
if v == self.nullval:
# we can't distinguish between empty strings and null values in csv. Null values are not supported in
# collections, so it must be an empty string.
if v == self.nullval and not issubclass(t, VarcharType):
raise ParseError('Empty values are not allowed')
return converters.get(t.typename, convert_unknown)(v, ct=t)