You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by ca...@codespot.com on 2012/01/02 16:57:40 UTC

[cassandra-dbapi2] push by john.eri...@gmail.com - test that selecting key always returns a result on 2012-01-02 15:56 GMT

Revision: cb115b6561d8
Author:   Eric Evans <ee...@sym-link.com>
Date:     Mon Jan  2 07:54:08 2012
Log:      test that selecting key always returns a result

http://code.google.com/a/apache-extras.org/p/cassandra-dbapi2/source/detail?r=cb115b6561d8

Modified:
  /test/test_cql.py

=======================================
--- /test/test_cql.py	Thu Dec 15 12:50:09 2011
+++ /test/test_cql.py	Mon Jan  2 07:54:08 2012
@@ -1428,3 +1428,24 @@
          cursor.execute("USE " + self.keyspace)
          cursor.execute("DROP KEYSPACE KeyAliasKeyspace")

+    def test_key_in_projection_semantics(self):
+        "selecting on key always returns at least one result"
+        # See: https://issues.apache.org/jira/browse/CASSANDRA-3424
+        cursor = self.cursor
+
+        # Key exists, column does not
+        cursor.execute("SELECT ka, t0t4llyb0gus FROM StandardString1 WHERE  
KEY = ka")
+        assert cursor.rowcount == 1, "expected exactly 1 result, got %d" %  
cursor.rowcount
+
+        # Key does not exist
+        cursor.execute("SELECT t0t4llyb0gus FROM StandardString1 WHERE KEY  
= t0t4llyb0gus")
+        assert cursor.rowcount == 1, "expected exactly 1 result, got %d" %  
cursor.rowcount
+
+        # Key does not exist
+        cursor.execute("SELECT * FROM StandardString1 WHERE KEY =  
t0t4llyb0gus")
+        assert cursor.rowcount == 1, "expected exactly 1 result, got %d" %  
cursor.rowcount
+
+        # Without explicit key, No Means No (results)
+        cursor.execute("TRUNCATE StandardString1")
+        cursor.execute("SELECT * FROM StandardString1")
+        assert cursor.rowcount == 0, "expected zero results, got %d" %  
cursor.rowcount