2 new revisions:

Revision: 5ec85ae43461
Author:   Eric Evans <e...@acunu.com>
Date:     Tue Dec 13 12:57:26 2011
Log:      add dependency on thrift (temporary?)
http://code.google.com/a/apache-extras.org/p/cassandra-jdbc/source/detail?r=5ec85ae43461

Revision: c80adc5f4bd2
Author:   Eric Evans <e...@acunu.com>
Date:     Tue Dec 13 15:21:15 2011
Log:      IN (...) is broken and requires an aliased key...
http://code.google.com/a/apache-extras.org/p/cassandra-jdbc/source/detail?r=c80adc5f4bd2

==============================================================================
Revision: 5ec85ae43461
Author:   Eric Evans <e...@acunu.com>
Date:     Tue Dec 13 12:57:26 2011
Log:      add dependency on thrift (temporary?)

http://code.google.com/a/apache-extras.org/p/cassandra-jdbc/source/detail?r=5ec85ae43461

Modified:
 /pom.xml

=======================================
--- /pom.xml    Mon Nov  7 15:59:43 2011
+++ /pom.xml    Tue Dec 13 12:57:26 2011
@@ -132,6 +132,11 @@
       <version>1.6.1</version>
       <scope>test</scope>
     </dependency>
+    <dependency>
+      <groupId>org.apache.thrift</groupId>
+      <artifactId>libthrift</artifactId>
+      <version>0.6.1</version>
+    </dependency>
   </dependencies>

   <build>

==============================================================================
Revision: c80adc5f4bd2
Author:   Eric Evans <e...@acunu.com>
Date:     Tue Dec 13 15:21:15 2011
Log:      IN (...) is broken and requires an aliased key

See https://issues.apache.org/jira/browse/CASSANDRA-3627

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

Modified:
 /src/test/java/org/apache/cassandra/cql/JdbcDriverTest.java
 /src/test/java/org/apache/cassandra/cql/Schema.java
 /src/test/java/org/apache/cassandra/cql/jdbc/PreparedStatementTest.java

=======================================
--- /src/test/java/org/apache/cassandra/cql/JdbcDriverTest.java Thu Oct 13 01:56:33 2011 +++ /src/test/java/org/apache/cassandra/cql/JdbcDriverTest.java Tue Dec 13 15:21:15 2011
@@ -67,8 +67,9 @@
         String[] inserts =
         {
String.format("UPDATE Standard1 SET '%s' = '%s', '%s' = '%s' WHERE KEY = '%s'", first, firstrec, last, lastrec, jsmith), - "UPDATE JdbcInteger SET 1 = 11, 2 = 22, 42='fortytwo' WHERE KEY = '" + jsmith + "'", - "UPDATE JdbcInteger SET 3 = 33, 4 = 44 WHERE KEY = '" + jsmith + "'", + "UPDATE JdbcInteger0 SET 1 = 11, 2 = 22, 42='fortytwo' WHERE KEY = '" + jsmith + "'", + "UPDATE JdbcInteger0 SET 3 = 33, 4 = 44 WHERE KEY = '" + jsmith + "'", + "UPDATE JdbcInteger1 SET 1 = 'One', 2 = 'Two', 3 = 'Three' WHERE id = rowOne", "UPDATE JdbcLong SET 1 = 11, 2 = 22 WHERE KEY = '" + jsmith + "'", "UPDATE JdbcAscii SET 'first' = 'firstrec', last = 'lastrec' WHERE key = '" + jsmith + "'", String.format("UPDATE JdbcBytes SET '%s' = '%s', '%s' = '%s' WHERE key = '%s'", first, firstrec, last, lastrec, jsmith),
@@ -133,8 +134,8 @@
     {
         String key = bytesToHex("Integer".getBytes());
         Statement stmt = con.createStatement();
- stmt.executeUpdate("update JdbcInteger set 1=36893488147419103232, 42='fortytwofortytwo' where key='" + key + "'"); - ResultSet rs = stmt.executeQuery("select 1, 2, 42 from JdbcInteger where key='" + key + "'"); + stmt.executeUpdate("update JdbcInteger0 set 1=36893488147419103232, 42='fortytwofortytwo' where key='" + key + "'"); + ResultSet rs = stmt.executeQuery("select 1, 2, 42 from JdbcInteger0 where key='" + key + "'");
         assert rs.next();
assert rs.getObject("1").equals(new BigInteger("36893488147419103232")); assert rs.getString("42").equals("fortytwofortytwo") : rs.getString("42");
@@ -145,7 +146,7 @@
expectedMetaData(md, 2, BigInteger.class.getName(), "JdbcInteger", Schema.KEYSPACE_NAME, "2", Types.BIGINT, JdbcInteger.class.getSimpleName(), true, false); expectedMetaData(md, 3, String.class.getName(), "JdbcInteger", Schema.KEYSPACE_NAME, "42", Types.VARCHAR, JdbcUTF8.class.getSimpleName(), false, true);

- rs = stmt.executeQuery("select key, 1, 2, 42 from JdbcInteger where key='" + key + "'"); + rs = stmt.executeQuery("select key, 1, 2, 42 from JdbcInteger0 where key='" + key + "'");
         assert rs.next();
         assert Arrays.equals(rs.getBytes("key"), hexToBytes(key));
assert rs.getObject("1").equals(new BigInteger("36893488147419103232"));
@@ -281,13 +282,13 @@
     {
         Statement stmt = con.createStatement();
         List<String> keys = Arrays.asList(jsmith);
- String selectQ = "SELECT 1, 2 FROM JdbcInteger WHERE KEY='" + jsmith + "'"; + String selectQ = "SELECT 1, 2 FROM JdbcInteger0 WHERE KEY='" + jsmith + "'"; checkResultSet(stmt.executeQuery(selectQ), "Int", 1, keys, "1", "2");

- selectQ = "SELECT 3, 4 FROM JdbcInteger WHERE KEY='" + jsmith + "'"; + selectQ = "SELECT 3, 4 FROM JdbcInteger0 WHERE KEY='" + jsmith + "'"; checkResultSet(stmt.executeQuery(selectQ), "Int", 1, keys, "3", "4");

- selectQ = "SELECT 1, 2, 3, 4 FROM JdbcInteger WHERE KEY='" + jsmith + "'"; + selectQ = "SELECT 1, 2, 3, 4 FROM JdbcInteger0 WHERE KEY='" + jsmith + "'"; checkResultSet(stmt.executeQuery(selectQ), "Int", 1, keys, "1", "2", "3", "4");

         selectQ = "SELECT 1, 2 FROM JdbcLong WHERE KEY='" + jsmith + "'";
@@ -302,9 +303,8 @@
selectQ = "SELECT 'first', last FROM JdbcUtf8 WHERE KEY='" + jsmith + "'"; checkResultSet(stmt.executeQuery(selectQ), "String", 1, keys, "first", "last");

- String badKey = bytesToHex(String.format("jsmith-%s", System.currentTimeMillis()).getBytes()); - selectQ = "SELECT 1, 2 FROM JdbcInteger WHERE KEY IN ('" + badKey + "', '" + jsmith + "')"; - checkResultSet(stmt.executeQuery(selectQ), "Int", 1, keys, "1", "2"); + selectQ = "SELECT 1, 2 FROM JdbcInteger1 WHERE id IN (rowOne, badRow)"; + checkResultSet(stmt.executeQuery(selectQ), "String", 1, keys, "1", "2");
     }

     @Test
@@ -326,13 +326,13 @@
String selectQ = String.format("SELECT '%s', '%s' FROM Standard1 WHERE KEY='%s'", first, last, jsmith); checkResultSet(executePreparedStatementWithResults(con, selectQ), "Bytes", 1, keys, first, last);

- selectQ = "SELECT 1, 2 FROM JdbcInteger WHERE KEY='" + jsmith + "'"; + selectQ = "SELECT 1, 2 FROM JdbcInteger0 WHERE KEY='" + jsmith + "'"; checkResultSet(executePreparedStatementWithResults(con, selectQ), "Int", 1, keys, "1", "2");

- selectQ = "SELECT 3, 4 FROM JdbcInteger WHERE KEY='" + jsmith + "'"; + selectQ = "SELECT 3, 4 FROM JdbcInteger0 WHERE KEY='" + jsmith + "'"; checkResultSet(executePreparedStatementWithResults(con, selectQ), "Int", 1, keys, "3", "4");

- selectQ = "SELECT 1, 2, 3, 4 FROM JdbcInteger WHERE KEY='" + jsmith + "'"; + selectQ = "SELECT 1, 2, 3, 4 FROM JdbcInteger0 WHERE KEY='" + jsmith + "'"; checkResultSet(executePreparedStatementWithResults(con, selectQ), "Int", 1, keys, "1", "2", "3", "4");

         selectQ = "SELECT 1, 2 FROM JdbcLong WHERE KEY='" + jsmith + "'";
@@ -347,9 +347,8 @@
selectQ = "SELECT 'first', last FROM JdbcUtf8 WHERE KEY='" + jsmith + "'"; checkResultSet(executePreparedStatementWithResults(con, selectQ), "String", 1, keys, "first", "last");

- String badKey = bytesToHex(String.format("jsmith-%s", System.currentTimeMillis()).getBytes()); - selectQ = "SELECT 1, 2 FROM JdbcInteger WHERE KEY IN ('" + badKey + "', '" + jsmith + "')"; - checkResultSet(executePreparedStatementWithResults(con, selectQ), "Int", 1, keys, "1", "2"); + selectQ = "SELECT 1, 2 FROM JdbcInteger1 WHERE id IN (rowOne, badRow)"; + checkResultSet(executePreparedStatementWithResults(con, selectQ), "String", 1, keys, "1", "2");
     }

     /* Method to test with Delete statement. */
@@ -371,9 +370,9 @@
                               first,
                               jsmith),

-                "DELETE 1, 3 FROM JdbcInteger WHERE KEY='" + jsmith + "'",
-                "SELECT 1, 3 FROM JdbcInteger WHERE KEY='" + jsmith + "'",
-                "SELECT 2, 4 FROM JdbcInteger WHERE KEY='" + jsmith + "'",
+                "DELETE 1, 3 FROM JdbcInteger0 WHERE KEY='" + jsmith + "'",
+                "SELECT 1, 3 FROM JdbcInteger0 WHERE KEY='" + jsmith + "'",
+                "SELECT 2, 4 FROM JdbcInteger0 WHERE KEY='" + jsmith + "'",

                 "DELETE 1 FROM JdbcLong WHERE KEY='" + jsmith + "'",
                 "SELECT 1 FROM JdbcLong WHERE KEY='" + jsmith + "'",
@@ -415,7 +414,8 @@
             {
                 "TRUNCATE Standard1",
"TRUNCATE JdbcAscii", // todo: this one is broken for some reason.
-                "TRUNCATE JdbcInteger",
+                "TRUNCATE JdbcInteger0",
+                "TRUNCATE JdbcInteger1",
                 "TRUNCATE JdbcLong",
                 "TRUNCATE JdbcBytes",
                 "TRUNCATE JdbcUtf8",
=======================================
--- /src/test/java/org/apache/cassandra/cql/Schema.java Thu Oct 13 00:45:22 2011 +++ /src/test/java/org/apache/cassandra/cql/Schema.java Tue Dec 13 15:21:15 2011
@@ -33,8 +33,10 @@
private static final String createKeyspace = String.format("CREATE KEYSPACE %s WITH " + "strategy_class = SimpleStrategy AND strategy_options:replication_factor = 1", KEYSPACE_NAME);
     private static final String[] createColumnFamilies = {
- "CREATE COLUMNFAMILY JdbcInteger (KEY blob PRIMARY KEY, 42 text) WITH comparator = varint " + + "CREATE COLUMNFAMILY JdbcInteger0 (KEY blob PRIMARY KEY, 42 text) WITH comparator = varint " +
                 "AND default_validation = varint",
+ "CREATE COLUMNFAMILY JdbcInteger1 (id text PRIMARY KEY, 99 text) WITH comparator = varint " +
+                "AND default_validation = text",
"CREATE COLUMNFAMILY JdbcUtf8 (KEY blob PRIMARY KEY, fortytwo varint) WITH comparator = text", "CREATE COLUMNFAMILY JdbcLong (KEY blob PRIMARY KEY) WITH comparator = bigint AND default_validation = bigint", "CREATE COLUMNFAMILY JdbcBytes (KEY blob PRIMARY KEY) WITH comparator = blob AND default_validation = blob",
=======================================
--- /src/test/java/org/apache/cassandra/cql/jdbc/PreparedStatementTest.java Thu Oct 13 01:56:33 2011 +++ /src/test/java/org/apache/cassandra/cql/jdbc/PreparedStatementTest.java Tue Dec 13 15:21:15 2011
@@ -292,7 +292,7 @@
     @Test
     public void testInteger() throws SQLException
     {
- PreparedStatement stmt = con.prepareStatement("update JdbcInteger set ?=?, ?=? where key = ?"); + PreparedStatement stmt = con.prepareStatement("update JdbcInteger0 set ?=?, ?=? where key = ?");
         for (int i = 0; i < 5; i++)
         {
             byte[] key = Integer.toString(i).getBytes();
@@ -306,7 +306,7 @@
         stmt.close();

         // verify.
- stmt = con.prepareStatement("select ?, ? from JdbcInteger where key = ?"); + stmt = con.prepareStatement("select ?, ? from JdbcInteger0 where key = ?");
         for (int i = 0; i < 5; i++)
         {
             byte[] key = Integer.toString(i).getBytes();
@@ -324,7 +324,7 @@
         }

         // delete
- stmt = con.prepareStatement("delete ?, ? from JdbcInteger where key = ?"); + stmt = con.prepareStatement("delete ?, ? from JdbcInteger0 where key = ?");
         for (int i = 0; i < 5; i++)
         {
             byte[] key = Integer.toString(i).getBytes();
@@ -335,7 +335,7 @@
         }

         // verify.
- stmt = con.prepareStatement("select ?, ? from JdbcInteger where key = ?"); + stmt = con.prepareStatement("select ?, ? from JdbcInteger0 where key = ?");
         for (int i = 0; i < 5; i++)
         {
             byte[] key = Integer.toString(i).getBytes();

Reply via email to