You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by jb...@apache.org on 2009/07/21 03:36:54 UTC
svn commit: r796108 [1/4] - in /incubator/cassandra/trunk: conf/ interface/
interface/gen-java/org/apache/cassandra/service/
src/java/org/apache/cassandra/cli/ src/java/org/apache/cassandra/config/
src/java/org/apache/cassandra/cql/common/ src/java/org...
Author: jbellis
Date: Tue Jul 21 01:36:52 2009
New Revision: 796108
URL: http://svn.apache.org/viewvc?rev=796108&view=rev
Log:
change String column names to byte[] to allow user-defined ordering.
patch by jbellis; reviewed by Sandeep Tata for CASSANDRA-185
Added:
incubator/cassandra/trunk/src/java/org/apache/cassandra/db/ColumnSerializer.java
incubator/cassandra/trunk/src/java/org/apache/cassandra/db/marshal/
incubator/cassandra/trunk/src/java/org/apache/cassandra/db/marshal/AbstractType.java
incubator/cassandra/trunk/src/java/org/apache/cassandra/db/marshal/AsciiType.java
incubator/cassandra/trunk/src/java/org/apache/cassandra/db/marshal/LongType.java
incubator/cassandra/trunk/src/java/org/apache/cassandra/db/marshal/MarshalException.java
incubator/cassandra/trunk/src/java/org/apache/cassandra/db/marshal/UTF8Type.java
incubator/cassandra/trunk/src/java/org/apache/cassandra/db/marshal/UUIDType.java
incubator/cassandra/trunk/test/unit/org/apache/cassandra/db/marshal/
incubator/cassandra/trunk/test/unit/org/apache/cassandra/db/marshal/AsciiTypeTest.java
Removed:
incubator/cassandra/trunk/src/java/org/apache/cassandra/db/ColumnComparatorFactory.java
incubator/cassandra/trunk/src/java/org/apache/cassandra/db/EfficientBidiMap.java
incubator/cassandra/trunk/test/unit/org/apache/cassandra/db/ColumnComparatorFactoryTest.java
Modified:
incubator/cassandra/trunk/conf/storage-conf.xml
incubator/cassandra/trunk/interface/cassandra.thrift
incubator/cassandra/trunk/interface/gen-java/org/apache/cassandra/service/Cassandra.java
incubator/cassandra/trunk/interface/gen-java/org/apache/cassandra/service/Column.java
incubator/cassandra/trunk/interface/gen-java/org/apache/cassandra/service/ColumnParent.java
incubator/cassandra/trunk/interface/gen-java/org/apache/cassandra/service/ColumnPath.java
incubator/cassandra/trunk/interface/gen-java/org/apache/cassandra/service/ColumnPathOrParent.java
incubator/cassandra/trunk/interface/gen-java/org/apache/cassandra/service/SuperColumn.java
incubator/cassandra/trunk/interface/gen-java/org/apache/cassandra/service/SuperColumnPath.java
incubator/cassandra/trunk/src/java/org/apache/cassandra/cli/CliClient.java
incubator/cassandra/trunk/src/java/org/apache/cassandra/config/CFMetaData.java
incubator/cassandra/trunk/src/java/org/apache/cassandra/config/DatabaseDescriptor.java
incubator/cassandra/trunk/src/java/org/apache/cassandra/cql/common/ColumnRangeQueryRSD.java
incubator/cassandra/trunk/src/java/org/apache/cassandra/cql/common/Plan.java
incubator/cassandra/trunk/src/java/org/apache/cassandra/cql/common/QueryPlan.java
incubator/cassandra/trunk/src/java/org/apache/cassandra/cql/common/RowSourceDef.java
incubator/cassandra/trunk/src/java/org/apache/cassandra/cql/common/SetColumnMap.java
incubator/cassandra/trunk/src/java/org/apache/cassandra/cql/common/SetSuperColumnMap.java
incubator/cassandra/trunk/src/java/org/apache/cassandra/cql/common/SetUniqueKey.java
incubator/cassandra/trunk/src/java/org/apache/cassandra/cql/common/SuperColumnRangeQueryRSD.java
incubator/cassandra/trunk/src/java/org/apache/cassandra/cql/common/UniqueKeyQueryRSD.java
incubator/cassandra/trunk/src/java/org/apache/cassandra/db/Column.java
incubator/cassandra/trunk/src/java/org/apache/cassandra/db/ColumnFamily.java
incubator/cassandra/trunk/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
incubator/cassandra/trunk/src/java/org/apache/cassandra/db/ColumnIndexer.java
incubator/cassandra/trunk/src/java/org/apache/cassandra/db/HintedHandOffManager.java
incubator/cassandra/trunk/src/java/org/apache/cassandra/db/IColumn.java
incubator/cassandra/trunk/src/java/org/apache/cassandra/db/Memtable.java
incubator/cassandra/trunk/src/java/org/apache/cassandra/db/ReadCommand.java
incubator/cassandra/trunk/src/java/org/apache/cassandra/db/RowMutation.java
incubator/cassandra/trunk/src/java/org/apache/cassandra/db/RowMutationVerbHandler.java
incubator/cassandra/trunk/src/java/org/apache/cassandra/db/Scanner.java
incubator/cassandra/trunk/src/java/org/apache/cassandra/db/SliceByNamesReadCommand.java
incubator/cassandra/trunk/src/java/org/apache/cassandra/db/SliceFromReadCommand.java
incubator/cassandra/trunk/src/java/org/apache/cassandra/db/SuperColumn.java
incubator/cassandra/trunk/src/java/org/apache/cassandra/db/SystemTable.java
incubator/cassandra/trunk/src/java/org/apache/cassandra/db/Table.java
incubator/cassandra/trunk/src/java/org/apache/cassandra/db/filter/IdentityQueryFilter.java
incubator/cassandra/trunk/src/java/org/apache/cassandra/db/filter/NamesQueryFilter.java
incubator/cassandra/trunk/src/java/org/apache/cassandra/db/filter/QueryFilter.java
incubator/cassandra/trunk/src/java/org/apache/cassandra/db/filter/QueryPath.java
incubator/cassandra/trunk/src/java/org/apache/cassandra/db/filter/SSTableNamesIterator.java
incubator/cassandra/trunk/src/java/org/apache/cassandra/db/filter/SSTableSliceIterator.java
incubator/cassandra/trunk/src/java/org/apache/cassandra/db/filter/SliceQueryFilter.java
incubator/cassandra/trunk/src/java/org/apache/cassandra/io/IFileReader.java
incubator/cassandra/trunk/src/java/org/apache/cassandra/io/IndexHelper.java
incubator/cassandra/trunk/src/java/org/apache/cassandra/io/SSTableReader.java
incubator/cassandra/trunk/src/java/org/apache/cassandra/io/SequenceFile.java
incubator/cassandra/trunk/src/java/org/apache/cassandra/service/CassandraDaemon.java
incubator/cassandra/trunk/src/java/org/apache/cassandra/service/CassandraServer.java
incubator/cassandra/trunk/src/java/org/apache/cassandra/utils/BloomFilter.java
incubator/cassandra/trunk/src/java/org/apache/cassandra/utils/FBUtilities.java
incubator/cassandra/trunk/src/java/org/apache/cassandra/utils/Filter.java
incubator/cassandra/trunk/src/java/org/apache/cassandra/utils/ReducingIterator.java
incubator/cassandra/trunk/test/conf/storage-conf.xml
incubator/cassandra/trunk/test/system/test_server.py
incubator/cassandra/trunk/test/unit/org/apache/cassandra/Util.java
incubator/cassandra/trunk/test/unit/org/apache/cassandra/db/ColumnFamilyStoreTest.java
incubator/cassandra/trunk/test/unit/org/apache/cassandra/db/ColumnFamilyTest.java
incubator/cassandra/trunk/test/unit/org/apache/cassandra/db/CommitLogTest.java
incubator/cassandra/trunk/test/unit/org/apache/cassandra/db/CompactionsTest.java
incubator/cassandra/trunk/test/unit/org/apache/cassandra/db/NameSortTest.java
incubator/cassandra/trunk/test/unit/org/apache/cassandra/db/OneCompactionTest.java
incubator/cassandra/trunk/test/unit/org/apache/cassandra/db/ReadMessageTest.java
incubator/cassandra/trunk/test/unit/org/apache/cassandra/db/RemoveColumnFamilyTest.java
incubator/cassandra/trunk/test/unit/org/apache/cassandra/db/RemoveColumnFamilyWithFlush1Test.java
incubator/cassandra/trunk/test/unit/org/apache/cassandra/db/RemoveColumnFamilyWithFlush2Test.java
incubator/cassandra/trunk/test/unit/org/apache/cassandra/db/RemoveColumnTest.java
incubator/cassandra/trunk/test/unit/org/apache/cassandra/db/RemoveSubColumnTest.java
incubator/cassandra/trunk/test/unit/org/apache/cassandra/db/RemoveSuperColumnTest.java
incubator/cassandra/trunk/test/unit/org/apache/cassandra/db/RowTest.java
incubator/cassandra/trunk/test/unit/org/apache/cassandra/db/SuperColumnTest.java
incubator/cassandra/trunk/test/unit/org/apache/cassandra/db/TableTest.java
Modified: incubator/cassandra/trunk/conf/storage-conf.xml
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/conf/storage-conf.xml?rev=796108&r1=796107&r2=796108&view=diff
==============================================================================
--- incubator/cassandra/trunk/conf/storage-conf.xml (original)
+++ incubator/cassandra/trunk/conf/storage-conf.xml Tue Jul 21 01:36:52 2009
@@ -49,13 +49,21 @@
disable entirely.
-->
<KeysCachedFraction>0.01</KeysCachedFraction>
- <!-- if FlushPeriodInMinutes is configured and positive, it will be
+ <!--
+ The CompareWith attribute tells Cassandra how to sort the columns
+ for slicing operations. For backwards compatibility, the default
+ is to use AsciiType, which is probably NOT what you want.
+ Other options are UTF8Type, UUIDType, and LongType.
+ You can also specify the fully-qualified class name to a class
+ of your choice implementing org.apache.cassandra.db.marshal.IType.
+
+ if FlushPeriodInMinutes is configured and positive, it will be
flushed to disk with that period whether it is dirty or not.
This is intended for lightly-used columnfamilies so that they
do not prevent commitlog segments from being purged. -->
- <ColumnFamily ColumnSort="Name" Name="Standard1" FlushPeriodInMinutes="60"/>
- <ColumnFamily ColumnSort="Name" Name="Standard2"/>
- <ColumnFamily ColumnSort="Time" Name="StandardByTime1"/>
+ <ColumnFamily CompareWith="UTF8Type" Name="Standard1" FlushPeriodInMinutes="60"/>
+ <ColumnFamily CompareWith="UTF8Type" Name="Standard2"/>
+ <ColumnFamily CompareWith="UUIDType" Name="StandardByTime1"/>
<ColumnFamily ColumnType="Super" Name="Super1"/>
</Table>
</Tables>
Modified: incubator/cassandra/trunk/interface/cassandra.thrift
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/interface/cassandra.thrift?rev=796108&r1=796107&r2=796108&view=diff
==============================================================================
--- incubator/cassandra/trunk/interface/cassandra.thrift (original)
+++ incubator/cassandra/trunk/interface/cassandra.thrift Tue Jul 21 01:36:52 2009
@@ -31,7 +31,7 @@
#
struct Column {
- 1: string name,
+ 1: binary name,
2: binary value,
3: i64 timestamp,
}
@@ -44,7 +44,7 @@
}
struct SuperColumn {
- 1: string name,
+ 1: binary name,
2: list<Column> columns,
}
@@ -91,32 +91,32 @@
struct ColumnParent {
3: string column_family,
- 4: optional string super_column,
+ 4: optional binary super_column,
}
struct ColumnPath {
3: string column_family,
- 4: optional string super_column,
- 5: string column,
+ 4: optional binary super_column,
+ 5: binary column,
}
struct SuperColumnPath {
3: string column_family,
- 4: string super_column,
+ 4: binary super_column,
}
struct ColumnPathOrParent {
3: string column_family,
- 4: optional string super_column,
- 5: optional string column,
+ 4: optional binary super_column,
+ 5: optional binary column,
}
service Cassandra {
- list<Column> get_slice_by_names(1:string table, 2:string key, 3:ColumnParent column_parent, 4:list<string> column_names)
+ list<Column> get_slice_by_names(1:string table, 2:string key, 3:ColumnParent column_parent, 4:list<binary> column_names)
throws (1: InvalidRequestException ire, 2: NotFoundException nfe),
- list<Column> get_slice(1:string table, 2:string key, 3:ColumnParent column_parent, 4:string start, 5:string finish, 6:bool is_ascending, 7:i32 count=100)
+ list<Column> get_slice(1:string table, 2:string key, 3:ColumnParent column_parent, 4:binary start, 5:binary finish, 6:bool is_ascending, 7:i32 count=100)
throws (1: InvalidRequestException ire, 2: NotFoundException nfe),
Column get_column(1:string table, 2:string key, 3:ColumnPath column_path)
@@ -134,10 +134,10 @@
void remove(1:string table, 2:string key, 3:ColumnPathOrParent column_path_or_parent, 4:i64 timestamp, 5:i32 block_for=0)
throws (1: InvalidRequestException ire, 2: UnavailableException ue),
- list<SuperColumn> get_slice_super(1:string table, 2:string key, 3:string column_family, 4:string start, 5:string finish, 6:bool is_ascending, 7:i32 count=100)
+ list<SuperColumn> get_slice_super(1:string table, 2:string key, 3:string column_family, 4:binary start, 5:binary finish, 6:bool is_ascending, 7:i32 count=100)
throws (1: InvalidRequestException ire),
- list<SuperColumn> get_slice_super_by_names(1:string table, 2:string key, 3:string column_family, 4:list<string> super_column_names)
+ list<SuperColumn> get_slice_super_by_names(1:string table, 2:string key, 3:string column_family, 4:list<binary> super_column_names)
throws (1: InvalidRequestException ire),
SuperColumn get_super_column(1:string table, 2:string key, 3:SuperColumnPath super_column_path)
Modified: incubator/cassandra/trunk/interface/gen-java/org/apache/cassandra/service/Cassandra.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/interface/gen-java/org/apache/cassandra/service/Cassandra.java?rev=796108&r1=796107&r2=796108&view=diff
==============================================================================
--- incubator/cassandra/trunk/interface/gen-java/org/apache/cassandra/service/Cassandra.java (original)
+++ incubator/cassandra/trunk/interface/gen-java/org/apache/cassandra/service/Cassandra.java Tue Jul 21 01:36:52 2009
@@ -22,9 +22,9 @@
public interface Iface {
- public List<Column> get_slice_by_names(String table, String key, ColumnParent column_parent, List<String> column_names) throws InvalidRequestException, NotFoundException, TException;
+ public List<Column> get_slice_by_names(String table, String key, ColumnParent column_parent, List<byte[]> column_names) throws InvalidRequestException, NotFoundException, TException;
- public List<Column> get_slice(String table, String key, ColumnParent column_parent, String start, String finish, boolean is_ascending, int count) throws InvalidRequestException, NotFoundException, TException;
+ public List<Column> get_slice(String table, String key, ColumnParent column_parent, byte[] start, byte[] finish, boolean is_ascending, int count) throws InvalidRequestException, NotFoundException, TException;
public Column get_column(String table, String key, ColumnPath column_path) throws InvalidRequestException, NotFoundException, TException;
@@ -36,9 +36,9 @@
public void remove(String table, String key, ColumnPathOrParent column_path_or_parent, long timestamp, int block_for) throws InvalidRequestException, UnavailableException, TException;
- public List<SuperColumn> get_slice_super(String table, String key, String column_family, String start, String finish, boolean is_ascending, int count) throws InvalidRequestException, TException;
+ public List<SuperColumn> get_slice_super(String table, String key, String column_family, byte[] start, byte[] finish, boolean is_ascending, int count) throws InvalidRequestException, TException;
- public List<SuperColumn> get_slice_super_by_names(String table, String key, String column_family, List<String> super_column_names) throws InvalidRequestException, TException;
+ public List<SuperColumn> get_slice_super_by_names(String table, String key, String column_family, List<byte[]> super_column_names) throws InvalidRequestException, TException;
public SuperColumn get_super_column(String table, String key, SuperColumnPath super_column_path) throws InvalidRequestException, NotFoundException, TException;
@@ -83,13 +83,13 @@
return this.oprot_;
}
- public List<Column> get_slice_by_names(String table, String key, ColumnParent column_parent, List<String> column_names) throws InvalidRequestException, NotFoundException, TException
+ public List<Column> get_slice_by_names(String table, String key, ColumnParent column_parent, List<byte[]> column_names) throws InvalidRequestException, NotFoundException, TException
{
send_get_slice_by_names(table, key, column_parent, column_names);
return recv_get_slice_by_names();
}
- public void send_get_slice_by_names(String table, String key, ColumnParent column_parent, List<String> column_names) throws TException
+ public void send_get_slice_by_names(String table, String key, ColumnParent column_parent, List<byte[]> column_names) throws TException
{
oprot_.writeMessageBegin(new TMessage("get_slice_by_names", TMessageType.CALL, seqid_));
get_slice_by_names_args args = new get_slice_by_names_args();
@@ -125,13 +125,13 @@
throw new TApplicationException(TApplicationException.MISSING_RESULT, "get_slice_by_names failed: unknown result");
}
- public List<Column> get_slice(String table, String key, ColumnParent column_parent, String start, String finish, boolean is_ascending, int count) throws InvalidRequestException, NotFoundException, TException
+ public List<Column> get_slice(String table, String key, ColumnParent column_parent, byte[] start, byte[] finish, boolean is_ascending, int count) throws InvalidRequestException, NotFoundException, TException
{
send_get_slice(table, key, column_parent, start, finish, is_ascending, count);
return recv_get_slice();
}
- public void send_get_slice(String table, String key, ColumnParent column_parent, String start, String finish, boolean is_ascending, int count) throws TException
+ public void send_get_slice(String table, String key, ColumnParent column_parent, byte[] start, byte[] finish, boolean is_ascending, int count) throws TException
{
oprot_.writeMessageBegin(new TMessage("get_slice", TMessageType.CALL, seqid_));
get_slice_args args = new get_slice_args();
@@ -368,13 +368,13 @@
return;
}
- public List<SuperColumn> get_slice_super(String table, String key, String column_family, String start, String finish, boolean is_ascending, int count) throws InvalidRequestException, TException
+ public List<SuperColumn> get_slice_super(String table, String key, String column_family, byte[] start, byte[] finish, boolean is_ascending, int count) throws InvalidRequestException, TException
{
send_get_slice_super(table, key, column_family, start, finish, is_ascending, count);
return recv_get_slice_super();
}
- public void send_get_slice_super(String table, String key, String column_family, String start, String finish, boolean is_ascending, int count) throws TException
+ public void send_get_slice_super(String table, String key, String column_family, byte[] start, byte[] finish, boolean is_ascending, int count) throws TException
{
oprot_.writeMessageBegin(new TMessage("get_slice_super", TMessageType.CALL, seqid_));
get_slice_super_args args = new get_slice_super_args();
@@ -410,13 +410,13 @@
throw new TApplicationException(TApplicationException.MISSING_RESULT, "get_slice_super failed: unknown result");
}
- public List<SuperColumn> get_slice_super_by_names(String table, String key, String column_family, List<String> super_column_names) throws InvalidRequestException, TException
+ public List<SuperColumn> get_slice_super_by_names(String table, String key, String column_family, List<byte[]> super_column_names) throws InvalidRequestException, TException
{
send_get_slice_super_by_names(table, key, column_family, super_column_names);
return recv_get_slice_super_by_names();
}
- public void send_get_slice_super_by_names(String table, String key, String column_family, List<String> super_column_names) throws TException
+ public void send_get_slice_super_by_names(String table, String key, String column_family, List<byte[]> super_column_names) throws TException
{
oprot_.writeMessageBegin(new TMessage("get_slice_super_by_names", TMessageType.CALL, seqid_));
get_slice_super_by_names_args args = new get_slice_super_by_names_args();
@@ -1196,7 +1196,7 @@
public static final int KEY = 2;
public ColumnParent column_parent;
public static final int COLUMN_PARENT = 3;
- public List<String> column_names;
+ public List<byte[]> column_names;
public static final int COLUMN_NAMES = 4;
private final Isset __isset = new Isset();
@@ -1226,7 +1226,7 @@
String table,
String key,
ColumnParent column_parent,
- List<String> column_names)
+ List<byte[]> column_names)
{
this();
this.table = table;
@@ -1249,9 +1249,11 @@
this.column_parent = new ColumnParent(other.column_parent);
}
if (other.isSetColumn_names()) {
- List<String> __this__column_names = new ArrayList<String>();
- for (String other_element : other.column_names) {
- __this__column_names.add(other_element);
+ List<byte[]> __this__column_names = new ArrayList<byte[]>();
+ for (byte[] other_element : other.column_names) {
+ byte[] temp_binary_element = new byte[other_element.length];
+ System.arraycopy(other_element, 0, temp_binary_element, 0, other_element.length);
+ __this__column_names.add(temp_binary_element);
}
this.column_names = __this__column_names;
}
@@ -1335,22 +1337,22 @@
return (this.column_names == null) ? 0 : this.column_names.size();
}
- public java.util.Iterator<String> getColumn_namesIterator() {
+ public java.util.Iterator<byte[]> getColumn_namesIterator() {
return (this.column_names == null) ? null : this.column_names.iterator();
}
- public void addToColumn_names(String elem) {
+ public void addToColumn_names(byte[] elem) {
if (this.column_names == null) {
- this.column_names = new ArrayList<String>();
+ this.column_names = new ArrayList<byte[]>();
}
this.column_names.add(elem);
}
- public List<String> getColumn_names() {
+ public List<byte[]> getColumn_names() {
return this.column_names;
}
- public void setColumn_names(List<String> column_names) {
+ public void setColumn_names(List<byte[]> column_names) {
this.column_names = column_names;
}
@@ -1399,7 +1401,7 @@
if (value == null) {
unsetColumn_names();
} else {
- setColumn_names((List<String>)value);
+ setColumn_names((List<byte[]>)value);
}
break;
@@ -1537,11 +1539,11 @@
if (field.type == TType.LIST) {
{
TList _list31 = iprot.readListBegin();
- this.column_names = new ArrayList<String>(_list31.size);
+ this.column_names = new ArrayList<byte[]>(_list31.size);
for (int _i32 = 0; _i32 < _list31.size; ++_i32)
{
- String _elem33;
- _elem33 = iprot.readString();
+ byte[] _elem33;
+ _elem33 = iprot.readBinary();
this.column_names.add(_elem33);
}
iprot.readListEnd();
@@ -1586,8 +1588,8 @@
oprot.writeFieldBegin(COLUMN_NAMES_FIELD_DESC);
{
oprot.writeListBegin(new TList(TType.STRING, this.column_names.size()));
- for (String _iter34 : this.column_names) {
- oprot.writeString(_iter34);
+ for (byte[] _iter34 : this.column_names) {
+ oprot.writeBinary(_iter34);
}
oprot.writeListEnd();
}
@@ -2045,9 +2047,9 @@
public static final int KEY = 2;
public ColumnParent column_parent;
public static final int COLUMN_PARENT = 3;
- public String start;
+ public byte[] start;
public static final int START = 4;
- public String finish;
+ public byte[] finish;
public static final int FINISH = 5;
public boolean is_ascending;
public static final int IS_ASCENDING = 6;
@@ -2090,8 +2092,8 @@
String table,
String key,
ColumnParent column_parent,
- String start,
- String finish,
+ byte[] start,
+ byte[] finish,
boolean is_ascending,
int count)
{
@@ -2121,10 +2123,12 @@
this.column_parent = new ColumnParent(other.column_parent);
}
if (other.isSetStart()) {
- this.start = other.start;
+ this.start = new byte[other.start.length];
+ System.arraycopy(other.start, 0, start, 0, other.start.length);
}
if (other.isSetFinish()) {
- this.finish = other.finish;
+ this.finish = new byte[other.finish.length];
+ System.arraycopy(other.finish, 0, finish, 0, other.finish.length);
}
__isset.is_ascending = other.__isset.is_ascending;
this.is_ascending = other.is_ascending;
@@ -2206,11 +2210,11 @@
}
}
- public String getStart() {
+ public byte[] getStart() {
return this.start;
}
- public void setStart(String start) {
+ public void setStart(byte[] start) {
this.start = start;
}
@@ -2229,11 +2233,11 @@
}
}
- public String getFinish() {
+ public byte[] getFinish() {
return this.finish;
}
- public void setFinish(String finish) {
+ public void setFinish(byte[] finish) {
this.finish = finish;
}
@@ -2326,7 +2330,7 @@
if (value == null) {
unsetStart();
} else {
- setStart((String)value);
+ setStart((byte[])value);
}
break;
@@ -2334,7 +2338,7 @@
if (value == null) {
unsetFinish();
} else {
- setFinish((String)value);
+ setFinish((byte[])value);
}
break;
@@ -2454,7 +2458,7 @@
if (this_present_start || that_present_start) {
if (!(this_present_start && that_present_start))
return false;
- if (!this.start.equals(that.start))
+ if (!java.util.Arrays.equals(this.start, that.start))
return false;
}
@@ -2463,7 +2467,7 @@
if (this_present_finish || that_present_finish) {
if (!(this_present_finish && that_present_finish))
return false;
- if (!this.finish.equals(that.finish))
+ if (!java.util.Arrays.equals(this.finish, that.finish))
return false;
}
@@ -2528,14 +2532,14 @@
break;
case START:
if (field.type == TType.STRING) {
- this.start = iprot.readString();
+ this.start = iprot.readBinary();
} else {
TProtocolUtil.skip(iprot, field.type);
}
break;
case FINISH:
if (field.type == TType.STRING) {
- this.finish = iprot.readString();
+ this.finish = iprot.readBinary();
} else {
TProtocolUtil.skip(iprot, field.type);
}
@@ -2590,12 +2594,12 @@
}
if (this.start != null) {
oprot.writeFieldBegin(START_FIELD_DESC);
- oprot.writeString(this.start);
+ oprot.writeBinary(this.start);
oprot.writeFieldEnd();
}
if (this.finish != null) {
oprot.writeFieldBegin(FINISH_FIELD_DESC);
- oprot.writeString(this.finish);
+ oprot.writeBinary(this.finish);
oprot.writeFieldEnd();
}
oprot.writeFieldBegin(IS_ASCENDING_FIELD_DESC);
@@ -2641,7 +2645,12 @@
if (this.start == null) {
sb.append("null");
} else {
- sb.append(this.start);
+ int __start_size = Math.min(this.start.length, 128);
+ for (int i = 0; i < __start_size; i++) {
+ if (i != 0) sb.append(" ");
+ sb.append(Integer.toHexString(this.start[i]).length() > 1 ? Integer.toHexString(this.start[i]).substring(Integer.toHexString(this.start[i]).length() - 2).toUpperCase() : "0" + Integer.toHexString(this.start[i]).toUpperCase());
+ }
+ if (this.start.length > 128) sb.append(" ...");
}
first = false;
if (!first) sb.append(", ");
@@ -2649,7 +2658,12 @@
if (this.finish == null) {
sb.append("null");
} else {
- sb.append(this.finish);
+ int __finish_size = Math.min(this.finish.length, 128);
+ for (int i = 0; i < __finish_size; i++) {
+ if (i != 0) sb.append(" ");
+ sb.append(Integer.toHexString(this.finish[i]).length() > 1 ? Integer.toHexString(this.finish[i]).substring(Integer.toHexString(this.finish[i]).length() - 2).toUpperCase() : "0" + Integer.toHexString(this.finish[i]).toUpperCase());
+ }
+ if (this.finish.length > 128) sb.append(" ...");
}
first = false;
if (!first) sb.append(", ");
@@ -6625,9 +6639,9 @@
public static final int KEY = 2;
public String column_family;
public static final int COLUMN_FAMILY = 3;
- public String start;
+ public byte[] start;
public static final int START = 4;
- public String finish;
+ public byte[] finish;
public static final int FINISH = 5;
public boolean is_ascending;
public static final int IS_ASCENDING = 6;
@@ -6670,8 +6684,8 @@
String table,
String key,
String column_family,
- String start,
- String finish,
+ byte[] start,
+ byte[] finish,
boolean is_ascending,
int count)
{
@@ -6701,10 +6715,12 @@
this.column_family = other.column_family;
}
if (other.isSetStart()) {
- this.start = other.start;
+ this.start = new byte[other.start.length];
+ System.arraycopy(other.start, 0, start, 0, other.start.length);
}
if (other.isSetFinish()) {
- this.finish = other.finish;
+ this.finish = new byte[other.finish.length];
+ System.arraycopy(other.finish, 0, finish, 0, other.finish.length);
}
__isset.is_ascending = other.__isset.is_ascending;
this.is_ascending = other.is_ascending;
@@ -6786,11 +6802,11 @@
}
}
- public String getStart() {
+ public byte[] getStart() {
return this.start;
}
- public void setStart(String start) {
+ public void setStart(byte[] start) {
this.start = start;
}
@@ -6809,11 +6825,11 @@
}
}
- public String getFinish() {
+ public byte[] getFinish() {
return this.finish;
}
- public void setFinish(String finish) {
+ public void setFinish(byte[] finish) {
this.finish = finish;
}
@@ -6906,7 +6922,7 @@
if (value == null) {
unsetStart();
} else {
- setStart((String)value);
+ setStart((byte[])value);
}
break;
@@ -6914,7 +6930,7 @@
if (value == null) {
unsetFinish();
} else {
- setFinish((String)value);
+ setFinish((byte[])value);
}
break;
@@ -7034,7 +7050,7 @@
if (this_present_start || that_present_start) {
if (!(this_present_start && that_present_start))
return false;
- if (!this.start.equals(that.start))
+ if (!java.util.Arrays.equals(this.start, that.start))
return false;
}
@@ -7043,7 +7059,7 @@
if (this_present_finish || that_present_finish) {
if (!(this_present_finish && that_present_finish))
return false;
- if (!this.finish.equals(that.finish))
+ if (!java.util.Arrays.equals(this.finish, that.finish))
return false;
}
@@ -7107,14 +7123,14 @@
break;
case START:
if (field.type == TType.STRING) {
- this.start = iprot.readString();
+ this.start = iprot.readBinary();
} else {
TProtocolUtil.skip(iprot, field.type);
}
break;
case FINISH:
if (field.type == TType.STRING) {
- this.finish = iprot.readString();
+ this.finish = iprot.readBinary();
} else {
TProtocolUtil.skip(iprot, field.type);
}
@@ -7169,12 +7185,12 @@
}
if (this.start != null) {
oprot.writeFieldBegin(START_FIELD_DESC);
- oprot.writeString(this.start);
+ oprot.writeBinary(this.start);
oprot.writeFieldEnd();
}
if (this.finish != null) {
oprot.writeFieldBegin(FINISH_FIELD_DESC);
- oprot.writeString(this.finish);
+ oprot.writeBinary(this.finish);
oprot.writeFieldEnd();
}
oprot.writeFieldBegin(IS_ASCENDING_FIELD_DESC);
@@ -7220,7 +7236,12 @@
if (this.start == null) {
sb.append("null");
} else {
- sb.append(this.start);
+ int __start_size = Math.min(this.start.length, 128);
+ for (int i = 0; i < __start_size; i++) {
+ if (i != 0) sb.append(" ");
+ sb.append(Integer.toHexString(this.start[i]).length() > 1 ? Integer.toHexString(this.start[i]).substring(Integer.toHexString(this.start[i]).length() - 2).toUpperCase() : "0" + Integer.toHexString(this.start[i]).toUpperCase());
+ }
+ if (this.start.length > 128) sb.append(" ...");
}
first = false;
if (!first) sb.append(", ");
@@ -7228,7 +7249,12 @@
if (this.finish == null) {
sb.append("null");
} else {
- sb.append(this.finish);
+ int __finish_size = Math.min(this.finish.length, 128);
+ for (int i = 0; i < __finish_size; i++) {
+ if (i != 0) sb.append(" ");
+ sb.append(Integer.toHexString(this.finish[i]).length() > 1 ? Integer.toHexString(this.finish[i]).substring(Integer.toHexString(this.finish[i]).length() - 2).toUpperCase() : "0" + Integer.toHexString(this.finish[i]).toUpperCase());
+ }
+ if (this.finish.length > 128) sb.append(" ...");
}
first = false;
if (!first) sb.append(", ");
@@ -7573,7 +7599,7 @@
public static final int KEY = 2;
public String column_family;
public static final int COLUMN_FAMILY = 3;
- public List<String> super_column_names;
+ public List<byte[]> super_column_names;
public static final int SUPER_COLUMN_NAMES = 4;
private final Isset __isset = new Isset();
@@ -7603,7 +7629,7 @@
String table,
String key,
String column_family,
- List<String> super_column_names)
+ List<byte[]> super_column_names)
{
this();
this.table = table;
@@ -7626,9 +7652,11 @@
this.column_family = other.column_family;
}
if (other.isSetSuper_column_names()) {
- List<String> __this__super_column_names = new ArrayList<String>();
- for (String other_element : other.super_column_names) {
- __this__super_column_names.add(other_element);
+ List<byte[]> __this__super_column_names = new ArrayList<byte[]>();
+ for (byte[] other_element : other.super_column_names) {
+ byte[] temp_binary_element = new byte[other_element.length];
+ System.arraycopy(other_element, 0, temp_binary_element, 0, other_element.length);
+ __this__super_column_names.add(temp_binary_element);
}
this.super_column_names = __this__super_column_names;
}
@@ -7712,22 +7740,22 @@
return (this.super_column_names == null) ? 0 : this.super_column_names.size();
}
- public java.util.Iterator<String> getSuper_column_namesIterator() {
+ public java.util.Iterator<byte[]> getSuper_column_namesIterator() {
return (this.super_column_names == null) ? null : this.super_column_names.iterator();
}
- public void addToSuper_column_names(String elem) {
+ public void addToSuper_column_names(byte[] elem) {
if (this.super_column_names == null) {
- this.super_column_names = new ArrayList<String>();
+ this.super_column_names = new ArrayList<byte[]>();
}
this.super_column_names.add(elem);
}
- public List<String> getSuper_column_names() {
+ public List<byte[]> getSuper_column_names() {
return this.super_column_names;
}
- public void setSuper_column_names(List<String> super_column_names) {
+ public void setSuper_column_names(List<byte[]> super_column_names) {
this.super_column_names = super_column_names;
}
@@ -7776,7 +7804,7 @@
if (value == null) {
unsetSuper_column_names();
} else {
- setSuper_column_names((List<String>)value);
+ setSuper_column_names((List<byte[]>)value);
}
break;
@@ -7913,11 +7941,11 @@
if (field.type == TType.LIST) {
{
TList _list47 = iprot.readListBegin();
- this.super_column_names = new ArrayList<String>(_list47.size);
+ this.super_column_names = new ArrayList<byte[]>(_list47.size);
for (int _i48 = 0; _i48 < _list47.size; ++_i48)
{
- String _elem49;
- _elem49 = iprot.readString();
+ byte[] _elem49;
+ _elem49 = iprot.readBinary();
this.super_column_names.add(_elem49);
}
iprot.readListEnd();
@@ -7962,8 +7990,8 @@
oprot.writeFieldBegin(SUPER_COLUMN_NAMES_FIELD_DESC);
{
oprot.writeListBegin(new TList(TType.STRING, this.super_column_names.size()));
- for (String _iter50 : this.super_column_names) {
- oprot.writeString(_iter50);
+ for (byte[] _iter50 : this.super_column_names) {
+ oprot.writeBinary(_iter50);
}
oprot.writeListEnd();
}
Modified: incubator/cassandra/trunk/interface/gen-java/org/apache/cassandra/service/Column.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/interface/gen-java/org/apache/cassandra/service/Column.java?rev=796108&r1=796107&r2=796108&view=diff
==============================================================================
--- incubator/cassandra/trunk/interface/gen-java/org/apache/cassandra/service/Column.java (original)
+++ incubator/cassandra/trunk/interface/gen-java/org/apache/cassandra/service/Column.java Tue Jul 21 01:36:52 2009
@@ -24,7 +24,7 @@
private static final TField VALUE_FIELD_DESC = new TField("value", TType.STRING, (short)2);
private static final TField TIMESTAMP_FIELD_DESC = new TField("timestamp", TType.I64, (short)3);
- public String name;
+ public byte[] name;
public static final int NAME = 1;
public byte[] value;
public static final int VALUE = 2;
@@ -53,7 +53,7 @@
}
public Column(
- String name,
+ byte[] name,
byte[] value,
long timestamp)
{
@@ -69,7 +69,8 @@
*/
public Column(Column other) {
if (other.isSetName()) {
- this.name = other.name;
+ this.name = new byte[other.name.length];
+ System.arraycopy(other.name, 0, name, 0, other.name.length);
}
if (other.isSetValue()) {
this.value = new byte[other.value.length];
@@ -84,11 +85,11 @@
return new Column(this);
}
- public String getName() {
+ public byte[] getName() {
return this.name;
}
- public void setName(String name) {
+ public void setName(byte[] name) {
this.name = name;
}
@@ -158,7 +159,7 @@
if (value == null) {
unsetName();
} else {
- setName((String)value);
+ setName((byte[])value);
}
break;
@@ -231,7 +232,7 @@
if (this_present_name || that_present_name) {
if (!(this_present_name && that_present_name))
return false;
- if (!this.name.equals(that.name))
+ if (!java.util.Arrays.equals(this.name, that.name))
return false;
}
@@ -274,7 +275,7 @@
{
case NAME:
if (field.type == TType.STRING) {
- this.name = iprot.readString();
+ this.name = iprot.readBinary();
} else {
TProtocolUtil.skip(iprot, field.type);
}
@@ -313,7 +314,7 @@
oprot.writeStructBegin(STRUCT_DESC);
if (this.name != null) {
oprot.writeFieldBegin(NAME_FIELD_DESC);
- oprot.writeString(this.name);
+ oprot.writeBinary(this.name);
oprot.writeFieldEnd();
}
if (this.value != null) {
@@ -337,7 +338,12 @@
if (this.name == null) {
sb.append("null");
} else {
- sb.append(this.name);
+ int __name_size = Math.min(this.name.length, 128);
+ for (int i = 0; i < __name_size; i++) {
+ if (i != 0) sb.append(" ");
+ sb.append(Integer.toHexString(this.name[i]).length() > 1 ? Integer.toHexString(this.name[i]).substring(Integer.toHexString(this.name[i]).length() - 2).toUpperCase() : "0" + Integer.toHexString(this.name[i]).toUpperCase());
+ }
+ if (this.name.length > 128) sb.append(" ...");
}
first = false;
if (!first) sb.append(", ");
Modified: incubator/cassandra/trunk/interface/gen-java/org/apache/cassandra/service/ColumnParent.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/interface/gen-java/org/apache/cassandra/service/ColumnParent.java?rev=796108&r1=796107&r2=796108&view=diff
==============================================================================
--- incubator/cassandra/trunk/interface/gen-java/org/apache/cassandra/service/ColumnParent.java (original)
+++ incubator/cassandra/trunk/interface/gen-java/org/apache/cassandra/service/ColumnParent.java Tue Jul 21 01:36:52 2009
@@ -25,7 +25,7 @@
public String column_family;
public static final int COLUMN_FAMILY = 3;
- public String super_column;
+ public byte[] super_column;
public static final int SUPER_COLUMN = 4;
private final Isset __isset = new Isset();
@@ -48,7 +48,7 @@
public ColumnParent(
String column_family,
- String super_column)
+ byte[] super_column)
{
this();
this.column_family = column_family;
@@ -63,7 +63,8 @@
this.column_family = other.column_family;
}
if (other.isSetSuper_column()) {
- this.super_column = other.super_column;
+ this.super_column = new byte[other.super_column.length];
+ System.arraycopy(other.super_column, 0, super_column, 0, other.super_column.length);
}
}
@@ -95,11 +96,11 @@
}
}
- public String getSuper_column() {
+ public byte[] getSuper_column() {
return this.super_column;
}
- public void setSuper_column(String super_column) {
+ public void setSuper_column(byte[] super_column) {
this.super_column = super_column;
}
@@ -132,7 +133,7 @@
if (value == null) {
unsetSuper_column();
} else {
- setSuper_column((String)value);
+ setSuper_column((byte[])value);
}
break;
@@ -193,7 +194,7 @@
if (this_present_super_column || that_present_super_column) {
if (!(this_present_super_column && that_present_super_column))
return false;
- if (!this.super_column.equals(that.super_column))
+ if (!java.util.Arrays.equals(this.super_column, that.super_column))
return false;
}
@@ -225,7 +226,7 @@
break;
case SUPER_COLUMN:
if (field.type == TType.STRING) {
- this.super_column = iprot.readString();
+ this.super_column = iprot.readBinary();
} else {
TProtocolUtil.skip(iprot, field.type);
}
@@ -254,7 +255,7 @@
}
if (this.super_column != null) {
oprot.writeFieldBegin(SUPER_COLUMN_FIELD_DESC);
- oprot.writeString(this.super_column);
+ oprot.writeBinary(this.super_column);
oprot.writeFieldEnd();
}
oprot.writeFieldStop();
@@ -279,7 +280,12 @@
if (this.super_column == null) {
sb.append("null");
} else {
- sb.append(this.super_column);
+ int __super_column_size = Math.min(this.super_column.length, 128);
+ for (int i = 0; i < __super_column_size; i++) {
+ if (i != 0) sb.append(" ");
+ sb.append(Integer.toHexString(this.super_column[i]).length() > 1 ? Integer.toHexString(this.super_column[i]).substring(Integer.toHexString(this.super_column[i]).length() - 2).toUpperCase() : "0" + Integer.toHexString(this.super_column[i]).toUpperCase());
+ }
+ if (this.super_column.length > 128) sb.append(" ...");
}
first = false;
}
Modified: incubator/cassandra/trunk/interface/gen-java/org/apache/cassandra/service/ColumnPath.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/interface/gen-java/org/apache/cassandra/service/ColumnPath.java?rev=796108&r1=796107&r2=796108&view=diff
==============================================================================
--- incubator/cassandra/trunk/interface/gen-java/org/apache/cassandra/service/ColumnPath.java (original)
+++ incubator/cassandra/trunk/interface/gen-java/org/apache/cassandra/service/ColumnPath.java Tue Jul 21 01:36:52 2009
@@ -26,9 +26,9 @@
public String column_family;
public static final int COLUMN_FAMILY = 3;
- public String super_column;
+ public byte[] super_column;
public static final int SUPER_COLUMN = 4;
- public String column;
+ public byte[] column;
public static final int COLUMN = 5;
private final Isset __isset = new Isset();
@@ -53,8 +53,8 @@
public ColumnPath(
String column_family,
- String super_column,
- String column)
+ byte[] super_column,
+ byte[] column)
{
this();
this.column_family = column_family;
@@ -70,10 +70,12 @@
this.column_family = other.column_family;
}
if (other.isSetSuper_column()) {
- this.super_column = other.super_column;
+ this.super_column = new byte[other.super_column.length];
+ System.arraycopy(other.super_column, 0, super_column, 0, other.super_column.length);
}
if (other.isSetColumn()) {
- this.column = other.column;
+ this.column = new byte[other.column.length];
+ System.arraycopy(other.column, 0, column, 0, other.column.length);
}
}
@@ -105,11 +107,11 @@
}
}
- public String getSuper_column() {
+ public byte[] getSuper_column() {
return this.super_column;
}
- public void setSuper_column(String super_column) {
+ public void setSuper_column(byte[] super_column) {
this.super_column = super_column;
}
@@ -128,11 +130,11 @@
}
}
- public String getColumn() {
+ public byte[] getColumn() {
return this.column;
}
- public void setColumn(String column) {
+ public void setColumn(byte[] column) {
this.column = column;
}
@@ -165,7 +167,7 @@
if (value == null) {
unsetSuper_column();
} else {
- setSuper_column((String)value);
+ setSuper_column((byte[])value);
}
break;
@@ -173,7 +175,7 @@
if (value == null) {
unsetColumn();
} else {
- setColumn((String)value);
+ setColumn((byte[])value);
}
break;
@@ -239,7 +241,7 @@
if (this_present_super_column || that_present_super_column) {
if (!(this_present_super_column && that_present_super_column))
return false;
- if (!this.super_column.equals(that.super_column))
+ if (!java.util.Arrays.equals(this.super_column, that.super_column))
return false;
}
@@ -248,7 +250,7 @@
if (this_present_column || that_present_column) {
if (!(this_present_column && that_present_column))
return false;
- if (!this.column.equals(that.column))
+ if (!java.util.Arrays.equals(this.column, that.column))
return false;
}
@@ -280,14 +282,14 @@
break;
case SUPER_COLUMN:
if (field.type == TType.STRING) {
- this.super_column = iprot.readString();
+ this.super_column = iprot.readBinary();
} else {
TProtocolUtil.skip(iprot, field.type);
}
break;
case COLUMN:
if (field.type == TType.STRING) {
- this.column = iprot.readString();
+ this.column = iprot.readBinary();
} else {
TProtocolUtil.skip(iprot, field.type);
}
@@ -316,12 +318,12 @@
}
if (this.super_column != null) {
oprot.writeFieldBegin(SUPER_COLUMN_FIELD_DESC);
- oprot.writeString(this.super_column);
+ oprot.writeBinary(this.super_column);
oprot.writeFieldEnd();
}
if (this.column != null) {
oprot.writeFieldBegin(COLUMN_FIELD_DESC);
- oprot.writeString(this.column);
+ oprot.writeBinary(this.column);
oprot.writeFieldEnd();
}
oprot.writeFieldStop();
@@ -346,7 +348,12 @@
if (this.super_column == null) {
sb.append("null");
} else {
- sb.append(this.super_column);
+ int __super_column_size = Math.min(this.super_column.length, 128);
+ for (int i = 0; i < __super_column_size; i++) {
+ if (i != 0) sb.append(" ");
+ sb.append(Integer.toHexString(this.super_column[i]).length() > 1 ? Integer.toHexString(this.super_column[i]).substring(Integer.toHexString(this.super_column[i]).length() - 2).toUpperCase() : "0" + Integer.toHexString(this.super_column[i]).toUpperCase());
+ }
+ if (this.super_column.length > 128) sb.append(" ...");
}
first = false;
}
@@ -355,7 +362,12 @@
if (this.column == null) {
sb.append("null");
} else {
- sb.append(this.column);
+ int __column_size = Math.min(this.column.length, 128);
+ for (int i = 0; i < __column_size; i++) {
+ if (i != 0) sb.append(" ");
+ sb.append(Integer.toHexString(this.column[i]).length() > 1 ? Integer.toHexString(this.column[i]).substring(Integer.toHexString(this.column[i]).length() - 2).toUpperCase() : "0" + Integer.toHexString(this.column[i]).toUpperCase());
+ }
+ if (this.column.length > 128) sb.append(" ...");
}
first = false;
sb.append(")");
Modified: incubator/cassandra/trunk/interface/gen-java/org/apache/cassandra/service/ColumnPathOrParent.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/interface/gen-java/org/apache/cassandra/service/ColumnPathOrParent.java?rev=796108&r1=796107&r2=796108&view=diff
==============================================================================
--- incubator/cassandra/trunk/interface/gen-java/org/apache/cassandra/service/ColumnPathOrParent.java (original)
+++ incubator/cassandra/trunk/interface/gen-java/org/apache/cassandra/service/ColumnPathOrParent.java Tue Jul 21 01:36:52 2009
@@ -26,9 +26,9 @@
public String column_family;
public static final int COLUMN_FAMILY = 3;
- public String super_column;
+ public byte[] super_column;
public static final int SUPER_COLUMN = 4;
- public String column;
+ public byte[] column;
public static final int COLUMN = 5;
private final Isset __isset = new Isset();
@@ -53,8 +53,8 @@
public ColumnPathOrParent(
String column_family,
- String super_column,
- String column)
+ byte[] super_column,
+ byte[] column)
{
this();
this.column_family = column_family;
@@ -70,10 +70,12 @@
this.column_family = other.column_family;
}
if (other.isSetSuper_column()) {
- this.super_column = other.super_column;
+ this.super_column = new byte[other.super_column.length];
+ System.arraycopy(other.super_column, 0, super_column, 0, other.super_column.length);
}
if (other.isSetColumn()) {
- this.column = other.column;
+ this.column = new byte[other.column.length];
+ System.arraycopy(other.column, 0, column, 0, other.column.length);
}
}
@@ -105,11 +107,11 @@
}
}
- public String getSuper_column() {
+ public byte[] getSuper_column() {
return this.super_column;
}
- public void setSuper_column(String super_column) {
+ public void setSuper_column(byte[] super_column) {
this.super_column = super_column;
}
@@ -128,11 +130,11 @@
}
}
- public String getColumn() {
+ public byte[] getColumn() {
return this.column;
}
- public void setColumn(String column) {
+ public void setColumn(byte[] column) {
this.column = column;
}
@@ -165,7 +167,7 @@
if (value == null) {
unsetSuper_column();
} else {
- setSuper_column((String)value);
+ setSuper_column((byte[])value);
}
break;
@@ -173,7 +175,7 @@
if (value == null) {
unsetColumn();
} else {
- setColumn((String)value);
+ setColumn((byte[])value);
}
break;
@@ -239,7 +241,7 @@
if (this_present_super_column || that_present_super_column) {
if (!(this_present_super_column && that_present_super_column))
return false;
- if (!this.super_column.equals(that.super_column))
+ if (!java.util.Arrays.equals(this.super_column, that.super_column))
return false;
}
@@ -248,7 +250,7 @@
if (this_present_column || that_present_column) {
if (!(this_present_column && that_present_column))
return false;
- if (!this.column.equals(that.column))
+ if (!java.util.Arrays.equals(this.column, that.column))
return false;
}
@@ -280,14 +282,14 @@
break;
case SUPER_COLUMN:
if (field.type == TType.STRING) {
- this.super_column = iprot.readString();
+ this.super_column = iprot.readBinary();
} else {
TProtocolUtil.skip(iprot, field.type);
}
break;
case COLUMN:
if (field.type == TType.STRING) {
- this.column = iprot.readString();
+ this.column = iprot.readBinary();
} else {
TProtocolUtil.skip(iprot, field.type);
}
@@ -316,12 +318,12 @@
}
if (this.super_column != null) {
oprot.writeFieldBegin(SUPER_COLUMN_FIELD_DESC);
- oprot.writeString(this.super_column);
+ oprot.writeBinary(this.super_column);
oprot.writeFieldEnd();
}
if (this.column != null) {
oprot.writeFieldBegin(COLUMN_FIELD_DESC);
- oprot.writeString(this.column);
+ oprot.writeBinary(this.column);
oprot.writeFieldEnd();
}
oprot.writeFieldStop();
@@ -346,7 +348,12 @@
if (this.super_column == null) {
sb.append("null");
} else {
- sb.append(this.super_column);
+ int __super_column_size = Math.min(this.super_column.length, 128);
+ for (int i = 0; i < __super_column_size; i++) {
+ if (i != 0) sb.append(" ");
+ sb.append(Integer.toHexString(this.super_column[i]).length() > 1 ? Integer.toHexString(this.super_column[i]).substring(Integer.toHexString(this.super_column[i]).length() - 2).toUpperCase() : "0" + Integer.toHexString(this.super_column[i]).toUpperCase());
+ }
+ if (this.super_column.length > 128) sb.append(" ...");
}
first = false;
}
@@ -356,7 +363,12 @@
if (this.column == null) {
sb.append("null");
} else {
- sb.append(this.column);
+ int __column_size = Math.min(this.column.length, 128);
+ for (int i = 0; i < __column_size; i++) {
+ if (i != 0) sb.append(" ");
+ sb.append(Integer.toHexString(this.column[i]).length() > 1 ? Integer.toHexString(this.column[i]).substring(Integer.toHexString(this.column[i]).length() - 2).toUpperCase() : "0" + Integer.toHexString(this.column[i]).toUpperCase());
+ }
+ if (this.column.length > 128) sb.append(" ...");
}
first = false;
}
Modified: incubator/cassandra/trunk/interface/gen-java/org/apache/cassandra/service/SuperColumn.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/interface/gen-java/org/apache/cassandra/service/SuperColumn.java?rev=796108&r1=796107&r2=796108&view=diff
==============================================================================
--- incubator/cassandra/trunk/interface/gen-java/org/apache/cassandra/service/SuperColumn.java (original)
+++ incubator/cassandra/trunk/interface/gen-java/org/apache/cassandra/service/SuperColumn.java Tue Jul 21 01:36:52 2009
@@ -23,7 +23,7 @@
private static final TField NAME_FIELD_DESC = new TField("name", TType.STRING, (short)1);
private static final TField COLUMNS_FIELD_DESC = new TField("columns", TType.LIST, (short)2);
- public String name;
+ public byte[] name;
public static final int NAME = 1;
public List<Column> columns;
public static final int COLUMNS = 2;
@@ -48,7 +48,7 @@
}
public SuperColumn(
- String name,
+ byte[] name,
List<Column> columns)
{
this();
@@ -61,7 +61,8 @@
*/
public SuperColumn(SuperColumn other) {
if (other.isSetName()) {
- this.name = other.name;
+ this.name = new byte[other.name.length];
+ System.arraycopy(other.name, 0, name, 0, other.name.length);
}
if (other.isSetColumns()) {
List<Column> __this__columns = new ArrayList<Column>();
@@ -77,11 +78,11 @@
return new SuperColumn(this);
}
- public String getName() {
+ public byte[] getName() {
return this.name;
}
- public void setName(String name) {
+ public void setName(byte[] name) {
this.name = name;
}
@@ -144,7 +145,7 @@
if (value == null) {
unsetName();
} else {
- setName((String)value);
+ setName((byte[])value);
}
break;
@@ -204,7 +205,7 @@
if (this_present_name || that_present_name) {
if (!(this_present_name && that_present_name))
return false;
- if (!this.name.equals(that.name))
+ if (!java.util.Arrays.equals(this.name, that.name))
return false;
}
@@ -238,7 +239,7 @@
{
case NAME:
if (field.type == TType.STRING) {
- this.name = iprot.readString();
+ this.name = iprot.readBinary();
} else {
TProtocolUtil.skip(iprot, field.type);
}
@@ -280,7 +281,7 @@
oprot.writeStructBegin(STRUCT_DESC);
if (this.name != null) {
oprot.writeFieldBegin(NAME_FIELD_DESC);
- oprot.writeString(this.name);
+ oprot.writeBinary(this.name);
oprot.writeFieldEnd();
}
if (this.columns != null) {
@@ -307,7 +308,12 @@
if (this.name == null) {
sb.append("null");
} else {
- sb.append(this.name);
+ int __name_size = Math.min(this.name.length, 128);
+ for (int i = 0; i < __name_size; i++) {
+ if (i != 0) sb.append(" ");
+ sb.append(Integer.toHexString(this.name[i]).length() > 1 ? Integer.toHexString(this.name[i]).substring(Integer.toHexString(this.name[i]).length() - 2).toUpperCase() : "0" + Integer.toHexString(this.name[i]).toUpperCase());
+ }
+ if (this.name.length > 128) sb.append(" ...");
}
first = false;
if (!first) sb.append(", ");
Modified: incubator/cassandra/trunk/interface/gen-java/org/apache/cassandra/service/SuperColumnPath.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/interface/gen-java/org/apache/cassandra/service/SuperColumnPath.java?rev=796108&r1=796107&r2=796108&view=diff
==============================================================================
--- incubator/cassandra/trunk/interface/gen-java/org/apache/cassandra/service/SuperColumnPath.java (original)
+++ incubator/cassandra/trunk/interface/gen-java/org/apache/cassandra/service/SuperColumnPath.java Tue Jul 21 01:36:52 2009
@@ -25,7 +25,7 @@
public String column_family;
public static final int COLUMN_FAMILY = 3;
- public String super_column;
+ public byte[] super_column;
public static final int SUPER_COLUMN = 4;
private final Isset __isset = new Isset();
@@ -48,7 +48,7 @@
public SuperColumnPath(
String column_family,
- String super_column)
+ byte[] super_column)
{
this();
this.column_family = column_family;
@@ -63,7 +63,8 @@
this.column_family = other.column_family;
}
if (other.isSetSuper_column()) {
- this.super_column = other.super_column;
+ this.super_column = new byte[other.super_column.length];
+ System.arraycopy(other.super_column, 0, super_column, 0, other.super_column.length);
}
}
@@ -95,11 +96,11 @@
}
}
- public String getSuper_column() {
+ public byte[] getSuper_column() {
return this.super_column;
}
- public void setSuper_column(String super_column) {
+ public void setSuper_column(byte[] super_column) {
this.super_column = super_column;
}
@@ -132,7 +133,7 @@
if (value == null) {
unsetSuper_column();
} else {
- setSuper_column((String)value);
+ setSuper_column((byte[])value);
}
break;
@@ -193,7 +194,7 @@
if (this_present_super_column || that_present_super_column) {
if (!(this_present_super_column && that_present_super_column))
return false;
- if (!this.super_column.equals(that.super_column))
+ if (!java.util.Arrays.equals(this.super_column, that.super_column))
return false;
}
@@ -225,7 +226,7 @@
break;
case SUPER_COLUMN:
if (field.type == TType.STRING) {
- this.super_column = iprot.readString();
+ this.super_column = iprot.readBinary();
} else {
TProtocolUtil.skip(iprot, field.type);
}
@@ -254,7 +255,7 @@
}
if (this.super_column != null) {
oprot.writeFieldBegin(SUPER_COLUMN_FIELD_DESC);
- oprot.writeString(this.super_column);
+ oprot.writeBinary(this.super_column);
oprot.writeFieldEnd();
}
oprot.writeFieldStop();
@@ -278,7 +279,12 @@
if (this.super_column == null) {
sb.append("null");
} else {
- sb.append(this.super_column);
+ int __super_column_size = Math.min(this.super_column.length, 128);
+ for (int i = 0; i < __super_column_size; i++) {
+ if (i != 0) sb.append(" ");
+ sb.append(Integer.toHexString(this.super_column[i]).length() > 1 ? Integer.toHexString(this.super_column[i]).substring(Integer.toHexString(this.super_column[i]).length() - 2).toUpperCase() : "0" + Integer.toHexString(this.super_column[i]).toUpperCase());
+ }
+ if (this.super_column.length > 128) sb.append(" ...");
}
first = false;
sb.append(")");
Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/cli/CliClient.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/cli/CliClient.java?rev=796108&r1=796107&r2=796108&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/cli/CliClient.java (original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/cli/CliClient.java Tue Jul 21 01:36:52 2009
@@ -25,6 +25,9 @@
import org.apache.cassandra.utils.LogUtil;
import java.util.*;
+import java.io.UnsupportedEncodingException;
+
+import org.apache.commons.lang.ArrayUtils;
// Cli Client Side Library
public class CliClient
@@ -135,7 +138,7 @@
{
// table.cf['key']
List<Column> columns = new ArrayList<Column>();
- columns = thriftClient_.get_slice(tableName, key, new ColumnParent(columnFamily, null), "", "", true, 1000000);
+ columns = thriftClient_.get_slice(tableName, key, new ColumnParent(columnFamily, null), ArrayUtils.EMPTY_BYTE_ARRAY, ArrayUtils.EMPTY_BYTE_ARRAY, true, 1000000);
int size = columns.size();
for (Iterator<Column> colIter = columns.iterator(); colIter.hasNext(); )
{
@@ -151,7 +154,14 @@
// table.cf['key']['column']
String columnName = CliCompiler.getColumn(columnFamilySpec, 0);
Column column = new Column();
- column = thriftClient_.get_column(tableName, key, new ColumnPath(columnFamily, null, columnName));
+ try
+ {
+ column = thriftClient_.get_column(tableName, key, new ColumnPath(columnFamily, null, columnName.getBytes("UTF-8")));
+ }
+ catch (UnsupportedEncodingException e)
+ {
+ throw new RuntimeException(e);
+ }
css_.out.printf("==> (name=%s, value=%s; timestamp=%d)\n",
column.name, column.value, column.timestamp);
}
@@ -184,8 +194,15 @@
String columnName = CliCompiler.getColumn(columnFamilySpec, 0);
// do the insert
- thriftClient_.insert(tableName, key, new ColumnPath(columnFamily, null, columnName),
- value.getBytes(), System.currentTimeMillis(), 1);
+ try
+ {
+ thriftClient_.insert(tableName, key, new ColumnPath(columnFamily, null, columnName.getBytes("UTF-8")),
+ value.getBytes(), System.currentTimeMillis(), 1);
+ }
+ catch (UnsupportedEncodingException e)
+ {
+ throw new RuntimeException(e);
+ }
css_.out.println("Value inserted.");
}
Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/config/CFMetaData.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/config/CFMetaData.java?rev=796108&r1=796107&r2=796108&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/config/CFMetaData.java (original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/config/CFMetaData.java Tue Jul 21 01:36:52 2009
@@ -18,12 +18,14 @@
package org.apache.cassandra.config;
+import org.apache.cassandra.db.marshal.AbstractType;
+
public class CFMetaData
{
public String tableName; // name of table which has this column family
public String cfName; // name of the column family
public String columnType; // type: super, standard, etc.
- public String indexProperty_; // name sorted, time stamp sorted etc.
+ public AbstractType comparator; // name sorted, time stamp sorted etc.
// The user chosen names (n_) for various parts of data in a column family.
// CQL queries, for instance, will refer to/extract data within a column
@@ -36,7 +38,7 @@
public String n_columnValue;
public String n_columnTimestamp;
public int flushPeriodInMinutes = 0; // flush interval, if <=0, no periodic flusher is scheduled
-
+
// a quick and dirty pretty printer for describing the column family...
public String pretty()
{
@@ -49,7 +51,7 @@
desc = tableName + "." + cfName + "(" + n_rowKey + ", " + desc + ")\n";
desc += "Column Family Type: " + columnType + "\n" +
- "Columns Sorted By: " + indexProperty_ + "\n";
+ "Columns Sorted By: " + comparator + "\n";
desc += "flush period: " + flushPeriodInMinutes + " minutes\n";
return desc;
}
Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/config/DatabaseDescriptor.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/config/DatabaseDescriptor.java?rev=796108&r1=796107&r2=796108&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/config/DatabaseDescriptor.java (original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/config/DatabaseDescriptor.java Tue Jul 21 01:36:52 2009
@@ -24,6 +24,9 @@
import org.apache.log4j.Logger;
import org.apache.cassandra.db.*;
+import org.apache.cassandra.db.marshal.AbstractType;
+import org.apache.cassandra.db.marshal.AsciiType;
+import org.apache.cassandra.db.marshal.UTF8Type;
import org.apache.cassandra.utils.FileUtils;
import org.apache.cassandra.utils.XMLUtils;
import org.w3c.dom.Node;
@@ -332,21 +335,31 @@
throw new ConfigurationException("Column " + cName + " has invalid type " + rawColumnType);
}
- // Parse out the column family sorting property for columns
- String rawColumnIndexType = XMLUtils.getAttributeValue(columnFamily, "ColumnSort");
- String columnIndexType = ColumnFamily.getColumnSortProperty(rawColumnIndexType);
- if (columnIndexType == null)
+ if (XMLUtils.getAttributeValue(columnFamily, "ColumnSort") != null)
{
- throw new ConfigurationException("invalid column sort value " + rawColumnIndexType);
+ throw new ConfigurationException("ColumnSort is no longer an accepted attribute. Use CompareWith instead.");
}
- if ("Super".equals(columnType))
+
+ // Parse out the column comparator
+ Class<? extends AbstractType> typeClass;
+ String compareWith = XMLUtils.getAttributeValue(columnFamily, "CompareWith");
+ if (compareWith == null)
{
- if (rawColumnIndexType != null)
+ typeClass = org.apache.cassandra.db.marshal.AsciiType.class;
+ }
+ else
+ {
+ String className = compareWith.contains(".") ? compareWith : "org.apache.cassandra.db.marshal." + compareWith;
+ try
{
- throw new ConfigurationException("Super columnfamilies are always name-sorted, and their subcolumns are always time-sorted. You may not specify the ColumnSort attribute on a SuperColumn.");
+ typeClass = (Class<? extends AbstractType>)Class.forName(className);
+ }
+ catch (ClassNotFoundException e)
+ {
+ throw new ConfigurationException("Unable to load class " + className + " for CompareWith attribute");
}
- columnIndexType = "Name";
}
+ AbstractType columnComparator = typeClass.getConstructor().newInstance();
// see if flush period is set
String flushPeriodInMinutes = XMLUtils.getAttributeValue(columnFamily, "FlushPeriodInMinutes");
@@ -389,7 +402,7 @@
cfMetaData.cfName = cName;
cfMetaData.columnType = columnType;
- cfMetaData.indexProperty_ = columnIndexType;
+ cfMetaData.comparator = columnComparator;
cfMetaData.n_rowKey = n_rowKey;
cfMetaData.n_columnMap = n_columnMap;
@@ -407,6 +420,19 @@
}
}
+ // Hardcoded system tables
+ Map<String, CFMetaData> systemMetadata = new HashMap<String, CFMetaData>();
+
+ CFMetaData data = new CFMetaData();
+ data.comparator = new AsciiType();
+ systemMetadata.put(SystemTable.LOCATION_CF, data);
+
+ data = new CFMetaData();
+ data.columnType = "Super";
+ data.comparator = new UTF8Type();
+ systemMetadata.put(HintedHandOffManager.HINTS_CF, data);
+
+ tableToCFMetaDataMap_.put("system", systemMetadata);
/* make sure we have a directory for each table */
createTableDirectories();
@@ -450,6 +476,7 @@
* the table name and the column families that make up the table.
* Each column family also has an associated ID which is an int.
*/
+ // TODO duplicating data b/t tablemetadata and CFMetaData is confusing and error-prone
public static void storeMetadata() throws IOException
{
int cfId = 0;
@@ -470,11 +497,6 @@
}
}
}
-
- // Hardcoded system table
- Table.TableMetadata tmetadata = Table.TableMetadata.instance(Table.SYSTEM_TABLE);
- tmetadata.add(SystemTable.LOCATION_CF, cfId++);
- tmetadata.add(HintedHandOffManager.HINTS_CF, cfId++, ColumnFamily.getColumnType("Super"));
}
public static int getGcGraceInSeconds()
@@ -587,17 +609,6 @@
return cfMetaData.flushPeriodInMinutes;
}
- public static boolean isTimeSortingEnabled(String tableName, String cfName)
- {
- assert tableName != null;
- CFMetaData cfMetaData = getCFMetaData(tableName, cfName);
-
- if (cfMetaData == null)
- return false;
-
- return "Time".equals(cfMetaData.indexProperty_);
- }
-
public static List<String> getTables()
{
return tables_;
@@ -759,10 +770,10 @@
return dataFileDirectory;
}
- public static ColumnComparatorFactory.ComparatorType getTypeInfo(String tableName, String cfName)
+ public static AbstractType getType(String tableName, String cfName)
{
assert tableName != null;
- return ColumnComparatorFactory.ComparatorType.NAME;
+ return getCFMetaData(tableName, cfName).comparator;
}
public static Map<String, Map<String, CFMetaData>> getTableToColumnFamilyMap()
Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/cql/common/ColumnRangeQueryRSD.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/cql/common/ColumnRangeQueryRSD.java?rev=796108&r1=796107&r2=796108&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/cql/common/ColumnRangeQueryRSD.java (original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/cql/common/ColumnRangeQueryRSD.java Tue Jul 21 01:36:52 2009
@@ -23,6 +23,7 @@
import java.util.LinkedList;
import java.util.Map;
import java.util.List;
+import java.io.UnsupportedEncodingException;
import org.apache.cassandra.config.CFMetaData;
import org.apache.cassandra.cql.execution.RuntimeErrorMsg;
@@ -32,6 +33,7 @@
import org.apache.cassandra.service.StorageService;
import org.apache.cassandra.utils.LogUtil;
import org.apache.log4j.Logger;
+import org.apache.commons.lang.ArrayUtils;
/**
* A Row Source Defintion (RSD) for doing a range query on a column map
@@ -75,7 +77,7 @@
limit_ = limit;
}
- public List<Map<String,String>> getRows()
+ public List<Map<String,String>> getRows() throws UnsupportedEncodingException
{
QueryPath path;
String superColumnKey = null;
@@ -83,7 +85,7 @@
if (superColumnKey_ != null)
{
superColumnKey = (String)(superColumnKey_.get());
- path = new QueryPath(cfMetaData_.cfName, superColumnKey);
+ path = new QueryPath(cfMetaData_.cfName, superColumnKey.getBytes("UTF-8"));
}
else
{
@@ -94,7 +96,7 @@
try
{
String key = (String)(rowKey_.get());
- ReadCommand readCommand = new SliceFromReadCommand(cfMetaData_.tableName, key, path, "", "", true, limit_);
+ ReadCommand readCommand = new SliceFromReadCommand(cfMetaData_.tableName, key, path, ArrayUtils.EMPTY_BYTE_ARRAY, ArrayUtils.EMPTY_BYTE_ARRAY, true, limit_);
row = StorageProxy.readProtocol(readCommand, StorageService.ConsistencyLevel.WEAK);
}
catch (Exception e)
@@ -113,13 +115,13 @@
if (superColumnKey_ != null)
{
// this is the super column case
- IColumn column = cfamily.getColumn(superColumnKey);
+ IColumn column = cfamily.getColumn(superColumnKey.getBytes("UTF-8"));
if (column != null)
columns = column.getSubColumns();
}
else
{
- columns = cfamily.getAllColumns();
+ columns = cfamily.getSortedColumns();
}
if (columns != null && columns.size() > 0)
@@ -128,7 +130,7 @@
{
Map<String, String> result = new HashMap<String, String>();
- result.put(cfMetaData_.n_columnKey, column.name());
+ result.put(cfMetaData_.n_columnKey, new String(column.name(), "UTF-8"));
result.put(cfMetaData_.n_columnValue, new String(column.value()));
result.put(cfMetaData_.n_columnTimestamp, Long.toString(column.timestamp()));
@@ -155,6 +157,6 @@
rowKey_.explain(),
(superColumnKey_ == null) ? "" : " SuperColumnKey: " + superColumnKey_.explain() + "\n",
limit_,
- cfMetaData_.indexProperty_);
+ cfMetaData_.comparator);
}
}
\ No newline at end of file
Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/cql/common/Plan.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/cql/common/Plan.java?rev=796108&r1=796107&r2=796108&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/cql/common/Plan.java (original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/cql/common/Plan.java Tue Jul 21 01:36:52 2009
@@ -18,6 +18,8 @@
package org.apache.cassandra.cql.common;
+import java.io.UnsupportedEncodingException;
+
/**
* Abstract class representing the shared execution plan for a CQL
* statement (query or DML operation).
@@ -25,6 +27,6 @@
*/
public abstract class Plan
{
- public abstract CqlResult execute();
+ public abstract CqlResult execute() throws UnsupportedEncodingException;
public abstract String explainPlan();
}
Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/cql/common/QueryPlan.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/cql/common/QueryPlan.java?rev=796108&r1=796107&r2=796108&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/cql/common/QueryPlan.java (original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/cql/common/QueryPlan.java Tue Jul 21 01:36:52 2009
@@ -18,6 +18,8 @@
package org.apache.cassandra.cql.common;
+import java.io.UnsupportedEncodingException;
+
import org.apache.log4j.Logger;
/**
@@ -38,7 +40,14 @@
{
if (root != null)
{
- return new CqlResult(root.getRows());
+ try
+ {
+ return new CqlResult(root.getRows());
+ }
+ catch (UnsupportedEncodingException e)
+ {
+ throw new RuntimeException(e);
+ }
}
else
logger_.error("No rowsource to execute");
Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/cql/common/RowSourceDef.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/cql/common/RowSourceDef.java?rev=796108&r1=796107&r2=796108&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/cql/common/RowSourceDef.java (original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/cql/common/RowSourceDef.java Tue Jul 21 01:36:52 2009
@@ -20,6 +20,7 @@
import java.util.List;
import java.util.Map;
+import java.io.UnsupportedEncodingException;
/**
* The abstract notion of a row source definition. A row source
@@ -43,6 +44,6 @@
*/
public abstract class RowSourceDef
{
- public abstract List<Map<String,String>> getRows();
+ public abstract List<Map<String,String>> getRows() throws UnsupportedEncodingException;
public abstract String explainPlan();
}
\ No newline at end of file
Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/cql/common/SetColumnMap.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/cql/common/SetColumnMap.java?rev=796108&r1=796107&r2=796108&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/cql/common/SetColumnMap.java (original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/cql/common/SetColumnMap.java Tue Jul 21 01:36:52 2009
@@ -84,11 +84,11 @@
if (superColumnKey_ != null)
{
String superColumnKey = (String)(superColumnKey_.get());
- path = new QueryPath(cfMetaData_.cfName, superColumnKey, (String)columnKey.get());
+ path = new QueryPath(cfMetaData_.cfName, superColumnKey.getBytes("UTF-8"), ((String)columnKey.get()).getBytes("UTF-8"));
}
else
{
- path = new QueryPath(cfMetaData_.cfName, null, (String)columnKey.get());
+ path = new QueryPath(cfMetaData_.cfName, null, ((String)columnKey.get()).getBytes("UTF-8"));
}
rm.add(path, ((String)value.get()).getBytes(), time);
Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/cql/common/SetSuperColumnMap.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/cql/common/SetSuperColumnMap.java?rev=796108&r1=796107&r2=796108&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/cql/common/SetSuperColumnMap.java (original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/cql/common/SetSuperColumnMap.java Tue Jul 21 01:36:52 2009
@@ -67,7 +67,7 @@
{
OperandDef columnKey = entry.getFirst();
OperandDef value = entry.getSecond();
- QueryPath path = new QueryPath(cfMetaData_.cfName, (String)(superColumnKey.get()), (String)(columnKey.get()));
+ QueryPath path = new QueryPath(cfMetaData_.cfName, ((String)(superColumnKey.get())).getBytes("UTF-8"), ((String)(columnKey.get())).getBytes("UTF-8"));
rm.add(path, ((String)value.get()).getBytes(), time);
}
}
Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/cql/common/SetUniqueKey.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/cql/common/SetUniqueKey.java?rev=796108&r1=796107&r2=796108&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/cql/common/SetUniqueKey.java (original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/cql/common/SetUniqueKey.java Tue Jul 21 01:36:52 2009
@@ -18,6 +18,8 @@
package org.apache.cassandra.cql.common;
+import java.io.UnsupportedEncodingException;
+
import org.apache.cassandra.config.CFMetaData;
import org.apache.cassandra.cql.execution.RuntimeErrorMsg;
import org.apache.cassandra.db.RowMutation;
@@ -69,7 +71,7 @@
value_ = value;
}
- public CqlResult execute()
+ public CqlResult execute() throws UnsupportedEncodingException
{
String columnKey = (String)(columnKey_.get());
QueryPath path;
@@ -77,11 +79,11 @@
if (superColumnKey_ != null)
{
String superColumnKey = (String)(superColumnKey_.get());
- path = new QueryPath(cfMetaData_.cfName, superColumnKey, columnKey);
+ path = new QueryPath(cfMetaData_.cfName, superColumnKey.getBytes("UTF-8"), columnKey.getBytes("UTF-8"));
}
else
{
- path = new QueryPath(cfMetaData_.cfName, null, columnKey);
+ path = new QueryPath(cfMetaData_.cfName, null, columnKey.getBytes("UTF-8"));
}
try
Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/cql/common/SuperColumnRangeQueryRSD.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/cql/common/SuperColumnRangeQueryRSD.java?rev=796108&r1=796107&r2=796108&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/cql/common/SuperColumnRangeQueryRSD.java (original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/cql/common/SuperColumnRangeQueryRSD.java Tue Jul 21 01:36:52 2009
@@ -23,6 +23,7 @@
import java.util.LinkedList;
import java.util.Map;
import java.util.List;
+import java.io.UnsupportedEncodingException;
import org.apache.cassandra.config.CFMetaData;
import org.apache.cassandra.cql.execution.RuntimeErrorMsg;
@@ -32,6 +33,7 @@
import org.apache.cassandra.service.StorageService;
import org.apache.cassandra.utils.LogUtil;
import org.apache.log4j.Logger;
+import org.apache.commons.lang.ArrayUtils;
/**
* A Row Source Definition (RSD) for doing a super column range query on a Super Column Family.
@@ -58,13 +60,13 @@
limit_ = limit;
}
- public List<Map<String,String>> getRows()
+ public List<Map<String,String>> getRows() throws UnsupportedEncodingException
{
Row row = null;
try
{
String key = (String)(rowKey_.get());
- ReadCommand readCommand = new SliceFromReadCommand(cfMetaData_.tableName, key, new QueryPath(cfMetaData_.cfName), "", "", true, limit_);
+ ReadCommand readCommand = new SliceFromReadCommand(cfMetaData_.tableName, key, new QueryPath(cfMetaData_.cfName), ArrayUtils.EMPTY_BYTE_ARRAY, ArrayUtils.EMPTY_BYTE_ARRAY, true, limit_);
row = StorageProxy.readProtocol(readCommand, StorageService.ConsistencyLevel.WEAK);
}
catch (Exception e)
@@ -79,7 +81,7 @@
ColumnFamily cfamily = row.getColumnFamily(cfMetaData_.cfName);
if (cfamily != null)
{
- Collection<IColumn> columns = cfamily.getAllColumns();
+ Collection<IColumn> columns = cfamily.getSortedColumns();
if (columns != null && columns.size() > 0)
{
for (IColumn column : columns)
@@ -88,8 +90,8 @@
for( IColumn subColumn : subColumns )
{
Map<String, String> result = new HashMap<String, String>();
- result.put(cfMetaData_.n_superColumnKey, column.name());
- result.put(cfMetaData_.n_columnKey, subColumn.name());
+ result.put(cfMetaData_.n_superColumnKey, new String(column.name(), "UTF-8"));
+ result.put(cfMetaData_.n_columnKey, new String(subColumn.name(), "UTF-8"));
result.put(cfMetaData_.n_columnValue, new String(subColumn.value()));
result.put(cfMetaData_.n_columnTimestamp, Long.toString(subColumn.timestamp()));
rows.add(result);
@@ -114,6 +116,6 @@
cfMetaData_.cfName,
rowKey_.explain(),
limit_,
- cfMetaData_.indexProperty_);
+ cfMetaData_.comparator);
}
}
\ No newline at end of file