mirror of https://github.com/apache/cassandra
merge from 1.1
This commit is contained in:
commit
1143df1aa4
|
|
@ -13,6 +13,8 @@
|
|||
* Future-proof inter-major-version schema migrations (CASSANDRA-5845)
|
||||
* (Hadoop) add CqlPagingRecordReader support for ReversedType in Thrift table
|
||||
(CASSANDRA-5718)
|
||||
Merged from 1.1:
|
||||
* Correctly validate sparse composite cells in scrub (CASSANDRA-5855)
|
||||
|
||||
|
||||
1.2.8
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ import java.util.Collection;
|
|||
import java.util.List;
|
||||
|
||||
import org.apache.cassandra.config.CFMetaData;
|
||||
import org.apache.cassandra.cql3.CFDefinition;
|
||||
import org.apache.cassandra.db.marshal.*;
|
||||
import org.apache.cassandra.io.util.DataOutputBuffer;
|
||||
import org.apache.cassandra.utils.Allocator;
|
||||
|
|
@ -287,7 +288,23 @@ public class Column implements IColumn
|
|||
public void validateFields(CFMetaData metadata) throws MarshalException
|
||||
{
|
||||
validateName(metadata);
|
||||
AbstractType<?> valueValidator = metadata.getValueValidator(name());
|
||||
CFDefinition cfdef = metadata.getCfDef();
|
||||
|
||||
// If this is a CQL table, we need to pull out the CQL column name to look up the correct column type.
|
||||
// (Note that COMPACT composites are handled by validateName, above.)
|
||||
ByteBuffer internalName;
|
||||
if (cfdef.isComposite && !cfdef.isCompact)
|
||||
{
|
||||
CompositeType comparator = (CompositeType) metadata.comparator;
|
||||
List<AbstractCompositeType.CompositeComponent> components = comparator.deconstruct(name);
|
||||
internalName = components.get(components.size() - 1).value;
|
||||
}
|
||||
else
|
||||
{
|
||||
internalName = name;
|
||||
}
|
||||
|
||||
AbstractType<?> valueValidator = metadata.getValueValidator(internalName);
|
||||
if (valueValidator != null)
|
||||
valueValidator.validate(value());
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue