diff --git a/CHANGES.txt b/CHANGES.txt index 75c478c4a3..5cb4f1db9f 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -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) diff --git a/pylib/cqlshlib/copyutil.py b/pylib/cqlshlib/copyutil.py index 3f7c091bb9..987a125d14 100644 --- a/pylib/cqlshlib/copyutil.py +++ b/pylib/cqlshlib/copyutil.py @@ -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)