cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From slebre...@apache.org
Subject git commit: Return correct comparator for names in ResultSet
Date Thu, 26 Jan 2012 09:58:28 GMT
Updated Branches:
  refs/heads/trunk 26083f71f -> 48fbdb34a


Return correct comparator for names in ResultSet


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/48fbdb34
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/48fbdb34
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/48fbdb34

Branch: refs/heads/trunk
Commit: 48fbdb34a9c5c548e68726f56d3c32b6ac2028e7
Parents: 26083f7
Author: Sylvain Lebresne <sylvain@datastax.com>
Authored: Thu Jan 26 09:58:36 2012 +0100
Committer: Sylvain Lebresne <sylvain@datastax.com>
Committed: Thu Jan 26 10:58:03 2012 +0100

----------------------------------------------------------------------
 .../org/apache/cassandra/cql3/CFDefinition.java    |   11 +++++++++++
 .../cassandra/cql3/statements/SelectStatement.java |    2 +-
 2 files changed, 12 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/48fbdb34/src/java/org/apache/cassandra/cql3/CFDefinition.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cql3/CFDefinition.java b/src/java/org/apache/cassandra/cql3/CFDefinition.java
index b3725db..def2d2d 100644
--- a/src/java/org/apache/cassandra/cql3/CFDefinition.java
+++ b/src/java/org/apache/cassandra/cql3/CFDefinition.java
@@ -195,6 +195,17 @@ public class CFDefinition implements Iterable<CFDefinition.Name>
              : new NonCompositeBuilder(cfm.comparator);
     }
 
+    public AbstractType<?> getNameComparatorForResultSet(Name name)
+    {
+        // In the resultSet, a name should always be UTF8. However, for
+        // backward compatibility sake, this method allows to support non UTF8
+        // names for static CF column names.
+        if (!isCompact && !isComposite)
+            return cfm.comparator;
+        else
+            return definitionType;
+    }
+
     public static class Name
     {
         public static enum Kind

http://git-wip-us.apache.org/repos/asf/cassandra/blob/48fbdb34/src/java/org/apache/cassandra/cql3/statements/SelectStatement.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cql3/statements/SelectStatement.java b/src/java/org/apache/cassandra/cql3/statements/SelectStatement.java
index 7fd9234..a468350 100644
--- a/src/java/org/apache/cassandra/cql3/statements/SelectStatement.java
+++ b/src/java/org/apache/cassandra/cql3/statements/SelectStatement.java
@@ -522,7 +522,7 @@ public class SelectStatement extends CQLStatement
     private void addToSchema(CqlMetadata schema, Pair<CFDefinition.Name, ColumnIdentifier>
p)
     {
         ByteBuffer nameAsRequested = p.right.key;
-        schema.name_types.put(nameAsRequested, TypeParser.getShortName(cfDef.cfm.comparator));
+        schema.name_types.put(nameAsRequested, TypeParser.getShortName(cfDef.getNameComparatorForResultSet(p.left)));
         schema.value_types.put(nameAsRequested, TypeParser.getShortName(p.left.type));
     }
 


Mime
View raw message