Improve picking of comparator for composite column with CQL3

patch by slebresne; reviewed by jbellis for CASSANDRA-4093
This commit is contained in:
Sylvain Lebresne 2012-04-06 17:18:23 +02:00
parent 56dc5df7b4
commit 1ea2a60e84
21 changed files with 369 additions and 583 deletions

View File

@ -423,8 +423,6 @@ struct CfDef {
32: optional map<string,string> compression_options,
33: optional double bloom_filter_fp_chance,
34: optional string caching="keys_only",
35: optional list<binary> column_aliases,
36: optional binary value_alias,
37: optional double dclocal_read_repair_chance = 0.0,
/* All of the following are now ignored and unsupplied. */

View File

@ -7176,14 +7176,14 @@ public class Cassandra {
case 0: // SUCCESS
if (field.type == org.apache.thrift.protocol.TType.LIST) {
{
org.apache.thrift.protocol.TList _list95 = iprot.readListBegin();
this.success = new ArrayList<ColumnOrSuperColumn>(_list95.size);
for (int _i96 = 0; _i96 < _list95.size; ++_i96)
org.apache.thrift.protocol.TList _list91 = iprot.readListBegin();
this.success = new ArrayList<ColumnOrSuperColumn>(_list91.size);
for (int _i92 = 0; _i92 < _list91.size; ++_i92)
{
ColumnOrSuperColumn _elem97; // required
_elem97 = new ColumnOrSuperColumn();
_elem97.read(iprot);
this.success.add(_elem97);
ColumnOrSuperColumn _elem93; // required
_elem93 = new ColumnOrSuperColumn();
_elem93.read(iprot);
this.success.add(_elem93);
}
iprot.readListEnd();
}
@ -7233,9 +7233,9 @@ public class Cassandra {
oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
{
oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, this.success.size()));
for (ColumnOrSuperColumn _iter98 : this.success)
for (ColumnOrSuperColumn _iter94 : this.success)
{
_iter98.write(oprot);
_iter94.write(oprot);
}
oprot.writeListEnd();
}
@ -9035,13 +9035,13 @@ public class Cassandra {
case 1: // KEYS
if (field.type == org.apache.thrift.protocol.TType.LIST) {
{
org.apache.thrift.protocol.TList _list99 = iprot.readListBegin();
this.keys = new ArrayList<ByteBuffer>(_list99.size);
for (int _i100 = 0; _i100 < _list99.size; ++_i100)
org.apache.thrift.protocol.TList _list95 = iprot.readListBegin();
this.keys = new ArrayList<ByteBuffer>(_list95.size);
for (int _i96 = 0; _i96 < _list95.size; ++_i96)
{
ByteBuffer _elem101; // required
_elem101 = iprot.readBinary();
this.keys.add(_elem101);
ByteBuffer _elem97; // required
_elem97 = iprot.readBinary();
this.keys.add(_elem97);
}
iprot.readListEnd();
}
@ -9091,9 +9091,9 @@ public class Cassandra {
oprot.writeFieldBegin(KEYS_FIELD_DESC);
{
oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, this.keys.size()));
for (ByteBuffer _iter102 : this.keys)
for (ByteBuffer _iter98 : this.keys)
{
oprot.writeBinary(_iter102);
oprot.writeBinary(_iter98);
}
oprot.writeListEnd();
}
@ -9682,26 +9682,26 @@ public class Cassandra {
case 0: // SUCCESS
if (field.type == org.apache.thrift.protocol.TType.MAP) {
{
org.apache.thrift.protocol.TMap _map103 = iprot.readMapBegin();
this.success = new HashMap<ByteBuffer,List<ColumnOrSuperColumn>>(2*_map103.size);
for (int _i104 = 0; _i104 < _map103.size; ++_i104)
org.apache.thrift.protocol.TMap _map99 = iprot.readMapBegin();
this.success = new HashMap<ByteBuffer,List<ColumnOrSuperColumn>>(2*_map99.size);
for (int _i100 = 0; _i100 < _map99.size; ++_i100)
{
ByteBuffer _key105; // required
List<ColumnOrSuperColumn> _val106; // required
_key105 = iprot.readBinary();
ByteBuffer _key101; // required
List<ColumnOrSuperColumn> _val102; // required
_key101 = iprot.readBinary();
{
org.apache.thrift.protocol.TList _list107 = iprot.readListBegin();
_val106 = new ArrayList<ColumnOrSuperColumn>(_list107.size);
for (int _i108 = 0; _i108 < _list107.size; ++_i108)
org.apache.thrift.protocol.TList _list103 = iprot.readListBegin();
_val102 = new ArrayList<ColumnOrSuperColumn>(_list103.size);
for (int _i104 = 0; _i104 < _list103.size; ++_i104)
{
ColumnOrSuperColumn _elem109; // required
_elem109 = new ColumnOrSuperColumn();
_elem109.read(iprot);
_val106.add(_elem109);
ColumnOrSuperColumn _elem105; // required
_elem105 = new ColumnOrSuperColumn();
_elem105.read(iprot);
_val102.add(_elem105);
}
iprot.readListEnd();
}
this.success.put(_key105, _val106);
this.success.put(_key101, _val102);
}
iprot.readMapEnd();
}
@ -9751,14 +9751,14 @@ public class Cassandra {
oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
{
oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.LIST, this.success.size()));
for (Map.Entry<ByteBuffer, List<ColumnOrSuperColumn>> _iter110 : this.success.entrySet())
for (Map.Entry<ByteBuffer, List<ColumnOrSuperColumn>> _iter106 : this.success.entrySet())
{
oprot.writeBinary(_iter110.getKey());
oprot.writeBinary(_iter106.getKey());
{
oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, _iter110.getValue().size()));
for (ColumnOrSuperColumn _iter111 : _iter110.getValue())
oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, _iter106.getValue().size()));
for (ColumnOrSuperColumn _iter107 : _iter106.getValue())
{
_iter111.write(oprot);
_iter107.write(oprot);
}
oprot.writeListEnd();
}
@ -10346,13 +10346,13 @@ public class Cassandra {
case 1: // KEYS
if (field.type == org.apache.thrift.protocol.TType.LIST) {
{
org.apache.thrift.protocol.TList _list112 = iprot.readListBegin();
this.keys = new ArrayList<ByteBuffer>(_list112.size);
for (int _i113 = 0; _i113 < _list112.size; ++_i113)
org.apache.thrift.protocol.TList _list108 = iprot.readListBegin();
this.keys = new ArrayList<ByteBuffer>(_list108.size);
for (int _i109 = 0; _i109 < _list108.size; ++_i109)
{
ByteBuffer _elem114; // required
_elem114 = iprot.readBinary();
this.keys.add(_elem114);
ByteBuffer _elem110; // required
_elem110 = iprot.readBinary();
this.keys.add(_elem110);
}
iprot.readListEnd();
}
@ -10402,9 +10402,9 @@ public class Cassandra {
oprot.writeFieldBegin(KEYS_FIELD_DESC);
{
oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, this.keys.size()));
for (ByteBuffer _iter115 : this.keys)
for (ByteBuffer _iter111 : this.keys)
{
oprot.writeBinary(_iter115);
oprot.writeBinary(_iter111);
}
oprot.writeListEnd();
}
@ -10989,15 +10989,15 @@ public class Cassandra {
case 0: // SUCCESS
if (field.type == org.apache.thrift.protocol.TType.MAP) {
{
org.apache.thrift.protocol.TMap _map116 = iprot.readMapBegin();
this.success = new HashMap<ByteBuffer,Integer>(2*_map116.size);
for (int _i117 = 0; _i117 < _map116.size; ++_i117)
org.apache.thrift.protocol.TMap _map112 = iprot.readMapBegin();
this.success = new HashMap<ByteBuffer,Integer>(2*_map112.size);
for (int _i113 = 0; _i113 < _map112.size; ++_i113)
{
ByteBuffer _key118; // required
int _val119; // required
_key118 = iprot.readBinary();
_val119 = iprot.readI32();
this.success.put(_key118, _val119);
ByteBuffer _key114; // required
int _val115; // required
_key114 = iprot.readBinary();
_val115 = iprot.readI32();
this.success.put(_key114, _val115);
}
iprot.readMapEnd();
}
@ -11047,10 +11047,10 @@ public class Cassandra {
oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
{
oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.I32, this.success.size()));
for (Map.Entry<ByteBuffer, Integer> _iter120 : this.success.entrySet())
for (Map.Entry<ByteBuffer, Integer> _iter116 : this.success.entrySet())
{
oprot.writeBinary(_iter120.getKey());
oprot.writeI32(_iter120.getValue());
oprot.writeBinary(_iter116.getKey());
oprot.writeI32(_iter116.getValue());
}
oprot.writeMapEnd();
}
@ -12234,14 +12234,14 @@ public class Cassandra {
case 0: // SUCCESS
if (field.type == org.apache.thrift.protocol.TType.LIST) {
{
org.apache.thrift.protocol.TList _list121 = iprot.readListBegin();
this.success = new ArrayList<KeySlice>(_list121.size);
for (int _i122 = 0; _i122 < _list121.size; ++_i122)
org.apache.thrift.protocol.TList _list117 = iprot.readListBegin();
this.success = new ArrayList<KeySlice>(_list117.size);
for (int _i118 = 0; _i118 < _list117.size; ++_i118)
{
KeySlice _elem123; // required
_elem123 = new KeySlice();
_elem123.read(iprot);
this.success.add(_elem123);
KeySlice _elem119; // required
_elem119 = new KeySlice();
_elem119.read(iprot);
this.success.add(_elem119);
}
iprot.readListEnd();
}
@ -12291,9 +12291,9 @@ public class Cassandra {
oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
{
oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, this.success.size()));
for (KeySlice _iter124 : this.success)
for (KeySlice _iter120 : this.success)
{
_iter124.write(oprot);
_iter120.write(oprot);
}
oprot.writeListEnd();
}
@ -13486,14 +13486,14 @@ public class Cassandra {
case 0: // SUCCESS
if (field.type == org.apache.thrift.protocol.TType.LIST) {
{
org.apache.thrift.protocol.TList _list125 = iprot.readListBegin();
this.success = new ArrayList<KeySlice>(_list125.size);
for (int _i126 = 0; _i126 < _list125.size; ++_i126)
org.apache.thrift.protocol.TList _list121 = iprot.readListBegin();
this.success = new ArrayList<KeySlice>(_list121.size);
for (int _i122 = 0; _i122 < _list121.size; ++_i122)
{
KeySlice _elem127; // required
_elem127 = new KeySlice();
_elem127.read(iprot);
this.success.add(_elem127);
KeySlice _elem123; // required
_elem123 = new KeySlice();
_elem123.read(iprot);
this.success.add(_elem123);
}
iprot.readListEnd();
}
@ -13543,9 +13543,9 @@ public class Cassandra {
oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
{
oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, this.success.size()));
for (KeySlice _iter128 : this.success)
for (KeySlice _iter124 : this.success)
{
_iter128.write(oprot);
_iter124.write(oprot);
}
oprot.writeListEnd();
}
@ -14729,14 +14729,14 @@ public class Cassandra {
case 0: // SUCCESS
if (field.type == org.apache.thrift.protocol.TType.LIST) {
{
org.apache.thrift.protocol.TList _list129 = iprot.readListBegin();
this.success = new ArrayList<KeySlice>(_list129.size);
for (int _i130 = 0; _i130 < _list129.size; ++_i130)
org.apache.thrift.protocol.TList _list125 = iprot.readListBegin();
this.success = new ArrayList<KeySlice>(_list125.size);
for (int _i126 = 0; _i126 < _list125.size; ++_i126)
{
KeySlice _elem131; // required
_elem131 = new KeySlice();
_elem131.read(iprot);
this.success.add(_elem131);
KeySlice _elem127; // required
_elem127 = new KeySlice();
_elem127.read(iprot);
this.success.add(_elem127);
}
iprot.readListEnd();
}
@ -14786,9 +14786,9 @@ public class Cassandra {
oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
{
oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, this.success.size()));
for (KeySlice _iter132 : this.success)
for (KeySlice _iter128 : this.success)
{
_iter132.write(oprot);
_iter128.write(oprot);
}
oprot.writeListEnd();
}
@ -17733,8 +17733,6 @@ public class Cassandra {
private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
try {
// it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
__isset_bit_vector = new BitSet(1);
read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
} catch (org.apache.thrift.TException te) {
throw new java.io.IOException(te);
@ -19633,38 +19631,38 @@ public class Cassandra {
case 1: // MUTATION_MAP
if (field.type == org.apache.thrift.protocol.TType.MAP) {
{
org.apache.thrift.protocol.TMap _map133 = iprot.readMapBegin();
this.mutation_map = new HashMap<ByteBuffer,Map<String,List<Mutation>>>(2*_map133.size);
for (int _i134 = 0; _i134 < _map133.size; ++_i134)
org.apache.thrift.protocol.TMap _map129 = iprot.readMapBegin();
this.mutation_map = new HashMap<ByteBuffer,Map<String,List<Mutation>>>(2*_map129.size);
for (int _i130 = 0; _i130 < _map129.size; ++_i130)
{
ByteBuffer _key135; // required
Map<String,List<Mutation>> _val136; // required
_key135 = iprot.readBinary();
ByteBuffer _key131; // required
Map<String,List<Mutation>> _val132; // required
_key131 = iprot.readBinary();
{
org.apache.thrift.protocol.TMap _map137 = iprot.readMapBegin();
_val136 = new HashMap<String,List<Mutation>>(2*_map137.size);
for (int _i138 = 0; _i138 < _map137.size; ++_i138)
org.apache.thrift.protocol.TMap _map133 = iprot.readMapBegin();
_val132 = new HashMap<String,List<Mutation>>(2*_map133.size);
for (int _i134 = 0; _i134 < _map133.size; ++_i134)
{
String _key139; // required
List<Mutation> _val140; // required
_key139 = iprot.readString();
String _key135; // required
List<Mutation> _val136; // required
_key135 = iprot.readString();
{
org.apache.thrift.protocol.TList _list141 = iprot.readListBegin();
_val140 = new ArrayList<Mutation>(_list141.size);
for (int _i142 = 0; _i142 < _list141.size; ++_i142)
org.apache.thrift.protocol.TList _list137 = iprot.readListBegin();
_val136 = new ArrayList<Mutation>(_list137.size);
for (int _i138 = 0; _i138 < _list137.size; ++_i138)
{
Mutation _elem143; // required
_elem143 = new Mutation();
_elem143.read(iprot);
_val140.add(_elem143);
Mutation _elem139; // required
_elem139 = new Mutation();
_elem139.read(iprot);
_val136.add(_elem139);
}
iprot.readListEnd();
}
_val136.put(_key139, _val140);
_val132.put(_key135, _val136);
}
iprot.readMapEnd();
}
this.mutation_map.put(_key135, _val136);
this.mutation_map.put(_key131, _val132);
}
iprot.readMapEnd();
}
@ -19698,19 +19696,19 @@ public class Cassandra {
oprot.writeFieldBegin(MUTATION_MAP_FIELD_DESC);
{
oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.MAP, this.mutation_map.size()));
for (Map.Entry<ByteBuffer, Map<String,List<Mutation>>> _iter144 : this.mutation_map.entrySet())
for (Map.Entry<ByteBuffer, Map<String,List<Mutation>>> _iter140 : this.mutation_map.entrySet())
{
oprot.writeBinary(_iter144.getKey());
oprot.writeBinary(_iter140.getKey());
{
oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.LIST, _iter144.getValue().size()));
for (Map.Entry<String, List<Mutation>> _iter145 : _iter144.getValue().entrySet())
oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.LIST, _iter140.getValue().size()));
for (Map.Entry<String, List<Mutation>> _iter141 : _iter140.getValue().entrySet())
{
oprot.writeString(_iter145.getKey());
oprot.writeString(_iter141.getKey());
{
oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, _iter145.getValue().size()));
for (Mutation _iter146 : _iter145.getValue())
oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, _iter141.getValue().size()));
for (Mutation _iter142 : _iter141.getValue())
{
_iter146.write(oprot);
_iter142.write(oprot);
}
oprot.writeListEnd();
}
@ -21619,25 +21617,25 @@ public class Cassandra {
case 0: // SUCCESS
if (field.type == org.apache.thrift.protocol.TType.MAP) {
{
org.apache.thrift.protocol.TMap _map147 = iprot.readMapBegin();
this.success = new HashMap<String,List<String>>(2*_map147.size);
for (int _i148 = 0; _i148 < _map147.size; ++_i148)
org.apache.thrift.protocol.TMap _map143 = iprot.readMapBegin();
this.success = new HashMap<String,List<String>>(2*_map143.size);
for (int _i144 = 0; _i144 < _map143.size; ++_i144)
{
String _key149; // required
List<String> _val150; // required
_key149 = iprot.readString();
String _key145; // required
List<String> _val146; // required
_key145 = iprot.readString();
{
org.apache.thrift.protocol.TList _list151 = iprot.readListBegin();
_val150 = new ArrayList<String>(_list151.size);
for (int _i152 = 0; _i152 < _list151.size; ++_i152)
org.apache.thrift.protocol.TList _list147 = iprot.readListBegin();
_val146 = new ArrayList<String>(_list147.size);
for (int _i148 = 0; _i148 < _list147.size; ++_i148)
{
String _elem153; // required
_elem153 = iprot.readString();
_val150.add(_elem153);
String _elem149; // required
_elem149 = iprot.readString();
_val146.add(_elem149);
}
iprot.readListEnd();
}
this.success.put(_key149, _val150);
this.success.put(_key145, _val146);
}
iprot.readMapEnd();
}
@ -21671,14 +21669,14 @@ public class Cassandra {
oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
{
oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.LIST, this.success.size()));
for (Map.Entry<String, List<String>> _iter154 : this.success.entrySet())
for (Map.Entry<String, List<String>> _iter150 : this.success.entrySet())
{
oprot.writeString(_iter154.getKey());
oprot.writeString(_iter150.getKey());
{
oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, _iter154.getValue().size()));
for (String _iter155 : _iter154.getValue())
oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, _iter150.getValue().size()));
for (String _iter151 : _iter150.getValue())
{
oprot.writeString(_iter155);
oprot.writeString(_iter151);
}
oprot.writeListEnd();
}
@ -22277,14 +22275,14 @@ public class Cassandra {
case 0: // SUCCESS
if (field.type == org.apache.thrift.protocol.TType.LIST) {
{
org.apache.thrift.protocol.TList _list156 = iprot.readListBegin();
this.success = new ArrayList<KsDef>(_list156.size);
for (int _i157 = 0; _i157 < _list156.size; ++_i157)
org.apache.thrift.protocol.TList _list152 = iprot.readListBegin();
this.success = new ArrayList<KsDef>(_list152.size);
for (int _i153 = 0; _i153 < _list152.size; ++_i153)
{
KsDef _elem158; // required
_elem158 = new KsDef();
_elem158.read(iprot);
this.success.add(_elem158);
KsDef _elem154; // required
_elem154 = new KsDef();
_elem154.read(iprot);
this.success.add(_elem154);
}
iprot.readListEnd();
}
@ -22318,9 +22316,9 @@ public class Cassandra {
oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
{
oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, this.success.size()));
for (KsDef _iter159 : this.success)
for (KsDef _iter155 : this.success)
{
_iter159.write(oprot);
_iter155.write(oprot);
}
oprot.writeListEnd();
}
@ -24033,14 +24031,14 @@ public class Cassandra {
case 0: // SUCCESS
if (field.type == org.apache.thrift.protocol.TType.LIST) {
{
org.apache.thrift.protocol.TList _list160 = iprot.readListBegin();
this.success = new ArrayList<TokenRange>(_list160.size);
for (int _i161 = 0; _i161 < _list160.size; ++_i161)
org.apache.thrift.protocol.TList _list156 = iprot.readListBegin();
this.success = new ArrayList<TokenRange>(_list156.size);
for (int _i157 = 0; _i157 < _list156.size; ++_i157)
{
TokenRange _elem162; // required
_elem162 = new TokenRange();
_elem162.read(iprot);
this.success.add(_elem162);
TokenRange _elem158; // required
_elem158 = new TokenRange();
_elem158.read(iprot);
this.success.add(_elem158);
}
iprot.readListEnd();
}
@ -24074,9 +24072,9 @@ public class Cassandra {
oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
{
oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, this.success.size()));
for (TokenRange _iter163 : this.success)
for (TokenRange _iter159 : this.success)
{
_iter163.write(oprot);
_iter159.write(oprot);
}
oprot.writeListEnd();
}
@ -26880,13 +26878,13 @@ public class Cassandra {
case 0: // SUCCESS
if (field.type == org.apache.thrift.protocol.TType.LIST) {
{
org.apache.thrift.protocol.TList _list164 = iprot.readListBegin();
this.success = new ArrayList<String>(_list164.size);
for (int _i165 = 0; _i165 < _list164.size; ++_i165)
org.apache.thrift.protocol.TList _list160 = iprot.readListBegin();
this.success = new ArrayList<String>(_list160.size);
for (int _i161 = 0; _i161 < _list160.size; ++_i161)
{
String _elem166; // required
_elem166 = iprot.readString();
this.success.add(_elem166);
String _elem162; // required
_elem162 = iprot.readString();
this.success.add(_elem162);
}
iprot.readListEnd();
}
@ -26920,9 +26918,9 @@ public class Cassandra {
oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
{
oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, this.success.size()));
for (String _iter167 : this.success)
for (String _iter163 : this.success)
{
oprot.writeString(_iter167);
oprot.writeString(_iter163);
}
oprot.writeListEnd();
}
@ -34059,13 +34057,13 @@ public class Cassandra {
case 2: // VALUES
if (field.type == org.apache.thrift.protocol.TType.LIST) {
{
org.apache.thrift.protocol.TList _list168 = iprot.readListBegin();
this.values = new ArrayList<ByteBuffer>(_list168.size);
for (int _i169 = 0; _i169 < _list168.size; ++_i169)
org.apache.thrift.protocol.TList _list164 = iprot.readListBegin();
this.values = new ArrayList<ByteBuffer>(_list164.size);
for (int _i165 = 0; _i165 < _list164.size; ++_i165)
{
ByteBuffer _elem170; // required
_elem170 = iprot.readBinary();
this.values.add(_elem170);
ByteBuffer _elem166; // required
_elem166 = iprot.readBinary();
this.values.add(_elem166);
}
iprot.readListEnd();
}
@ -34098,9 +34096,9 @@ public class Cassandra {
oprot.writeFieldBegin(VALUES_FIELD_DESC);
{
oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, this.values.size()));
for (ByteBuffer _iter171 : this.values)
for (ByteBuffer _iter167 : this.values)
{
oprot.writeBinary(_iter171);
oprot.writeBinary(_iter167);
}
oprot.writeListEnd();
}
@ -34148,8 +34146,6 @@ public class Cassandra {
private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
try {
// it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
__isset_bit_vector = new BitSet(1);
read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
} catch (org.apache.thrift.TException te) {
throw new java.io.IOException(te);

View File

@ -66,8 +66,6 @@ public class CfDef implements org.apache.thrift.TBase<CfDef, CfDef._Fields>, jav
private static final org.apache.thrift.protocol.TField COMPRESSION_OPTIONS_FIELD_DESC = new org.apache.thrift.protocol.TField("compression_options", org.apache.thrift.protocol.TType.MAP, (short)32);
private static final org.apache.thrift.protocol.TField BLOOM_FILTER_FP_CHANCE_FIELD_DESC = new org.apache.thrift.protocol.TField("bloom_filter_fp_chance", org.apache.thrift.protocol.TType.DOUBLE, (short)33);
private static final org.apache.thrift.protocol.TField CACHING_FIELD_DESC = new org.apache.thrift.protocol.TField("caching", org.apache.thrift.protocol.TType.STRING, (short)34);
private static final org.apache.thrift.protocol.TField COLUMN_ALIASES_FIELD_DESC = new org.apache.thrift.protocol.TField("column_aliases", org.apache.thrift.protocol.TType.LIST, (short)35);
private static final org.apache.thrift.protocol.TField VALUE_ALIAS_FIELD_DESC = new org.apache.thrift.protocol.TField("value_alias", org.apache.thrift.protocol.TType.STRING, (short)36);
private static final org.apache.thrift.protocol.TField DCLOCAL_READ_REPAIR_CHANCE_FIELD_DESC = new org.apache.thrift.protocol.TField("dclocal_read_repair_chance", org.apache.thrift.protocol.TType.DOUBLE, (short)37);
private static final org.apache.thrift.protocol.TField ROW_CACHE_SIZE_FIELD_DESC = new org.apache.thrift.protocol.TField("row_cache_size", org.apache.thrift.protocol.TType.DOUBLE, (short)9);
private static final org.apache.thrift.protocol.TField KEY_CACHE_SIZE_FIELD_DESC = new org.apache.thrift.protocol.TField("key_cache_size", org.apache.thrift.protocol.TType.DOUBLE, (short)11);
@ -101,8 +99,6 @@ public class CfDef implements org.apache.thrift.TBase<CfDef, CfDef._Fields>, jav
public Map<String,String> compression_options; // required
public double bloom_filter_fp_chance; // required
public String caching; // required
public List<ByteBuffer> column_aliases; // required
public ByteBuffer value_alias; // required
public double dclocal_read_repair_chance; // required
/**
* @deprecated
@ -168,8 +164,6 @@ public class CfDef implements org.apache.thrift.TBase<CfDef, CfDef._Fields>, jav
COMPRESSION_OPTIONS((short)32, "compression_options"),
BLOOM_FILTER_FP_CHANCE((short)33, "bloom_filter_fp_chance"),
CACHING((short)34, "caching"),
COLUMN_ALIASES((short)35, "column_aliases"),
VALUE_ALIAS((short)36, "value_alias"),
DCLOCAL_READ_REPAIR_CHANCE((short)37, "dclocal_read_repair_chance"),
/**
* @deprecated
@ -267,10 +261,6 @@ public class CfDef implements org.apache.thrift.TBase<CfDef, CfDef._Fields>, jav
return BLOOM_FILTER_FP_CHANCE;
case 34: // CACHING
return CACHING;
case 35: // COLUMN_ALIASES
return COLUMN_ALIASES;
case 36: // VALUE_ALIAS
return VALUE_ALIAS;
case 37: // DCLOCAL_READ_REPAIR_CHANCE
return DCLOCAL_READ_REPAIR_CHANCE;
case 9: // ROW_CACHE_SIZE
@ -402,11 +392,6 @@ public class CfDef implements org.apache.thrift.TBase<CfDef, CfDef._Fields>, jav
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.DOUBLE)));
tmpMap.put(_Fields.CACHING, new org.apache.thrift.meta_data.FieldMetaData("caching", org.apache.thrift.TFieldRequirementType.OPTIONAL,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
tmpMap.put(_Fields.COLUMN_ALIASES, new org.apache.thrift.meta_data.FieldMetaData("column_aliases", org.apache.thrift.TFieldRequirementType.OPTIONAL,
new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING , true))));
tmpMap.put(_Fields.VALUE_ALIAS, new org.apache.thrift.meta_data.FieldMetaData("value_alias", org.apache.thrift.TFieldRequirementType.OPTIONAL,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING , true)));
tmpMap.put(_Fields.DCLOCAL_READ_REPAIR_CHANCE, new org.apache.thrift.meta_data.FieldMetaData("dclocal_read_repair_chance", org.apache.thrift.TFieldRequirementType.OPTIONAL,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.DOUBLE)));
tmpMap.put(_Fields.ROW_CACHE_SIZE, new org.apache.thrift.meta_data.FieldMetaData("row_cache_size", org.apache.thrift.TFieldRequirementType.OPTIONAL,
@ -537,19 +522,6 @@ public class CfDef implements org.apache.thrift.TBase<CfDef, CfDef._Fields>, jav
if (other.isSetCaching()) {
this.caching = other.caching;
}
if (other.isSetColumn_aliases()) {
List<ByteBuffer> __this__column_aliases = new ArrayList<ByteBuffer>();
for (ByteBuffer other_element : other.column_aliases) {
ByteBuffer temp_binary_element = org.apache.thrift.TBaseHelper.copyBinary(other_element);
;
__this__column_aliases.add(temp_binary_element);
}
this.column_aliases = __this__column_aliases;
}
if (other.isSetValue_alias()) {
this.value_alias = org.apache.thrift.TBaseHelper.copyBinary(other.value_alias);
;
}
this.dclocal_read_repair_chance = other.dclocal_read_repair_chance;
this.row_cache_size = other.row_cache_size;
this.key_cache_size = other.key_cache_size;
@ -602,8 +574,6 @@ public class CfDef implements org.apache.thrift.TBase<CfDef, CfDef._Fields>, jav
this.bloom_filter_fp_chance = 0.0;
this.caching = "keys_only";
this.column_aliases = null;
this.value_alias = null;
this.dclocal_read_repair_chance = 0;
setRow_cache_sizeIsSet(false);
@ -1171,79 +1141,6 @@ public class CfDef implements org.apache.thrift.TBase<CfDef, CfDef._Fields>, jav
}
}
public int getColumn_aliasesSize() {
return (this.column_aliases == null) ? 0 : this.column_aliases.size();
}
public java.util.Iterator<ByteBuffer> getColumn_aliasesIterator() {
return (this.column_aliases == null) ? null : this.column_aliases.iterator();
}
public void addToColumn_aliases(ByteBuffer elem) {
if (this.column_aliases == null) {
this.column_aliases = new ArrayList<ByteBuffer>();
}
this.column_aliases.add(elem);
}
public List<ByteBuffer> getColumn_aliases() {
return this.column_aliases;
}
public CfDef setColumn_aliases(List<ByteBuffer> column_aliases) {
this.column_aliases = column_aliases;
return this;
}
public void unsetColumn_aliases() {
this.column_aliases = null;
}
/** Returns true if field column_aliases is set (has been assigned a value) and false otherwise */
public boolean isSetColumn_aliases() {
return this.column_aliases != null;
}
public void setColumn_aliasesIsSet(boolean value) {
if (!value) {
this.column_aliases = null;
}
}
public byte[] getValue_alias() {
setValue_alias(org.apache.thrift.TBaseHelper.rightSize(value_alias));
return value_alias == null ? null : value_alias.array();
}
public ByteBuffer bufferForValue_alias() {
return value_alias;
}
public CfDef setValue_alias(byte[] value_alias) {
setValue_alias(value_alias == null ? (ByteBuffer)null : ByteBuffer.wrap(value_alias));
return this;
}
public CfDef setValue_alias(ByteBuffer value_alias) {
this.value_alias = value_alias;
return this;
}
public void unsetValue_alias() {
this.value_alias = null;
}
/** Returns true if field value_alias is set (has been assigned a value) and false otherwise */
public boolean isSetValue_alias() {
return this.value_alias != null;
}
public void setValue_aliasIsSet(boolean value) {
if (!value) {
this.value_alias = null;
}
}
public double getDclocal_read_repair_chance() {
return this.dclocal_read_repair_chance;
}
@ -1728,22 +1625,6 @@ public class CfDef implements org.apache.thrift.TBase<CfDef, CfDef._Fields>, jav
}
break;
case COLUMN_ALIASES:
if (value == null) {
unsetColumn_aliases();
} else {
setColumn_aliases((List<ByteBuffer>)value);
}
break;
case VALUE_ALIAS:
if (value == null) {
unsetValue_alias();
} else {
setValue_alias((ByteBuffer)value);
}
break;
case DCLOCAL_READ_REPAIR_CHANCE:
if (value == null) {
unsetDclocal_read_repair_chance();
@ -1900,12 +1781,6 @@ public class CfDef implements org.apache.thrift.TBase<CfDef, CfDef._Fields>, jav
case CACHING:
return getCaching();
case COLUMN_ALIASES:
return getColumn_aliases();
case VALUE_ALIAS:
return getValue_alias();
case DCLOCAL_READ_REPAIR_CHANCE:
return Double.valueOf(getDclocal_read_repair_chance());
@ -1992,10 +1867,6 @@ public class CfDef implements org.apache.thrift.TBase<CfDef, CfDef._Fields>, jav
return isSetBloom_filter_fp_chance();
case CACHING:
return isSetCaching();
case COLUMN_ALIASES:
return isSetColumn_aliases();
case VALUE_ALIAS:
return isSetValue_alias();
case DCLOCAL_READ_REPAIR_CHANCE:
return isSetDclocal_read_repair_chance();
case ROW_CACHE_SIZE:
@ -2224,24 +2095,6 @@ public class CfDef implements org.apache.thrift.TBase<CfDef, CfDef._Fields>, jav
return false;
}
boolean this_present_column_aliases = true && this.isSetColumn_aliases();
boolean that_present_column_aliases = true && that.isSetColumn_aliases();
if (this_present_column_aliases || that_present_column_aliases) {
if (!(this_present_column_aliases && that_present_column_aliases))
return false;
if (!this.column_aliases.equals(that.column_aliases))
return false;
}
boolean this_present_value_alias = true && this.isSetValue_alias();
boolean that_present_value_alias = true && that.isSetValue_alias();
if (this_present_value_alias || that_present_value_alias) {
if (!(this_present_value_alias && that_present_value_alias))
return false;
if (!this.value_alias.equals(that.value_alias))
return false;
}
boolean this_present_dclocal_read_repair_chance = true && this.isSetDclocal_read_repair_chance();
boolean that_present_dclocal_read_repair_chance = true && that.isSetDclocal_read_repair_chance();
if (this_present_dclocal_read_repair_chance || that_present_dclocal_read_repair_chance) {
@ -2453,16 +2306,6 @@ public class CfDef implements org.apache.thrift.TBase<CfDef, CfDef._Fields>, jav
if (present_caching)
builder.append(caching);
boolean present_column_aliases = true && (isSetColumn_aliases());
builder.append(present_column_aliases);
if (present_column_aliases)
builder.append(column_aliases);
boolean present_value_alias = true && (isSetValue_alias());
builder.append(present_value_alias);
if (present_value_alias)
builder.append(value_alias);
boolean present_dclocal_read_repair_chance = true && (isSetDclocal_read_repair_chance());
builder.append(present_dclocal_read_repair_chance);
if (present_dclocal_read_repair_chance)
@ -2739,26 +2582,6 @@ public class CfDef implements org.apache.thrift.TBase<CfDef, CfDef._Fields>, jav
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetColumn_aliases()).compareTo(typedOther.isSetColumn_aliases());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetColumn_aliases()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.column_aliases, typedOther.column_aliases);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetValue_alias()).compareTo(typedOther.isSetValue_alias());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetValue_alias()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.value_alias, typedOther.value_alias);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetDclocal_read_repair_chance()).compareTo(typedOther.isSetDclocal_read_repair_chance());
if (lastComparison != 0) {
return lastComparison;
@ -3075,30 +2898,6 @@ public class CfDef implements org.apache.thrift.TBase<CfDef, CfDef._Fields>, jav
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
}
break;
case 35: // COLUMN_ALIASES
if (field.type == org.apache.thrift.protocol.TType.LIST) {
{
org.apache.thrift.protocol.TList _list57 = iprot.readListBegin();
this.column_aliases = new ArrayList<ByteBuffer>(_list57.size);
for (int _i58 = 0; _i58 < _list57.size; ++_i58)
{
ByteBuffer _elem59; // required
_elem59 = iprot.readBinary();
this.column_aliases.add(_elem59);
}
iprot.readListEnd();
}
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
}
break;
case 36: // VALUE_ALIAS
if (field.type == org.apache.thrift.protocol.TType.STRING) {
this.value_alias = iprot.readBinary();
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
}
break;
case 37: // DCLOCAL_READ_REPAIR_CHANCE
if (field.type == org.apache.thrift.protocol.TType.DOUBLE) {
this.dclocal_read_repair_chance = iprot.readDouble();
@ -3259,9 +3058,9 @@ public class CfDef implements org.apache.thrift.TBase<CfDef, CfDef._Fields>, jav
oprot.writeFieldBegin(COLUMN_METADATA_FIELD_DESC);
{
oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, this.column_metadata.size()));
for (ColumnDef _iter60 : this.column_metadata)
for (ColumnDef _iter57 : this.column_metadata)
{
_iter60.write(oprot);
_iter57.write(oprot);
}
oprot.writeListEnd();
}
@ -3363,10 +3162,10 @@ public class CfDef implements org.apache.thrift.TBase<CfDef, CfDef._Fields>, jav
oprot.writeFieldBegin(COMPACTION_STRATEGY_OPTIONS_FIELD_DESC);
{
oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, this.compaction_strategy_options.size()));
for (Map.Entry<String, String> _iter61 : this.compaction_strategy_options.entrySet())
for (Map.Entry<String, String> _iter58 : this.compaction_strategy_options.entrySet())
{
oprot.writeString(_iter61.getKey());
oprot.writeString(_iter61.getValue());
oprot.writeString(_iter58.getKey());
oprot.writeString(_iter58.getValue());
}
oprot.writeMapEnd();
}
@ -3383,10 +3182,10 @@ public class CfDef implements org.apache.thrift.TBase<CfDef, CfDef._Fields>, jav
oprot.writeFieldBegin(COMPRESSION_OPTIONS_FIELD_DESC);
{
oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, this.compression_options.size()));
for (Map.Entry<String, String> _iter62 : this.compression_options.entrySet())
for (Map.Entry<String, String> _iter59 : this.compression_options.entrySet())
{
oprot.writeString(_iter62.getKey());
oprot.writeString(_iter62.getValue());
oprot.writeString(_iter59.getKey());
oprot.writeString(_iter59.getValue());
}
oprot.writeMapEnd();
}
@ -3405,27 +3204,6 @@ public class CfDef implements org.apache.thrift.TBase<CfDef, CfDef._Fields>, jav
oprot.writeFieldEnd();
}
}
if (this.column_aliases != null) {
if (isSetColumn_aliases()) {
oprot.writeFieldBegin(COLUMN_ALIASES_FIELD_DESC);
{
oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, this.column_aliases.size()));
for (ByteBuffer _iter63 : this.column_aliases)
{
oprot.writeBinary(_iter63);
}
oprot.writeListEnd();
}
oprot.writeFieldEnd();
}
}
if (this.value_alias != null) {
if (isSetValue_alias()) {
oprot.writeFieldBegin(VALUE_ALIAS_FIELD_DESC);
oprot.writeBinary(this.value_alias);
oprot.writeFieldEnd();
}
}
if (isSetDclocal_read_repair_chance()) {
oprot.writeFieldBegin(DCLOCAL_READ_REPAIR_CHANCE_FIELD_DESC);
oprot.writeDouble(this.dclocal_read_repair_chance);
@ -3617,26 +3395,6 @@ public class CfDef implements org.apache.thrift.TBase<CfDef, CfDef._Fields>, jav
}
first = false;
}
if (isSetColumn_aliases()) {
if (!first) sb.append(", ");
sb.append("column_aliases:");
if (this.column_aliases == null) {
sb.append("null");
} else {
sb.append(this.column_aliases);
}
first = false;
}
if (isSetValue_alias()) {
if (!first) sb.append(", ");
sb.append("value_alias:");
if (this.value_alias == null) {
sb.append("null");
} else {
org.apache.thrift.TBaseHelper.toString(this.value_alias, sb);
}
first = false;
}
if (isSetDclocal_read_repair_chance()) {
if (!first) sb.append(", ");
sb.append("dclocal_read_repair_chance:");

View File

@ -554,15 +554,15 @@ public class CqlMetadata implements org.apache.thrift.TBase<CqlMetadata, CqlMeta
case 1: // NAME_TYPES
if (field.type == org.apache.thrift.protocol.TType.MAP) {
{
org.apache.thrift.protocol.TMap _map77 = iprot.readMapBegin();
this.name_types = new HashMap<ByteBuffer,String>(2*_map77.size);
for (int _i78 = 0; _i78 < _map77.size; ++_i78)
org.apache.thrift.protocol.TMap _map73 = iprot.readMapBegin();
this.name_types = new HashMap<ByteBuffer,String>(2*_map73.size);
for (int _i74 = 0; _i74 < _map73.size; ++_i74)
{
ByteBuffer _key79; // required
String _val80; // required
_key79 = iprot.readBinary();
_val80 = iprot.readString();
this.name_types.put(_key79, _val80);
ByteBuffer _key75; // required
String _val76; // required
_key75 = iprot.readBinary();
_val76 = iprot.readString();
this.name_types.put(_key75, _val76);
}
iprot.readMapEnd();
}
@ -573,15 +573,15 @@ public class CqlMetadata implements org.apache.thrift.TBase<CqlMetadata, CqlMeta
case 2: // VALUE_TYPES
if (field.type == org.apache.thrift.protocol.TType.MAP) {
{
org.apache.thrift.protocol.TMap _map81 = iprot.readMapBegin();
this.value_types = new HashMap<ByteBuffer,String>(2*_map81.size);
for (int _i82 = 0; _i82 < _map81.size; ++_i82)
org.apache.thrift.protocol.TMap _map77 = iprot.readMapBegin();
this.value_types = new HashMap<ByteBuffer,String>(2*_map77.size);
for (int _i78 = 0; _i78 < _map77.size; ++_i78)
{
ByteBuffer _key83; // required
String _val84; // required
_key83 = iprot.readBinary();
_val84 = iprot.readString();
this.value_types.put(_key83, _val84);
ByteBuffer _key79; // required
String _val80; // required
_key79 = iprot.readBinary();
_val80 = iprot.readString();
this.value_types.put(_key79, _val80);
}
iprot.readMapEnd();
}
@ -622,10 +622,10 @@ public class CqlMetadata implements org.apache.thrift.TBase<CqlMetadata, CqlMeta
oprot.writeFieldBegin(NAME_TYPES_FIELD_DESC);
{
oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, this.name_types.size()));
for (Map.Entry<ByteBuffer, String> _iter85 : this.name_types.entrySet())
for (Map.Entry<ByteBuffer, String> _iter81 : this.name_types.entrySet())
{
oprot.writeBinary(_iter85.getKey());
oprot.writeString(_iter85.getValue());
oprot.writeBinary(_iter81.getKey());
oprot.writeString(_iter81.getValue());
}
oprot.writeMapEnd();
}
@ -635,10 +635,10 @@ public class CqlMetadata implements org.apache.thrift.TBase<CqlMetadata, CqlMeta
oprot.writeFieldBegin(VALUE_TYPES_FIELD_DESC);
{
oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, this.value_types.size()));
for (Map.Entry<ByteBuffer, String> _iter86 : this.value_types.entrySet())
for (Map.Entry<ByteBuffer, String> _iter82 : this.value_types.entrySet())
{
oprot.writeBinary(_iter86.getKey());
oprot.writeString(_iter86.getValue());
oprot.writeBinary(_iter82.getKey());
oprot.writeString(_iter82.getValue());
}
oprot.writeMapEnd();
}

View File

@ -465,13 +465,13 @@ public class CqlPreparedResult implements org.apache.thrift.TBase<CqlPreparedRes
case 3: // VARIABLE_TYPES
if (field.type == org.apache.thrift.protocol.TType.LIST) {
{
org.apache.thrift.protocol.TList _list91 = iprot.readListBegin();
this.variable_types = new ArrayList<String>(_list91.size);
for (int _i92 = 0; _i92 < _list91.size; ++_i92)
org.apache.thrift.protocol.TList _list87 = iprot.readListBegin();
this.variable_types = new ArrayList<String>(_list87.size);
for (int _i88 = 0; _i88 < _list87.size; ++_i88)
{
String _elem93; // required
_elem93 = iprot.readString();
this.variable_types.add(_elem93);
String _elem89; // required
_elem89 = iprot.readString();
this.variable_types.add(_elem89);
}
iprot.readListEnd();
}
@ -511,9 +511,9 @@ public class CqlPreparedResult implements org.apache.thrift.TBase<CqlPreparedRes
oprot.writeFieldBegin(VARIABLE_TYPES_FIELD_DESC);
{
oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, this.variable_types.size()));
for (String _iter94 : this.variable_types)
for (String _iter90 : this.variable_types)
{
oprot.writeString(_iter94);
oprot.writeString(_iter90);
}
oprot.writeListEnd();
}

View File

@ -541,14 +541,14 @@ public class CqlResult implements org.apache.thrift.TBase<CqlResult, CqlResult._
case 2: // ROWS
if (field.type == org.apache.thrift.protocol.TType.LIST) {
{
org.apache.thrift.protocol.TList _list87 = iprot.readListBegin();
this.rows = new ArrayList<CqlRow>(_list87.size);
for (int _i88 = 0; _i88 < _list87.size; ++_i88)
org.apache.thrift.protocol.TList _list83 = iprot.readListBegin();
this.rows = new ArrayList<CqlRow>(_list83.size);
for (int _i84 = 0; _i84 < _list83.size; ++_i84)
{
CqlRow _elem89; // required
_elem89 = new CqlRow();
_elem89.read(iprot);
this.rows.add(_elem89);
CqlRow _elem85; // required
_elem85 = new CqlRow();
_elem85.read(iprot);
this.rows.add(_elem85);
}
iprot.readListEnd();
}
@ -597,9 +597,9 @@ public class CqlResult implements org.apache.thrift.TBase<CqlResult, CqlResult._
oprot.writeFieldBegin(ROWS_FIELD_DESC);
{
oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, this.rows.size()));
for (CqlRow _iter90 : this.rows)
for (CqlRow _iter86 : this.rows)
{
_iter90.write(oprot);
_iter86.write(oprot);
}
oprot.writeListEnd();
}

View File

@ -395,14 +395,14 @@ public class CqlRow implements org.apache.thrift.TBase<CqlRow, CqlRow._Fields>,
case 2: // COLUMNS
if (field.type == org.apache.thrift.protocol.TType.LIST) {
{
org.apache.thrift.protocol.TList _list73 = iprot.readListBegin();
this.columns = new ArrayList<Column>(_list73.size);
for (int _i74 = 0; _i74 < _list73.size; ++_i74)
org.apache.thrift.protocol.TList _list69 = iprot.readListBegin();
this.columns = new ArrayList<Column>(_list69.size);
for (int _i70 = 0; _i70 < _list69.size; ++_i70)
{
Column _elem75; // required
_elem75 = new Column();
_elem75.read(iprot);
this.columns.add(_elem75);
Column _elem71; // required
_elem71 = new Column();
_elem71.read(iprot);
this.columns.add(_elem71);
}
iprot.readListEnd();
}
@ -434,9 +434,9 @@ public class CqlRow implements org.apache.thrift.TBase<CqlRow, CqlRow._Fields>,
oprot.writeFieldBegin(COLUMNS_FIELD_DESC);
{
oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, this.columns.size()));
for (Column _iter76 : this.columns)
for (Column _iter72 : this.columns)
{
_iter76.write(oprot);
_iter72.write(oprot);
}
oprot.writeListEnd();
}

View File

@ -718,15 +718,15 @@ public class KsDef implements org.apache.thrift.TBase<KsDef, KsDef._Fields>, jav
case 3: // STRATEGY_OPTIONS
if (field.type == org.apache.thrift.protocol.TType.MAP) {
{
org.apache.thrift.protocol.TMap _map64 = iprot.readMapBegin();
this.strategy_options = new HashMap<String,String>(2*_map64.size);
for (int _i65 = 0; _i65 < _map64.size; ++_i65)
org.apache.thrift.protocol.TMap _map60 = iprot.readMapBegin();
this.strategy_options = new HashMap<String,String>(2*_map60.size);
for (int _i61 = 0; _i61 < _map60.size; ++_i61)
{
String _key66; // required
String _val67; // required
_key66 = iprot.readString();
_val67 = iprot.readString();
this.strategy_options.put(_key66, _val67);
String _key62; // required
String _val63; // required
_key62 = iprot.readString();
_val63 = iprot.readString();
this.strategy_options.put(_key62, _val63);
}
iprot.readMapEnd();
}
@ -745,14 +745,14 @@ public class KsDef implements org.apache.thrift.TBase<KsDef, KsDef._Fields>, jav
case 5: // CF_DEFS
if (field.type == org.apache.thrift.protocol.TType.LIST) {
{
org.apache.thrift.protocol.TList _list68 = iprot.readListBegin();
this.cf_defs = new ArrayList<CfDef>(_list68.size);
for (int _i69 = 0; _i69 < _list68.size; ++_i69)
org.apache.thrift.protocol.TList _list64 = iprot.readListBegin();
this.cf_defs = new ArrayList<CfDef>(_list64.size);
for (int _i65 = 0; _i65 < _list64.size; ++_i65)
{
CfDef _elem70; // required
_elem70 = new CfDef();
_elem70.read(iprot);
this.cf_defs.add(_elem70);
CfDef _elem66; // required
_elem66 = new CfDef();
_elem66.read(iprot);
this.cf_defs.add(_elem66);
}
iprot.readListEnd();
}
@ -798,10 +798,10 @@ public class KsDef implements org.apache.thrift.TBase<KsDef, KsDef._Fields>, jav
oprot.writeFieldBegin(STRATEGY_OPTIONS_FIELD_DESC);
{
oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, this.strategy_options.size()));
for (Map.Entry<String, String> _iter71 : this.strategy_options.entrySet())
for (Map.Entry<String, String> _iter67 : this.strategy_options.entrySet())
{
oprot.writeString(_iter71.getKey());
oprot.writeString(_iter71.getValue());
oprot.writeString(_iter67.getKey());
oprot.writeString(_iter67.getValue());
}
oprot.writeMapEnd();
}
@ -817,9 +817,9 @@ public class KsDef implements org.apache.thrift.TBase<KsDef, KsDef._Fields>, jav
oprot.writeFieldBegin(CF_DEFS_FIELD_DESC);
{
oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, this.cf_defs.size()));
for (CfDef _iter72 : this.cf_defs)
for (CfDef _iter68 : this.cf_defs)
{
_iter72.write(oprot);
_iter68.write(oprot);
}
oprot.writeListEnd();
}

View File

@ -199,7 +199,7 @@ public class Avro
try
{
AbstractType<?> validatorType = TypeParser.parse(cd.validation_class);
return new ColumnDefinition(ByteBufferUtil.clone(cd.name), validatorType, index_type, ColumnDefinition.getStringMap(cd.index_options), index_name);
return new ColumnDefinition(ByteBufferUtil.clone(cd.name), validatorType, index_type, ColumnDefinition.getStringMap(cd.index_options), index_name, null);
}
catch (ConfigurationException e)
{

View File

@ -89,6 +89,7 @@ public final class CFMetaData
UTF8Type.instance,
null,
null,
null,
null)));
// new-style schema
@ -103,11 +104,11 @@ public final class CFMetaData
AsciiType.instance,
null)
.keyValidator(AsciiType.instance)
.keyAlias("keyspace");
SchemaKeyspacesCf.columnMetadata(ColumnDefinition.utf8("name"),
ColumnDefinition.bool("durable_writes"),
ColumnDefinition.ascii("strategy_class"),
ColumnDefinition.ascii("strategy_options"));
.keyAlias("keyspace")
.columnMetadata(ColumnDefinition.utf8("name", null),
ColumnDefinition.bool("durable_writes", null),
ColumnDefinition.ascii("strategy_class", null),
ColumnDefinition.ascii("strategy_options", null));
SchemaColumnFamiliesCf = newSchemaMetadata(SystemTable.SCHEMA_COLUMNFAMILIES_CF,
9,
@ -117,42 +118,43 @@ public final class CFMetaData
.keyValidator(AsciiType.instance)
.keyAlias("keyspace")
.columnAliases(Arrays.asList(ByteBufferUtil.bytes("columnfamily")))
.columnMetadata(ColumnDefinition.int32("id"),
ColumnDefinition.ascii("type"),
ColumnDefinition.ascii("comparator"),
ColumnDefinition.ascii("subcomparator"),
ColumnDefinition.utf8("comment"),
ColumnDefinition.double_("read_repair_chance"),
ColumnDefinition.double_("local_read_repair_chance"),
ColumnDefinition.bool("replicate_on_write"),
ColumnDefinition.int32("gc_grace_seconds"),
ColumnDefinition.ascii("default_validator"),
ColumnDefinition.ascii("key_validator"),
ColumnDefinition.int32("min_compaction_threshold"),
ColumnDefinition.int32("max_compaction_threshold"),
ColumnDefinition.ascii("key_alias"),
ColumnDefinition.double_("bloom_filter_fp_chance"),
ColumnDefinition.ascii("caching"),
ColumnDefinition.ascii("compaction_strategy_class"),
ColumnDefinition.ascii("compression_parameters"),
ColumnDefinition.utf8("value_alias"),
ColumnDefinition.utf8("column_aliases"),
ColumnDefinition.ascii("compaction_strategy_options"));
.columnMetadata(ColumnDefinition.int32("id", 1),
ColumnDefinition.ascii("type", 1),
ColumnDefinition.ascii("comparator", 1),
ColumnDefinition.ascii("subcomparator", 1),
ColumnDefinition.utf8("comment", 1),
ColumnDefinition.double_("read_repair_chance", 1),
ColumnDefinition.double_("local_read_repair_chance", 1),
ColumnDefinition.bool("replicate_on_write", 1),
ColumnDefinition.int32("gc_grace_seconds", 1),
ColumnDefinition.ascii("default_validator", 1),
ColumnDefinition.ascii("key_validator", 1),
ColumnDefinition.int32("min_compaction_threshold", 1),
ColumnDefinition.int32("max_compaction_threshold", 1),
ColumnDefinition.ascii("key_alias", 1),
ColumnDefinition.double_("bloom_filter_fp_chance", 1),
ColumnDefinition.ascii("caching", 1),
ColumnDefinition.ascii("compaction_strategy_class", 1),
ColumnDefinition.ascii("compression_parameters", 1),
ColumnDefinition.utf8("value_alias", 1),
ColumnDefinition.utf8("column_aliases", 1),
ColumnDefinition.ascii("compaction_strategy_options", 1));
SchemaColumnsCf = newSchemaMetadata(SystemTable.SCHEMA_COLUMNS_CF,
10,
"ColumnFamily column attributes",
CompositeType.getInstance(Arrays.<AbstractType<?>>asList(AsciiType.instance,
AsciiType.instance,
UTF8Type.instance)),
AsciiType.instance)),
null)
.keyValidator(AsciiType.instance)
.keyAlias("keyspace")
.columnAliases(Arrays.asList(ByteBufferUtil.bytes("columnfamily"), ByteBufferUtil.bytes("column")))
.columnMetadata(ColumnDefinition.ascii("validator"),
ColumnDefinition.ascii("index_type"),
ColumnDefinition.ascii("index_options"),
ColumnDefinition.ascii("index_name"));
.columnMetadata(ColumnDefinition.ascii("validator", 2),
ColumnDefinition.ascii("index_type", 2),
ColumnDefinition.ascii("index_options", 2),
ColumnDefinition.ascii("index_name", 2),
ColumnDefinition.ascii("component_index", 2));
}
public enum Caching
@ -615,8 +617,6 @@ public final class CFMetaData
if (cf_def.isSetMin_compaction_threshold()) { newCFMD.minCompactionThreshold(cf_def.min_compaction_threshold); }
if (cf_def.isSetMax_compaction_threshold()) { newCFMD.maxCompactionThreshold(cf_def.max_compaction_threshold); }
if (cf_def.isSetKey_alias()) { newCFMD.keyAlias(cf_def.key_alias); }
if (cf_def.isSetColumn_aliases() && cf_def.column_aliases != null) { newCFMD.columnAliases(cf_def.column_aliases); }
if (cf_def.isSetValue_alias()) { newCFMD.valueAlias(cf_def.value_alias); }
if (cf_def.isSetKey_validation_class()) { newCFMD.keyValidator(TypeParser.parse(cf_def.key_validation_class)); }
if (cf_def.isSetCompaction_strategy())
newCFMD.compactionStrategyClass = createCompactionStrategy(cf_def.compaction_strategy);
@ -712,8 +712,15 @@ public final class CFMetaData
minCompactionThreshold = cfm.minCompactionThreshold;
maxCompactionThreshold = cfm.maxCompactionThreshold;
keyAlias = cfm.keyAlias;
columnAliases = cfm.columnAliases;
valueAlias = cfm.valueAlias;
// We don't want updates coming from thrift to erase columnAliases/valuAlias, which would be wrong, but those are not exposed throught thrift. So
// we just only override the value when the new has those set.
// Note that this doesn't remove feature on the CQL side since removing columnAliases/valuAlias is non-sensical and not allowed (actually, updating
// those is not allowed either but it would be possible to allow it through some ALTER RENAME later).
if (!cfm.columnAliases.isEmpty())
columnAliases = cfm.columnAliases;
if (cfm.valueAlias != null)
valueAlias = cfm.valueAlias;
bloomFilterFpChance = cfm.bloomFilterFpChance;
caching = cfm.caching;
@ -729,7 +736,7 @@ public final class CFMetaData
{
ColumnDefinition oldDef = column_metadata.get(name);
ColumnDefinition def = cfm.column_metadata.get(name);
oldDef.apply(def, getColumnDefinitionComparator());
oldDef.apply(def, getColumnDefinitionComparator(oldDef));
}
compactionStrategyClass = cfm.compactionStrategyClass;
@ -801,13 +808,10 @@ public final class CFMetaData
List<org.apache.cassandra.thrift.ColumnDef> column_meta = new ArrayList<org.apache.cassandra.thrift.ColumnDef>(column_metadata.size());
for (ColumnDefinition cd : column_metadata.values())
{
org.apache.cassandra.thrift.ColumnDef tcd = new org.apache.cassandra.thrift.ColumnDef();
tcd.setIndex_name(cd.getIndexName());
tcd.setIndex_type(cd.getIndexType());
tcd.setIndex_options(cd.getIndexOptions());
tcd.setName(cd.name);
tcd.setValidation_class(cd.getValidator().toString());
column_meta.add(tcd);
// Non-null componentIndex are only used by CQL (so far) so we don't expose
// them through thrift
if (cd.componentIndex == null)
column_meta.add(cd.toThrift());
}
def.setColumn_metadata(column_meta);
def.setCompaction_strategy(compactionStrategyClass.getName());
@ -939,10 +943,10 @@ public final class CFMetaData
indexNames.add(cd.getIndexName());
}
AbstractType<?> comparator = getColumnDefinitionComparator();
for (ColumnDefinition c : column_metadata.values())
{
AbstractType<?> comparator = getColumnDefinitionComparator(c);
try
{
comparator.validate(c.name);
@ -1033,17 +1037,17 @@ public final class CFMetaData
// columns that are no longer needed
for (ColumnDefinition cd : columnDiff.entriesOnlyOnLeft().values())
cd.deleteFromSchema(rm, cfName, getColumnDefinitionComparator(), modificationTimestamp);
cd.deleteFromSchema(rm, cfName, getColumnDefinitionComparator(cd), modificationTimestamp);
// newly added columns
for (ColumnDefinition cd : columnDiff.entriesOnlyOnRight().values())
cd.toSchema(rm, cfName, getColumnDefinitionComparator(), modificationTimestamp);
cd.toSchema(rm, cfName, getColumnDefinitionComparator(cd), modificationTimestamp);
// old columns with updated attributes
for (ByteBuffer name : columnDiff.entriesDiffering().keySet())
{
ColumnDefinition cd = newState.getColumnDefinition(name);
cd.toSchema(rm, cfName, getColumnDefinitionComparator(), modificationTimestamp);
cd.toSchema(rm, cfName, getColumnDefinitionComparator(cd), modificationTimestamp);
}
return rm;
@ -1085,7 +1089,7 @@ public final class CFMetaData
cf.addColumn(DeletedColumn.create(ldt, timestamp, cfName, "compaction_strategy_options"));
for (ColumnDefinition cd : column_metadata.values())
cd.deleteFromSchema(rm, cfName, getColumnDefinitionComparator(), timestamp);
cd.deleteFromSchema(rm, cfName, getColumnDefinitionComparator(cd), timestamp);
return rm;
}
@ -1095,7 +1099,7 @@ public final class CFMetaData
toSchemaNoColumns(rm, timestamp);
for (ColumnDefinition cd : column_metadata.values())
cd.toSchema(rm, cfName, getColumnDefinitionComparator(), timestamp);
cd.toSchema(rm, cfName, getColumnDefinitionComparator(cd), timestamp);
}
private void toSchemaNoColumns(RowMutation rm, long timestamp)
@ -1227,30 +1231,23 @@ public final class CFMetaData
return rm;
}
public static AbstractType<?> getColumnDefinitionComparator(CfDef cfDef) throws ConfigurationException
public AbstractType<?> getColumnDefinitionComparator(ColumnDefinition def)
{
AbstractType<?> cfComparator = TypeParser.parse(cfDef.column_type.equals("Super")
? cfDef.subcomparator_type
: cfDef.comparator_type);
if (cfComparator instanceof CompositeType)
{
List<AbstractType<?>> types = ((CompositeType)cfComparator).types;
return types.get(types.size() - 1);
}
else
{
return cfComparator;
}
return getColumnDefinitionComparator(def.componentIndex);
}
public AbstractType<?> getColumnDefinitionComparator()
public AbstractType<?> getColumnDefinitionComparator(Integer componentIndex)
{
AbstractType<?> cfComparator = cfType == ColumnFamilyType.Super ? subcolumnComparator : comparator;
if (cfComparator instanceof CompositeType)
{
if (componentIndex == null)
return cfComparator;
List<AbstractType<?>> types = ((CompositeType)cfComparator).types;
return types.get(types.size() - 1);
AbstractType<?> t = types.get(componentIndex);
assert t != null : "Non-sensical component index";
return t;
}
else
{
@ -1261,7 +1258,7 @@ public final class CFMetaData
// Package protected for use by tests
static CFMetaData addColumnDefinitionSchema(CFMetaData cfDef, Row serializedColumnDefinitions)
{
for (ColumnDefinition cd : ColumnDefinition.fromSchema(serializedColumnDefinitions, cfDef.getColumnDefinitionComparator()))
for (ColumnDefinition cd : ColumnDefinition.fromSchema(serializedColumnDefinitions, cfDef))
cfDef.column_metadata.put(cd.name, cd);
return cfDef;
}

View File

@ -48,39 +48,51 @@ public class ColumnDefinition
private Map<String,String> index_options;
private String index_name;
public ColumnDefinition(ByteBuffer name, AbstractType<?> validator, IndexType index_type, Map<String, String> index_options, String index_name)
/*
* If the column comparator is a composite type, indicates to which
* component this definition refers to. If null, the definition refers to
* the full column name.
*/
public final Integer componentIndex;
public ColumnDefinition(ByteBuffer name, AbstractType<?> validator, IndexType index_type, Map<String, String> index_options, String index_name, Integer componentIndex)
{
assert name != null && validator != null;
this.name = name;
this.index_name = index_name;
this.validator = validator;
this.componentIndex = componentIndex;
this.setIndexType(index_type, index_options);
}
public static ColumnDefinition ascii(String name)
public static ColumnDefinition ascii(String name, Integer cidx)
{
return new ColumnDefinition(ByteBufferUtil.bytes(name), AsciiType.instance, null, null, null);
return new ColumnDefinition(ByteBufferUtil.bytes(name), AsciiType.instance, null, null, null, cidx);
}
public static ColumnDefinition bool(String name)
public static ColumnDefinition bool(String name, Integer cidx)
{
return new ColumnDefinition(ByteBufferUtil.bytes(name), BooleanType.instance, null, null, null);
return new ColumnDefinition(ByteBufferUtil.bytes(name), BooleanType.instance, null, null, null, cidx);
}
public static ColumnDefinition utf8(String name)
public static ColumnDefinition utf8(String name, Integer cidx)
{
return new ColumnDefinition(ByteBufferUtil.bytes(name), UTF8Type.instance, null, null, null);
return new ColumnDefinition(ByteBufferUtil.bytes(name), UTF8Type.instance, null, null, null, cidx);
}
public static ColumnDefinition int32(String name)
public static ColumnDefinition int32(String name, Integer cidx)
{
return new ColumnDefinition(ByteBufferUtil.bytes(name), Int32Type.instance, null, null, null);
return new ColumnDefinition(ByteBufferUtil.bytes(name), Int32Type.instance, null, null, null, cidx);
}
public static ColumnDefinition double_(String name)
public static ColumnDefinition double_(String name, Integer cidx)
{
return new ColumnDefinition(ByteBufferUtil.bytes(name), DoubleType.instance, null, null, null);
return new ColumnDefinition(ByteBufferUtil.bytes(name), DoubleType.instance, null, null, null, cidx);
}
public ColumnDefinition clone()
{
return new ColumnDefinition(name, validator, index_type, index_options, index_name, componentIndex);
}
public ColumnDefinition clone()
@ -105,6 +117,8 @@ public class ColumnDefinition
return false;
if (!name.equals(that.name))
return false;
if (componentIndex != null ? !componentIndex.equals(that.componentIndex) : that.componentIndex != null)
return false;
return !(validator != null ? !validator.equals(that.validator) : that.validator != null);
}
@ -116,6 +130,7 @@ public class ColumnDefinition
result = 31 * result + (index_type != null ? index_type.hashCode() : 0);
result = 31 * result + (index_options != null ? index_options.hashCode() : 0);
result = 31 * result + (index_name != null ? index_name.hashCode() : 0);
result = 31 * result + (componentIndex != null ? componentIndex.hashCode() : 0);
return result;
}
@ -141,7 +156,8 @@ public class ColumnDefinition
TypeParser.parse(thriftColumnDef.validation_class),
thriftColumnDef.index_type,
thriftColumnDef.index_options,
thriftColumnDef.index_name);
thriftColumnDef.index_name,
null);
}
public static Map<ByteBuffer, ColumnDefinition> fromThrift(List<ColumnDef> thriftDefs) throws ConfigurationException
@ -186,6 +202,8 @@ public class ColumnDefinition
: Column.create(json(index_options), timestamp, cfName, comparator.getString(name), "index_options"));
cf.addColumn(index_name == null ? DeletedColumn.create(ldt, timestamp, cfName, comparator.getString(name), "index_name")
: Column.create(index_name, timestamp, cfName, comparator.getString(name), "index_name"));
cf.addColumn(componentIndex == null ? DeletedColumn.create(ldt, timestamp, cfName, comparator.getString(name), "component_index")
: Column.create(componentIndex, timestamp, cfName, comparator.getString(name), "component_index"));
}
public void apply(ColumnDefinition def, AbstractType<?> comparator) throws ConfigurationException
@ -201,6 +219,10 @@ public class ColumnDefinition
throw new ConfigurationException("Cannot modify index name");
}
if ((componentIndex != null && !componentIndex.equals(def.componentIndex))
|| (componentIndex == null && def.componentIndex != null))
throw new ConfigurationException(String.format("Cannot modify component index for column %s", comparator.getString(name)));
setValidator(def.getValidator());
setIndexType(def.getIndexType(), def.getIndexOptions());
setIndexName(def.getIndexName());
@ -212,7 +234,7 @@ public class ColumnDefinition
* @return Thrift-based deserialized representation of the column
* @param row
*/
public static List<ColumnDefinition> fromSchema(Row row, AbstractType<?> comparator)
public static List<ColumnDefinition> fromSchema(Row row, CFMetaData cfm)
{
if (row.cf == null)
return Collections.emptyList();
@ -225,6 +247,7 @@ public class ColumnDefinition
IndexType index_type = null;
Map<String,String> index_options = null;
String index_name = null;
Integer componentIndex = null;
if (result.has("index_type"))
index_type = IndexType.valueOf(result.getString("index_type"));
@ -232,12 +255,15 @@ public class ColumnDefinition
index_options = FBUtilities.fromJsonMap(result.getString("index_options"));
if (result.has("index_name"))
index_name = result.getString("index_name");
if (result.has("component_index"))
componentIndex = result.getInt("component_index");
cds.add(new ColumnDefinition(comparator.fromString(result.getString("column")),
cds.add(new ColumnDefinition(cfm.getColumnDefinitionComparator(componentIndex).fromString(result.getString("column")),
TypeParser.parse(result.getString("validator")),
index_type,
index_options,
index_name));
index_name,
componentIndex));
}
catch (ConfigurationException e)
{
@ -269,6 +295,7 @@ public class ColumnDefinition
", validator=" + validator +
", index_type=" + index_type +
", index_name='" + index_name + '\'' +
(componentIndex != null ? ", component_index=" + componentIndex : "") +
'}';
}

View File

@ -295,7 +295,7 @@ public final class KSMetaData
for (CFMetaData cfm : cfms.values())
{
Row columnRow = ColumnDefinition.readSchema(cfm.ksName, cfm.cfName);
for (ColumnDefinition cd : ColumnDefinition.fromSchema(columnRow, cfm.getColumnDefinitionComparator()))
for (ColumnDefinition cd : ColumnDefinition.fromSchema(columnRow, cfm))
cfm.column_metadata.put(cd.name, cd);
}

View File

@ -88,6 +88,7 @@ public class AlterTableStatement
TypeParser.parse(validator),
null,
null,
null,
null));
break;

View File

@ -133,7 +133,7 @@ public class CreateColumnFamilyStatement
? CFPropDefs.comparators.get(col.getValue())
: col.getValue();
AbstractType<?> validator = TypeParser.parse(validatorClassName);
columnDefs.put(columnName, new ColumnDefinition(columnName, validator, null, null, null));
columnDefs.put(columnName, new ColumnDefinition(columnName, validator, null, null, null, null));
}
catch (ConfigurationException e)
{

View File

@ -24,6 +24,7 @@ import java.util.*;
import org.apache.cassandra.cql3.*;
import org.apache.cassandra.config.*;
import org.apache.cassandra.io.compress.CompressionParameters;
import org.apache.cassandra.db.marshal.CompositeType;
import org.apache.cassandra.service.MigrationManager;
import org.apache.cassandra.thrift.CfDef;
import org.apache.cassandra.thrift.ColumnDef;
@ -78,7 +79,8 @@ public class AlterTableStatement extends SchemaAlteringStatement
CFPropDefs.parseType(validator),
null,
null,
null));
null,
cfDef.isComposite ? ((CompositeType)meta.comparator).types.size() - 1 : null));
break;
case ALTER:

View File

@ -66,12 +66,13 @@ public class CreateColumnFamilyStatement extends SchemaAlteringStatement
private Map<ByteBuffer, ColumnDefinition> getColumns() throws InvalidRequestException
{
Map<ByteBuffer, ColumnDefinition> columnDefs = new HashMap<ByteBuffer, ColumnDefinition>();
Integer componentIndex = comparator instanceof CompositeType ? ((CompositeType)comparator).types.size() - 1 : null;
for (Map.Entry<ColumnIdentifier, String> col : columns.entrySet())
{
AbstractType<?> validator = CFPropDefs.parseType(col.getValue());
columnDefs.put(col.getKey().key, new ColumnDefinition(col.getKey().key, validator, null, null, null));
columnDefs.put(col.getKey().key, new ColumnDefinition(col.getKey().key, validator, null, null, null, componentIndex));
}
return columnDefs;

View File

@ -129,6 +129,7 @@ public class SchemaLoader
UTF8Type.instance,
null,
null,
null,
null));
Map<ByteBuffer, ColumnDefinition> utf8Column = new HashMap<ByteBuffer, ColumnDefinition>();
utf8Column.put(UTF8Type.instance.fromString("fortytwo"), new ColumnDefinition(
@ -136,6 +137,7 @@ public class SchemaLoader
IntegerType.instance,
null,
null,
null,
null));
// Keyspace 1
@ -307,7 +309,7 @@ public class SchemaLoader
{{
ByteBuffer cName = ByteBuffer.wrap("birthdate".getBytes(Charsets.UTF_8));
IndexType keys = withIdxType ? IndexType.KEYS : null;
put(cName, new ColumnDefinition(cName, LongType.instance, keys, null, withIdxType ? ByteBufferUtil.bytesToHex(cName) : null));
put(cName, new ColumnDefinition(cName, LongType.instance, keys, null, withIdxType ? ByteBufferUtil.bytesToHex(cName) : null, null));
}});
}
private static CFMetaData jdbcCFMD(String ksName, String cfName, AbstractType comp)

View File

@ -37,12 +37,14 @@ public class ColumnDefinitionTest
BytesType.instance,
IndexType.KEYS,
null,
"random index name 0");
"random index name 0",
null);
ColumnDefinition cd1 = new ColumnDefinition(ByteBufferUtil.bytes("TestColumnDefinition1"),
LongType.instance,
null,
null,
null,
null);
testSerializeDeserialize(cd0);

View File

@ -64,7 +64,7 @@ public class DefsTest extends SchemaLoader
for (int i = 0; i < 5; i++)
{
ByteBuffer name = ByteBuffer.wrap(new byte[] { (byte)i });
indexes.put(name, new ColumnDefinition(name, BytesType.instance, IndexType.KEYS, null, Integer.toString(i)));
indexes.put(name, new ColumnDefinition(name, BytesType.instance, IndexType.KEYS, null, Integer.toString(i), null));
}
CFMetaData cfm = new CFMetaData("Keyspace1",
"TestApplyCFM_CF",
@ -91,7 +91,8 @@ public class DefsTest extends SchemaLoader
BytesType.instance,
IndexType.KEYS,
null,
"5");
"5",
null);
cfNew.addColumnDefinition(addIndexDef);
// remove one.
@ -99,7 +100,8 @@ public class DefsTest extends SchemaLoader
BytesType.instance,
IndexType.KEYS,
null,
"0");
"0",
null);
assert cfNew.removeColumnDefinition(removeIndexDef);
cfm.apply(cfNew);
@ -531,7 +533,7 @@ public class DefsTest extends SchemaLoader
// drop the index
CFMetaData meta = cfs.metadata.clone();
ColumnDefinition cdOld = meta.getColumn_metadata().values().iterator().next();
ColumnDefinition cdNew = new ColumnDefinition(cdOld.name, cdOld.getValidator(), null, null, null);
ColumnDefinition cdNew = new ColumnDefinition(cdOld.name, cdOld.getValidator(), null, null, null, null);
meta.columnMetadata(Collections.singletonMap(cdOld.name, cdNew));
MigrationManager.announceColumnFamilyUpdate(meta);

View File

@ -458,7 +458,7 @@ public class ColumnFamilyStoreTest extends SchemaLoader
ColumnFamilyStore cfs = table.getColumnFamilyStore("Indexed2");
ColumnDefinition old = cfs.metadata.getColumn_metadata().get(ByteBufferUtil.bytes("birthdate"));
ColumnDefinition cd = new ColumnDefinition(old.name, old.getValidator(), IndexType.KEYS, null, "birthdate_index");
ColumnDefinition cd = new ColumnDefinition(old.name, old.getValidator(), IndexType.KEYS, null, "birthdate_index", null);
Future<?> future = cfs.indexManager.addIndexedColumn(cd);
future.get();
// we had a bug (CASSANDRA-2244) where index would get created but not flushed -- check for that

View File

@ -124,7 +124,7 @@ public class ThriftValidationTest extends SchemaLoader
assert !gotException : "got unexpected ConfigurationException";
// add a column with name = "id"
newMetadata.addColumnDefinition(ColumnDefinition.utf8("id"));
newMetadata.addColumnDefinition(ColumnDefinition.utf8("id", null));
gotException = false;