Search in sources :

Example 26 with AbsoluteTableIdentifier

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);
}
Also used : Path(org.apache.hadoop.fs.Path) Configuration(org.apache.hadoop.conf.Configuration) AbsoluteTableIdentifier(org.apache.carbondata.core.metadata.AbsoluteTableIdentifier) Job(org.apache.hadoop.mapreduce.Job) File(java.io.File)

Aggregations

AbsoluteTableIdentifier (org.apache.carbondata.core.metadata.AbsoluteTableIdentifier)26 IOException (java.io.IOException)13 ArrayList (java.util.ArrayList)11 CarbonTablePath (org.apache.carbondata.core.util.path.CarbonTablePath)10 SegmentStatusManager (org.apache.carbondata.core.statusmanager.SegmentStatusManager)8 ICarbonLock (org.apache.carbondata.core.locks.ICarbonLock)7 LoadMetadataDetails (org.apache.carbondata.core.statusmanager.LoadMetadataDetails)7 TableBlockInfo (org.apache.carbondata.core.datastore.block.TableBlockInfo)6 CarbonTableIdentifier (org.apache.carbondata.core.metadata.CarbonTableIdentifier)6 File (java.io.File)5 CarbonTable (org.apache.carbondata.core.metadata.schema.table.CarbonTable)5 SegmentUpdateStatusManager (org.apache.carbondata.core.statusmanager.SegmentUpdateStatusManager)5 FilterExpressionProcessor (org.apache.carbondata.core.scan.filter.FilterExpressionProcessor)4 FilterResolverIntf (org.apache.carbondata.core.scan.filter.resolver.FilterResolverIntf)4 Path (org.apache.hadoop.fs.Path)4 Test (org.junit.Test)4 AbstractIndex (org.apache.carbondata.core.datastore.block.AbstractIndex)3 TableBlockUniqueIdentifier (org.apache.carbondata.core.datastore.block.TableBlockUniqueIdentifier)3 BlockBTreeLeafNode (org.apache.carbondata.core.datastore.impl.btree.BlockBTreeLeafNode)3 UpdateVO (org.apache.carbondata.core.mutate.UpdateVO)3