This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import argparse | |
import csv | |
import urlparse | |
from Common.Api import member_ids | |
def main(file_name): | |
with open(file_name, 'rU') as infile: | |
reader = csv.DictReader(infile) | |
with open('result.csv', 'w') as outfile: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class TestCreateEffectiveSessions { | |
private MultipleTextOutputsReduceDriver<AvroKey<Utf8>, AvroValue<GenericRecord>, AvroKey<GenericRecord>, NullWritable> reduce_driver; | |
private JobConf conf; | |
private static final Text should_be_null = new Text("should_be_null"); | |
@Before | |
public void setUp() { | |
conf = new JobConf(); | |
conf.setInputFormat(AvroInputFormat.class); | |
AvroJob.setInputSchema(conf, EffectiveSessionSchema.TID_OMNIBUS); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.lang.reflect.Field; | |
public class ReflectUtils { | |
/* Reflectively replaces instances of clazz on supplied instance with supplied mock object */ | |
public static String injectMockByClass(Class<?> clazz, Object instance, Object mock) { | |
Field[] fields = instance.getClass().getDeclaredFields(); | |
String msg = "No instances of " + clazz.getCanonicalName() + " found"; | |
for (Field field : fields) { | |
if (clazz.isAssignableFrom(field.getType())) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.IOException; | |
import java.util.ArrayList; | |
import java.util.HashMap; | |
import java.util.HashSet; | |
import java.util.Iterator; | |
import java.util.List; | |
import java.util.Map; | |
import java.util.Map.Entry; | |
import java.util.Set; | |
import java.util.TreeMap; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.IOException; | |
import java.util.HashMap; | |
import java.util.Iterator; | |
import java.util.List; | |
import java.util.Map; | |
import java.util.TreeMap; | |
import org.apache.hadoop.io.Text; | |
import org.apache.hadoop.mapred.JobConf; | |
import org.apache.hadoop.mapred.OutputCollector; |