Pig: fix widerow/secondary env toggles
Patch by brandonwilliams reviewed by Jeremy Hanna for CASSANDRA-4749


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

Branch: refs/heads/trunk
Commit: a0900f3d3b9fadc3608bc6c4960ed1858d581e13
Parents: 936302c
Author: Brandon Williams <brandonwilli...@apache.org>
Authored: Thu Oct 11 22:00:08 2012 -0500
Committer: Brandon Williams <brandonwilli...@apache.org>
Committed: Thu Oct 11 22:03:27 2012 -0500

----------------------------------------------------------------------
 .../cassandra/hadoop/pig/CassandraStorage.java     |   15 +++++----------
 1 files changed, 5 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/a0900f3d/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 49d8eac..8f539a9 100644
--- a/src/java/org/apache/cassandra/hadoop/pig/CassandraStorage.java
+++ b/src/java/org/apache/cassandra/hadoop/pig/CassandraStorage.java
@@ -83,8 +83,6 @@ public class CassandraStorage extends LoadFunc implements 
StoreFuncInterface, Lo
 
     private final static String DEFAULT_INPUT_FORMAT = 
"org.apache.cassandra.hadoop.ColumnFamilyInputFormat";
     private final static String DEFAULT_OUTPUT_FORMAT = 
"org.apache.cassandra.hadoop.ColumnFamilyOutputFormat";
-    private final static boolean DEFAULT_WIDEROW_INPUT = false;
-    private final static boolean DEFAULT_USE_SECONDARY = false;
 
     private final static String PARTITION_FILTER_SIGNATURE = 
"cassandra.partition.filter";
 
@@ -106,8 +104,8 @@ public class CassandraStorage extends LoadFunc implements 
StoreFuncInterface, Lo
     private String inputFormatClass;
     private String outputFormatClass;
     private int limit;
-    private boolean widerows;
-    private boolean usePartitionFilter;
+    private boolean widerows = false;
+    private boolean usePartitionFilter = false;
     // wide row hacks
     private ByteBuffer lastKey;
     private Map<ByteBuffer,IColumn> lastRow;
@@ -567,11 +565,9 @@ public class CassandraStorage extends LoadFunc implements 
StoreFuncInterface, Lo
             SlicePredicate predicate = new 
SlicePredicate().setSlice_range(range);
             ConfigHelper.setInputSlicePredicate(conf, predicate);
         }
-        widerows = DEFAULT_WIDEROW_INPUT;
         if (System.getenv(PIG_WIDEROW_INPUT) != null)
-            widerows = Boolean.valueOf(System.getProperty(PIG_WIDEROW_INPUT));
-        usePartitionFilter = DEFAULT_USE_SECONDARY;
-        if (System.getenv() != null)
+            widerows = Boolean.valueOf(System.getenv(PIG_WIDEROW_INPUT));
+        if (System.getenv(PIG_USE_SECONDARY) != null)
             usePartitionFilter = 
Boolean.valueOf(System.getenv(PIG_USE_SECONDARY));
 
         if (usePartitionFilter && getIndexExpressions() != null)
@@ -815,8 +811,7 @@ public class CassandraStorage extends LoadFunc implements 
StoreFuncInterface, Lo
             throw new IOException("PIG_OUTPUT_PARTITIONER or PIG_PARTITIONER 
environment variable not set");
 
         // we have to do this again here for the check in writeColumnsFromTuple
-        usePartitionFilter = DEFAULT_USE_SECONDARY;
-        if (System.getenv() != null)
+        if (System.getenv(PIG_USE_SECONDARY) != null)
             usePartitionFilter = 
Boolean.valueOf(System.getenv(PIG_USE_SECONDARY));
 
         initSchema(storeSignature);

Reply via email to