cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brandonwilli...@apache.org
Subject [1/6] git commit: Change runtime exceptions to IOE in pig Patch by Alex Liu, reviewed by brandonwilliams for CASSANDRA-6099
Date Wed, 25 Sep 2013 21:29:02 GMT
Updated Branches:
  refs/heads/cassandra-1.2 308a3e41e -> ff7600386
  refs/heads/cassandra-2.0 8845ad609 -> 83da4bdb6
  refs/heads/trunk fa2453558 -> e2a3456e2


Change runtime exceptions to IOE in pig
Patch by Alex Liu, reviewed by brandonwilliams for CASSANDRA-6099


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

Branch: refs/heads/cassandra-1.2
Commit: ff76003866152551e66893b2387e436e47efdf32
Parents: 308a3e4
Author: Brandon Williams <brandonwilliams@apache.org>
Authored: Wed Sep 25 16:24:24 2013 -0500
Committer: Brandon Williams <brandonwilliams@apache.org>
Committed: Wed Sep 25 16:24:24 2013 -0500

----------------------------------------------------------------------
 .../hadoop/pig/AbstractCassandraStorage.java    | 30 ++++++++++----------
 .../cassandra/hadoop/pig/CassandraStorage.java  | 18 ++++++------
 .../apache/cassandra/hadoop/pig/CqlStorage.java |  8 +++---
 3 files changed, 28 insertions(+), 28 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/ff760038/src/java/org/apache/cassandra/hadoop/pig/AbstractCassandraStorage.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/hadoop/pig/AbstractCassandraStorage.java b/src/java/org/apache/cassandra/hadoop/pig/AbstractCassandraStorage.java
index 74702e3..50671da 100644
--- a/src/java/org/apache/cassandra/hadoop/pig/AbstractCassandraStorage.java
+++ b/src/java/org/apache/cassandra/hadoop/pig/AbstractCassandraStorage.java
@@ -168,7 +168,7 @@ public abstract class AbstractCassandraStorage extends LoadFunc implements
Store
     }
 
     /** get the columnfamily definition for the signature */
-    protected CfDef getCfDef(String signature)
+    protected CfDef getCfDef(String signature) throws IOException
     {
         UDFContext context = UDFContext.getUDFContext();
         Properties property = context.getUDFProperties(AbstractCassandraStorage.class);
@@ -246,7 +246,7 @@ public abstract class AbstractCassandraStorage extends LoadFunc implements
Store
     }
 
     @Override
-    public InputFormat getInputFormat()
+    public InputFormat getInputFormat() throws IOException
     {
         try
         {
@@ -254,7 +254,7 @@ public abstract class AbstractCassandraStorage extends LoadFunc implements
Store
         }
         catch (ConfigurationException e)
         {
-            throw new RuntimeException(e);
+            throw new IOException(e);
         }
     }
 
@@ -370,7 +370,7 @@ public abstract class AbstractCassandraStorage extends LoadFunc implements
Store
     }
 
     /** output format */
-    public OutputFormat getOutputFormat()
+    public OutputFormat getOutputFormat() throws IOException
     {
         try
         {
@@ -378,7 +378,7 @@ public abstract class AbstractCassandraStorage extends LoadFunc implements
Store
         }
         catch (ConfigurationException e)
         {
-            throw new RuntimeException(e);
+            throw new IOException(e);
         }
     }
 
@@ -477,7 +477,7 @@ public abstract class AbstractCassandraStorage extends LoadFunc implements
Store
     }
 
     /** Methods to get the column family schema from Cassandra */
-    protected void initSchema(String signature)
+    protected void initSchema(String signature) throws IOException
     {
         Properties properties = UDFContext.getUDFContext().getUDFProperties(AbstractCassandraStorage.class);
 
@@ -502,7 +502,7 @@ public abstract class AbstractCassandraStorage extends LoadFunc implements
Store
                     catch (AuthenticationException e)
                     {
                         logger.error("Authentication exception: invalid username and/or password");
-                        throw new RuntimeException(e);
+                        throw new IOException(e);
                     }
                     catch (AuthorizationException e)
                     {
@@ -516,19 +516,19 @@ public abstract class AbstractCassandraStorage extends LoadFunc implements
Store
                 if (cfDef != null)
                     properties.setProperty(signature, cfdefToString(cfDef));
                 else
-                    throw new RuntimeException(String.format("Column family '%s' not found
in keyspace '%s'",
+                    throw new IOException(String.format("Column family '%s' not found in
keyspace '%s'",
                                                              column_family,
                                                              keyspace));
             }
             catch (Exception e)
             {
-                throw new RuntimeException(e);
+                throw new IOException(e);
             }
         }
     }
 
     /** convert CfDef to string */
-    protected static String cfdefToString(CfDef cfDef)
+    protected static String cfdefToString(CfDef cfDef) throws IOException
     {
         assert cfDef != null;
         // this is so awful it's kind of cool!
@@ -539,12 +539,12 @@ public abstract class AbstractCassandraStorage extends LoadFunc implements
Store
         }
         catch (TException e)
         {
-            throw new RuntimeException(e);
+            throw new IOException(e);
         }
     }
 
     /** convert string back to CfDef */
-    protected static CfDef cfdefFromString(String st)
+    protected static CfDef cfdefFromString(String st) throws IOException
     {
         assert st != null;
         TDeserializer deserializer = new TDeserializer(new TBinaryProtocol.Factory());
@@ -555,7 +555,7 @@ public abstract class AbstractCassandraStorage extends LoadFunc implements
Store
         }
         catch (TException e)
         {
-            throw new RuntimeException(e);
+            throw new IOException(e);
         }
         return cfDef;
     }
@@ -858,7 +858,7 @@ public abstract class AbstractCassandraStorage extends LoadFunc implements
Store
     }
 
     /** return partition keys */
-    public String[] getPartitionKeys(String location, Job job)
+    public String[] getPartitionKeys(String location, Job job) throws IOException
     {
         if (!usePartitionFilter)
             return null;
@@ -872,7 +872,7 @@ public abstract class AbstractCassandraStorage extends LoadFunc implements
Store
     }
 
     /** get a list of columns with defined index*/
-    protected List<ColumnDef> getIndexes()
+    protected List<ColumnDef> getIndexes() throws IOException
     {
         CfDef cfdef = getCfDef(loadSignature);
         List<ColumnDef> indexes = new ArrayList<ColumnDef>();

http://git-wip-us.apache.org/repos/asf/cassandra/blob/ff760038/src/java/org/apache/cassandra/hadoop/pig/CassandraStorage.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/hadoop/pig/CassandraStorage.java b/src/java/org/apache/cassandra/hadoop/pig/CassandraStorage.java
index dbdd5e9..8cf06f2 100644
--- a/src/java/org/apache/cassandra/hadoop/pig/CassandraStorage.java
+++ b/src/java/org/apache/cassandra/hadoop/pig/CassandraStorage.java
@@ -290,7 +290,7 @@ public class CassandraStorage extends AbstractCassandraStorage
             }
             catch (NumberFormatException e)
             {
-                throw new RuntimeException("PIG_INPUT_SPLIT_SIZE is not a number", e);
+                throw new IOException("PIG_INPUT_SPLIT_SIZE is not a number", e);
             }           
         } 
 
@@ -454,7 +454,7 @@ public class CassandraStorage extends AbstractCassandraStorage
     }
 
     /** set partition filter */
-    public void setPartitionFilter(Expression partitionFilter)
+    public void setPartitionFilter(Expression partitionFilter) throws IOException
     {
         UDFContext context = UDFContext.getUDFContext();
         Properties property = context.getUDFProperties(AbstractCassandraStorage.class);
@@ -616,7 +616,7 @@ public class CassandraStorage extends AbstractCassandraStorage
     }
 
     /** get a list of Cassandra IndexExpression from Pig expression */
-    private List<IndexExpression> filterToIndexExpressions(Expression expression)
+    private List<IndexExpression> filterToIndexExpressions(Expression expression) throws
IOException
     {
         List<IndexExpression> indexExpressions = new ArrayList<IndexExpression>();
         Expression.BinaryExpression be = (Expression.BinaryExpression)expression;
@@ -644,13 +644,13 @@ public class CassandraStorage extends AbstractCassandraStorage
                 indexExpressions.addAll(filterToIndexExpressions(be.getRhs()));
                 break;
             default:
-                throw new RuntimeException("Unsupported expression type: " + expression.getOpType().name());
+                throw new IOException("Unsupported expression type: " + expression.getOpType().name());
         }
         return indexExpressions;
     }
 
     /** convert a list of index expression to string */
-    private static String indexExpressionsToString(List<IndexExpression> indexExpressions)
+    private static String indexExpressionsToString(List<IndexExpression> indexExpressions)
throws IOException
     {
         assert indexExpressions != null;
         // oh, you thought cfdefToString was awful?
@@ -664,12 +664,12 @@ public class CassandraStorage extends AbstractCassandraStorage
         }
         catch (TException e)
         {
-            throw new RuntimeException(e);
+            throw new IOException(e);
         }
     }
 
     /** convert string to a list of index expression */
-    private static List<IndexExpression> indexExpressionsFromString(String ie)
+    private static List<IndexExpression> indexExpressionsFromString(String ie) throws
IOException
     {
         assert ie != null;
         TDeserializer deserializer = new TDeserializer(new TBinaryProtocol.Factory());
@@ -680,13 +680,13 @@ public class CassandraStorage extends AbstractCassandraStorage
         }
         catch (TException e)
         {
-            throw new RuntimeException(e);
+            throw new IOException(e);
         }
         return indexClause.getExpressions();
     }
 
     /** get a list of index expression */
-    private List<IndexExpression> getIndexExpressions()
+    private List<IndexExpression> getIndexExpressions() throws IOException
     {
         UDFContext context = UDFContext.getUDFContext();
         Properties property = context.getUDFProperties(AbstractCassandraStorage.class);

http://git-wip-us.apache.org/repos/asf/cassandra/blob/ff760038/src/java/org/apache/cassandra/hadoop/pig/CqlStorage.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/hadoop/pig/CqlStorage.java b/src/java/org/apache/cassandra/hadoop/pig/CqlStorage.java
index b35e13a..7780ca9 100644
--- a/src/java/org/apache/cassandra/hadoop/pig/CqlStorage.java
+++ b/src/java/org/apache/cassandra/hadoop/pig/CqlStorage.java
@@ -231,7 +231,7 @@ public class CqlStorage extends AbstractCassandraStorage
             }
             catch (NumberFormatException e)
             {
-                throw new RuntimeException("PIG_INPUT_SPLIT_SIZE is not a number", e);
+                throw new IOException("PIG_INPUT_SPLIT_SIZE is not a number", e);
             }           
         }
 
@@ -307,7 +307,7 @@ public class CqlStorage extends AbstractCassandraStorage
         return schema;
     }
 
-    public void setPartitionFilter(Expression partitionFilter)
+    public void setPartitionFilter(Expression partitionFilter) throws IOException
     {
         UDFContext context = UDFContext.getUDFContext();
         Properties property = context.getUDFProperties(AbstractCassandraStorage.class);
@@ -525,7 +525,7 @@ public class CqlStorage extends AbstractCassandraStorage
      * Return cql where clauses for the corresponding partition filter. Make sure the data
format matches 
      * Only support the following Pig data types: int, long, float, double, boolean and chararray
      * */
-    private String partitionFilterToWhereClauseString(Expression expression)
+    private String partitionFilterToWhereClauseString(Expression expression) throws IOException
     {
         Expression.BinaryExpression be = (Expression.BinaryExpression) expression;
         String name = be.getLhs().toString();
@@ -544,7 +544,7 @@ public class CqlStorage extends AbstractCassandraStorage
             case OP_AND:
                 return String.format("%s AND %s", partitionFilterToWhereClauseString(be.getLhs()),
partitionFilterToWhereClauseString(be.getRhs()));
             default:
-                throw new RuntimeException("Unsupported expression type: " + opString);
+                throw new IOException("Unsupported expression type: " + opString);
         }
     }
 }


Mime
View raw message