cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dbros...@apache.org
Subject git commit: push down assignments to where they're needed
Date Tue, 06 Aug 2013 00:15:17 GMT
Updated Branches:
  refs/heads/cassandra-2.0 b3d887654 -> cf62bdcd3


push down assignments to where they're needed


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

Branch: refs/heads/cassandra-2.0
Commit: cf62bdcd37485b1c39800093e140a3008678c4a0
Parents: b3d8876
Author: Dave Brosius <dbrosius@apache.org>
Authored: Mon Aug 5 20:12:51 2013 -0400
Committer: Dave Brosius <dbrosius@apache.org>
Committed: Mon Aug 5 20:12:51 2013 -0400

----------------------------------------------------------------------
 src/java/org/apache/cassandra/hadoop/pig/CqlStorage.java | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/cf62bdcd/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 250c95b..84d7a7a 100644
--- a/src/java/org/apache/cassandra/hadoop/pig/CqlStorage.java
+++ b/src/java/org/apache/cassandra/hadoop/pig/CqlStorage.java
@@ -267,9 +267,11 @@ public class CqlStorage extends AbstractCassandraStorage
 
         if (t.getType(0) == DataType.TUPLE)
         {
-            Map<String, ByteBuffer> key = tupleToKeyMap((Tuple)t.get(0));
             if (t.getType(1) == DataType.TUPLE)
+            {
+                Map<String, ByteBuffer> key = tupleToKeyMap((Tuple)t.get(0));
                 cqlQueryFromTuple(key, t, 1);
+            }
             else
                 throw new IOException("Second argument in output must be a tuple");
         }
@@ -453,8 +455,6 @@ public class CqlStorage extends AbstractCassandraStorage
     private String partitionFilterToWhereClauseString(Expression expression)
     {
         Expression.BinaryExpression be = (Expression.BinaryExpression) expression;
-        String name = be.getLhs().toString();
-        String value = be.getRhs().toString();
         OpType op = expression.getOpType();
         String opString = op.name();
         switch (op)
@@ -465,6 +465,8 @@ public class CqlStorage extends AbstractCassandraStorage
             case OP_GT:
             case OP_LE:
             case OP_LT:
+                String name = be.getLhs().toString();
+                String value = be.getRhs().toString();
                 return String.format("%s %s %s", name, opString, value);
             case OP_AND:
                 return String.format("%s AND %s", partitionFilterToWhereClauseString(be.getLhs()),
partitionFilterToWhereClauseString(be.getRhs()));


Mime
View raw message