cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brandonwilli...@apache.org
Subject [3/6] git commit: Fix pig tests.
Date Thu, 07 Aug 2014 16:57:30 GMT
Fix pig tests.

Patch by Alex Liu, reviewed by brandonwilliams for CASSANDRA-7570


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

Branch: refs/heads/trunk
Commit: 6fdcd3b616b262c0a5c266e765046a57602be1b8
Parents: 3970c65
Author: Brandon Williams <brandonwilliams@apache.org>
Authored: Thu Aug 7 11:54:34 2014 -0500
Committer: Brandon Williams <brandonwilliams@apache.org>
Committed: Thu Aug 7 11:54:34 2014 -0500

----------------------------------------------------------------------
 .../cassandra/pig/CqlTableDataTypeTest.java     | 39 ++-----------
 .../org/apache/cassandra/pig/CqlTableTest.java  | 61 ++++++++------------
 .../cassandra/pig/ThriftColumnFamilyTest.java   | 14 -----
 3 files changed, 28 insertions(+), 86 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/6fdcd3b6/test/pig/org/apache/cassandra/pig/CqlTableDataTypeTest.java
----------------------------------------------------------------------
diff --git a/test/pig/org/apache/cassandra/pig/CqlTableDataTypeTest.java b/test/pig/org/apache/cassandra/pig/CqlTableDataTypeTest.java
index 1819c61..bbd5a87 100644
--- a/test/pig/org/apache/cassandra/pig/CqlTableDataTypeTest.java
+++ b/test/pig/org/apache/cassandra/pig/CqlTableDataTypeTest.java
@@ -217,22 +217,14 @@ public class CqlTableDataTypeTest extends PigTestBase
     }
 
     @Test
-    public void testCqlStorageRegularType()
-    throws AuthenticationException, AuthorizationException, InvalidRequestException, UnavailableException,
TimedOutException, TException, NotFoundException, SchemaDisagreementException, IOException
-    {
-        cqlTableTest("rows = LOAD 'cql://cql3ks/cqltable?" + defaultParameters + "' USING
CqlStorage();");
-        counterTableTest("cc_rows = LOAD 'cql://cql3ks/countertable?" + defaultParameters
+ "' USING CqlStorage();");
-    }
-
-    @Test
     public void testCqlNativeStorageRegularType()
     throws AuthenticationException, AuthorizationException, InvalidRequestException, UnavailableException,
TimedOutException, TException, NotFoundException, SchemaDisagreementException, IOException
     {
         //input_cql=select * from cqltable where token(key) > ? and token(key) <= ?
-        cqlTableTest("rows = LOAD 'cql://cql3ks/cqltable?" + defaultParameters + nativeParameters
+ "&input_cql=select%20*%20from%20cqltable%20where%20token(key)%20%3E%20%3F%20and%20token(key)%20%3C%3D%20%3F'
USING CqlStorage();");
+        cqlTableTest("rows = LOAD 'cql://cql3ks/cqltable?" + defaultParameters + nativeParameters
+ "&input_cql=select%20*%20from%20cqltable%20where%20token(key)%20%3E%20%3F%20and%20token(key)%20%3C%3D%20%3F'
USING CqlNativeStorage();");
 
         //input_cql=select * from countertable where token(key) > ? and token(key) <=
?
-        counterTableTest("cc_rows = LOAD 'cql://cql3ks/countertable?" + defaultParameters
+ nativeParameters + "&input_cql=select%20*%20from%20countertable%20where%20token(key)%20%3E%20%3F%20and%20token(key)%20%3C%3D%20%3F'
USING CqlStorage();");
+        counterTableTest("cc_rows = LOAD 'cql://cql3ks/countertable?" + defaultParameters
+ nativeParameters + "&input_cql=select%20*%20from%20countertable%20where%20token(key)%20%3E%20%3F%20and%20token(key)%20%3C%3D%20%3F'
USING CqlNativeStorage();");
     }
 
     private void cqlTableTest(String initialQuery) throws IOException
@@ -296,18 +288,11 @@ public class CqlTableDataTypeTest extends PigTestBase
     }
 
     @Test
-    public void testCqlStorageSetType()
-    throws AuthenticationException, AuthorizationException, InvalidRequestException, UnavailableException,
TimedOutException, TException, NotFoundException, SchemaDisagreementException, IOException
-    {
-        settableTest("set_rows = LOAD 'cql://cql3ks/settable?" + defaultParameters + "' USING
CqlStorage();");
-    }
-
-    @Test
     public void testCqlNativeStorageSetType()
     throws AuthenticationException, AuthorizationException, InvalidRequestException, UnavailableException,
TimedOutException, TException, NotFoundException, SchemaDisagreementException, IOException
     {
         //input_cql=select * from settable where token(key) > ? and token(key) <= ?
-        settableTest("set_rows = LOAD 'cql://cql3ks/settable?" + defaultParameters + nativeParameters
+ "&input_cql=select%20*%20from%20settable%20where%20token(key)%20%3E%20%3F%20and%20token(key)%20%3C%3D%20%3F'
USING CqlStorage();");
+        settableTest("set_rows = LOAD 'cql://cql3ks/settable?" + defaultParameters + nativeParameters
+ "&input_cql=select%20*%20from%20settable%20where%20token(key)%20%3E%20%3F%20and%20token(key)%20%3C%3D%20%3F'
USING CqlNativeStorage();");
     }
 
     private void settableTest(String initialQuery) throws IOException
@@ -370,18 +355,11 @@ public class CqlTableDataTypeTest extends PigTestBase
     }
 
     @Test
-    public void testCqlStorageListType()
-    throws AuthenticationException, AuthorizationException, InvalidRequestException, UnavailableException,
TimedOutException, TException, NotFoundException, SchemaDisagreementException, IOException
-    {
-        listtableTest("list_rows = LOAD 'cql://cql3ks/listtable?" + defaultParameters + "'
USING CqlStorage();");
-    }
-
-    @Test
     public void testCqlNativeStorageListType()
     throws AuthenticationException, AuthorizationException, InvalidRequestException, UnavailableException,
TimedOutException, TException, NotFoundException, SchemaDisagreementException, IOException
     {
         //input_cql=select * from listtable where token(key) > ? and token(key) <=
?
-        listtableTest("list_rows = LOAD 'cql://cql3ks/listtable?" + defaultParameters + nativeParameters
+ "&input_cql=select%20*%20from%20listtable%20where%20token(key)%20%3E%20%3F%20and%20token(key)%20%3C%3D%20%3F'
USING CqlStorage();");
+        listtableTest("list_rows = LOAD 'cql://cql3ks/listtable?" + defaultParameters + nativeParameters
+ "&input_cql=select%20*%20from%20listtable%20where%20token(key)%20%3E%20%3F%20and%20token(key)%20%3C%3D%20%3F'
USING CqlNativeStorage();");
     }
 
     private void listtableTest(String initialQuery) throws IOException
@@ -444,18 +422,11 @@ public class CqlTableDataTypeTest extends PigTestBase
     }
 
     @Test
-    public void testCqlStorageMapType()
-    throws AuthenticationException, AuthorizationException, InvalidRequestException, UnavailableException,
TimedOutException, TException, NotFoundException, SchemaDisagreementException, IOException
-    {
-        maptableTest("map_rows = LOAD 'cql://cql3ks/maptable?" + defaultParameters + "' USING
CqlStorage();");
-    }
-
-    @Test
     public void testCqlNativeStorageMapType()
     throws AuthenticationException, AuthorizationException, InvalidRequestException, UnavailableException,
TimedOutException, TException, NotFoundException, SchemaDisagreementException, IOException
     {
         //input_cql=select * from maptable where token(key) > ? and token(key) <= ?
-        maptableTest("map_rows = LOAD 'cql://cql3ks/maptable?" + defaultParameters + nativeParameters
+ "&input_cql=select%20*%20from%20maptable%20where%20token(key)%20%3E%20%3F%20and%20token(key)%20%3C%3D%20%3F'
USING CqlStorage();");
+        maptableTest("map_rows = LOAD 'cql://cql3ks/maptable?" + defaultParameters + nativeParameters
+ "&input_cql=select%20*%20from%20maptable%20where%20token(key)%20%3E%20%3F%20and%20token(key)%20%3C%3D%20%3F'
USING CqlNativeStorage();");
     }
 
     private void maptableTest(String initialQuery) throws IOException

http://git-wip-us.apache.org/repos/asf/cassandra/blob/6fdcd3b6/test/pig/org/apache/cassandra/pig/CqlTableTest.java
----------------------------------------------------------------------
diff --git a/test/pig/org/apache/cassandra/pig/CqlTableTest.java b/test/pig/org/apache/cassandra/pig/CqlTableTest.java
index f5adef8..4ca043d 100644
--- a/test/pig/org/apache/cassandra/pig/CqlTableTest.java
+++ b/test/pig/org/apache/cassandra/pig/CqlTableTest.java
@@ -90,14 +90,6 @@ public class CqlTableTest extends PigTestBase
     }
 
     @Test
-    public void testCqlStorageSchema()
-    throws AuthenticationException, AuthorizationException, InvalidRequestException, UnavailableException,
TimedOutException, TException, NotFoundException, SchemaDisagreementException, IOException
-    {
-        cqlTableSchemaTest("rows = LOAD 'cql://cql3ks/cqltable?" + defaultParameters + "'
USING CqlStorage();");
-        compactCqlTableSchemaTest("rows = LOAD 'cql://cql3ks/compactcqltable?" + defaultParameters
+ "' USING CqlStorage();");
-    }
-
-    @Test
     public void testCqlNativeStorageSchema()
     throws AuthenticationException, AuthorizationException, InvalidRequestException, UnavailableException,
TimedOutException, TException, NotFoundException, SchemaDisagreementException, IOException
     {
@@ -144,14 +136,6 @@ public class CqlTableTest extends PigTestBase
     }
 
     @Test
-    public void testCqlStorageSingleKeyTable()
-    throws AuthenticationException, AuthorizationException, InvalidRequestException, UnavailableException,
TimedOutException, TException, NotFoundException, SchemaDisagreementException, IOException
-    {
-        SingleKeyTableTest("moretestvalues= LOAD 'cql://cql3ks/moredata?" + defaultParameters
+ "' USING CqlStorage();");
-
-    }
-
-    @Test
     public void testCqlNativeStorageSingleKeyTable()
     throws AuthenticationException, AuthorizationException, InvalidRequestException, UnavailableException,
TimedOutException, TException, NotFoundException, SchemaDisagreementException, IOException
     {
@@ -165,7 +149,7 @@ public class CqlTableTest extends PigTestBase
         pig.setBatchOn();
         pig.registerQuery(initialQuery);
         pig.registerQuery("insertformat= FOREACH moretestvalues GENERATE TOTUPLE(TOTUPLE('a',x)),TOTUPLE(y);");
-        pig.registerQuery("STORE insertformat INTO 'cql://cql3ks/test?" + defaultParameters
+ "&output_query=UPDATE+cql3ks.test+set+b+%3D+%3F' USING CqlStorage();");
+        pig.registerQuery("STORE insertformat INTO 'cql://cql3ks/test?" + defaultParameters
+ nativeParameters + "&output_query=UPDATE+cql3ks.test+set+b+%3D+%3F' USING CqlNativeStorage();");
         pig.executeBatch();
         //(5,5)
         //(6,6)
@@ -173,7 +157,8 @@ public class CqlTableTest extends PigTestBase
         //(2,2)
         //(3,3)
         //(1,1)
-        pig.registerQuery("result= LOAD 'cql://cql3ks/test?" + defaultParameters + "' USING
CqlStorage();");
+        //input_cql=select * from test where token(a) > ? and token(a) <= ?
+        pig.registerQuery("result= LOAD 'cql://cql3ks/test?" + defaultParameters + nativeParameters
+ "&input_cql=select%20*%20from%20test%20where%20token(a)%20%3E%20%3F%20and%20token(a)%20%3C%3D%20%3F'
USING CqlNativeStorage();");
         Iterator<Tuple> it = pig.openIterator("result");
         while (it.hasNext()) {
             Tuple t = it.next();
@@ -182,13 +167,6 @@ public class CqlTableTest extends PigTestBase
     }
 
     @Test
-    public void testCqlStorageCompositeKeyTable()
-    throws AuthenticationException, AuthorizationException, InvalidRequestException, UnavailableException,
TimedOutException, TException, NotFoundException, SchemaDisagreementException, IOException
-    {
-        CompositeKeyTableTest("moredata= LOAD 'cql://cql3ks/compmore?" + defaultParameters
+ "' USING CqlStorage();");
-    }
-
-    @Test
     public void testCqlNativeStorageCompositeKeyTable()
     throws AuthenticationException, AuthorizationException, InvalidRequestException, UnavailableException,
TimedOutException, TException, NotFoundException, SchemaDisagreementException, IOException
     {
@@ -202,7 +180,7 @@ public class CqlTableTest extends PigTestBase
         pig.setBatchOn();
         pig.registerQuery(initialQuery);
         pig.registerQuery("insertformat = FOREACH moredata GENERATE TOTUPLE (TOTUPLE('a',x),TOTUPLE('b',y),
TOTUPLE('c',z)),TOTUPLE(data);");
-        pig.registerQuery("STORE insertformat INTO 'cql://cql3ks/compotable?" + defaultParameters
+ "&output_query=UPDATE%20cql3ks.compotable%20SET%20d%20%3D%20%3F' USING CqlStorage();");
+        pig.registerQuery("STORE insertformat INTO 'cql://cql3ks/compotable?" + defaultParameters
+ nativeParameters + "&output_query=UPDATE%20cql3ks.compotable%20SET%20d%20%3D%20%3F'
USING CqlNativeStorage();");
         pig.executeBatch();
 
         //(5,6,Fix,nomatch)
@@ -214,7 +192,8 @@ public class CqlTableTest extends PigTestBase
         //(6,5,Sive,nomatch)
         //(4,4,Four,match)
         //(9,10,Ninen,nomatch)
-        pig.registerQuery("result= LOAD 'cql://cql3ks/compotable?" + defaultParameters +
"' USING CqlStorage();");
+        //input_cql=select * from compotable where token(a) > ? and token(a) <= ?
+        pig.registerQuery("result= LOAD 'cql://cql3ks/compotable?" + defaultParameters +
nativeParameters + "&input_cql=select%20*%20from%20compotable%20where%20token(a)%20%3E%20%3F%20and%20token(a)%20%3C%3D%20%3F'
USING CqlNativeStorage();");
         Iterator<Tuple> it = pig.openIterator("result");
         int count = 0;
         while (it.hasNext()) {
@@ -225,18 +204,11 @@ public class CqlTableTest extends PigTestBase
     }
 
     @Test
-    public void testCqlStorageCollectionColumnTable()
-    throws AuthenticationException, AuthorizationException, InvalidRequestException, UnavailableException,
TimedOutException, TException, NotFoundException, SchemaDisagreementException, IOException
-    {
-        CollectionColumnTableTest("collectiontable= LOAD 'cql://cql3ks/collectiontable?"
+ defaultParameters + "' USING CqlStorage();");
-    }
-
-    @Test
     public void testCqlNativeStorageCollectionColumnTable()
     throws AuthenticationException, AuthorizationException, InvalidRequestException, UnavailableException,
TimedOutException, TException, NotFoundException, SchemaDisagreementException, IOException
     {
-        //input_cql=select * from collectiontable where token(m) < ? and token(m) <=
?
-        CollectionColumnTableTest("collectiontable= LOAD 'cql://cql3ks/collectiontable?"
+ defaultParameters + nativeParameters + "&input_cql=input_cql%3Dselect%20*%20from%20collectiontable%20where%20token(m)%20%3C%20%3F%20and%20token(m)%20%3C%3D%20%3F'
USING CqlNativeStorage();");
+        //input_cql=select * from collectiontable where token(m) > ? and token(m) <=
?
+        CollectionColumnTableTest("collectiontable= LOAD 'cql://cql3ks/collectiontable?"
+ defaultParameters + nativeParameters + "&input_cql=select%20*%20from%20collectiontable%20where%20token(m)%20%3E%20%3F%20and%20token(m)%20%3C%3D%20%3F'
USING CqlNativeStorage();");
     }
 
     private void CollectionColumnTableTest(String initialQuery)
@@ -245,14 +217,15 @@ public class CqlTableTest extends PigTestBase
         pig.setBatchOn();
         pig.registerQuery(initialQuery);
         pig.registerQuery("recs= FOREACH collectiontable GENERATE TOTUPLE(TOTUPLE('m', m)
), TOTUPLE(TOTUPLE('map', TOTUPLE('m', 'mm'), TOTUPLE('n', 'nn')));");
-        pig.registerQuery("STORE recs INTO 'cql://cql3ks/collectiontable?" + defaultParameters
+ "&output_query=update+cql3ks.collectiontable+set+n+%3D+%3F' USING CqlStorage();");
+        pig.registerQuery("STORE recs INTO 'cql://cql3ks/collectiontable?" + defaultParameters
+ nativeParameters + "&output_query=update+cql3ks.collectiontable+set+n+%3D+%3F' USING
CqlNativeStorage();");
         pig.executeBatch();
 
         //(book2,((m,mm),(n,nn)))
         //(book3,((m,mm),(n,nn)))
         //(book4,((m,mm),(n,nn)))
         //(book1,((m,mm),(n,nn)))
-        pig.registerQuery("result= LOAD 'cql://cql3ks/collectiontable?" + defaultParameters
+ "' USING CqlStorage();");
+        //input_cql=select * from collectiontable where token(m) > ? and token(m) <=
?
+        pig.registerQuery("result= LOAD 'cql://cql3ks/collectiontable?" + defaultParameters
+ nativeParameters + "&input_cql=select%20*%20from%20collectiontable%20where%20token(m)%20%3E%20%3F%20and%20token(m)%20%3C%3D%20%3F'
USING CqlNativeStorage();");
         Iterator<Tuple> it = pig.openIterator("result");
         if (it.hasNext()) {
             Tuple t = it.next();
@@ -265,6 +238,10 @@ public class CqlTableTest extends PigTestBase
             Assert.assertEquals(element2.get(0), "n");
             Assert.assertEquals(element2.get(1), "nn");
         }
+        else
+        {
+            Assert.fail("Can't fetch any data");
+        }
     }
 
     @Test
@@ -307,6 +284,10 @@ public class CqlTableTest extends PigTestBase
             }
             Assert.assertEquals(3, columns.size());
         }
+        else
+        {
+            Assert.fail("Can't fetch any data");
+        }
 
         //results: (key1,(column1,100),(column2,10.1))
         pig.registerQuery("compact_rows = LOAD 'cassandra://cql3ks/compactcqltable?" + defaultParameters
+ "' USING CassandraStorage();");
@@ -324,5 +305,9 @@ public class CqlTableTest extends PigTestBase
             Assert.assertEquals(column.get(0), "column2");
             Assert.assertEquals(column.get(1), 10.1f);
         }
+        else
+        {
+            Assert.fail("Can't fetch any data");
+        }
     }
 }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/6fdcd3b6/test/pig/org/apache/cassandra/pig/ThriftColumnFamilyTest.java
----------------------------------------------------------------------
diff --git a/test/pig/org/apache/cassandra/pig/ThriftColumnFamilyTest.java b/test/pig/org/apache/cassandra/pig/ThriftColumnFamilyTest.java
index 3f1d5a1..15f402e 100644
--- a/test/pig/org/apache/cassandra/pig/ThriftColumnFamilyTest.java
+++ b/test/pig/org/apache/cassandra/pig/ThriftColumnFamilyTest.java
@@ -200,20 +200,6 @@ public class ThriftColumnFamilyTest extends PigTestBase
     }
 
     @Test
-    public void testCqlStorage() throws IOException, ClassNotFoundException, TException,
TimedOutException, NotFoundException, InvalidRequestException, NoSuchFieldException, UnavailableException,
IllegalAccessException, InstantiationException, AuthenticationException, AuthorizationException
-    {
-        //regular thrift column families
-        cqlStorageTest("data = load 'cql://thriftKs/SomeApp?" + defaultParameters + "' using
CqlStorage();");
-
-        //Test counter colun family
-        // This test fails for CASSANDRA-7059
-        //cqlStorageCounterTableTest("cc_data = load 'cql://thriftKs/CC?" + defaultParameters
+ "' using CqlStorage();");
-
-        //Test composite column family
-        cqlStorageCompositeTableTest("compo_data = load 'cql://thriftKs/Compo?" + defaultParameters
+ "' using CqlStorage();");
-    }
-
-    @Test
     public void testCqlNativeStorage() throws IOException, ClassNotFoundException, TException,
TimedOutException, NotFoundException, InvalidRequestException, NoSuchFieldException, UnavailableException,
IllegalAccessException, InstantiationException, AuthenticationException, AuthorizationException
     {
         //regular thrift column families


Mime
View raw message