Anonymous avatar Anonymous committed a0900f3

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

Comments (0)

Files changed (1)

src/java/org/apache/cassandra/hadoop/pig/CassandraStorage.java

 
     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";
 
     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;
             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)
             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);
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.