cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cassandra-dbapi2.apache-extras....@codespot.com
Subject [cassandra-dbapi2] push by john.eri...@gmail.com - test that selecting key always returns a result on 2012-01-02 15:56 GMT
Date Mon, 02 Jan 2012 15:57:40 GMT
Revision: cb115b6561d8
Author:   Eric Evans <eevans@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

Mime
View raw message