use of org.apache.carbondata.core.metadata.AbsoluteTableIdentifier in project carbondata by apache.
the class CarbonInputMapperTest method runJob.
private void runJob(String outPath, CarbonProjection projection, Expression filter) throws Exception {
Job job = Job.getInstance(new Configuration());
job.setJarByClass(CarbonInputMapperTest.class);
job.setOutputKeyClass(Text.class);
job.setOutputValueClass(IntWritable.class);
job.setMapperClass(Map.class);
// job.setReducerClass(WordCountReducer.class);
job.setInputFormatClass(CarbonInputFormat.class);
job.setOutputFormatClass(TextOutputFormat.class);
AbsoluteTableIdentifier abs = StoreCreator.getAbsoluteTableIdentifier();
if (projection != null) {
CarbonInputFormat.setColumnProjection(job.getConfiguration(), projection);
}
if (filter != null) {
CarbonInputFormat.setFilterPredicates(job.getConfiguration(), filter);
}
FileInputFormat.addInputPath(job, new Path(abs.getTablePath()));
CarbonUtil.deleteFoldersAndFiles(new File(outPath + "1"));
FileOutputFormat.setOutputPath(job, new Path(outPath + "1"));
job.getConfiguration().set("outpath", outPath);
boolean status = job.waitForCompletion(true);
}
Aggregations