Examples of PigSplit


Examples of org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.PigSplit

        processError("\nCommand: " + command);
        processError("\nStart time: " + new Date(System.currentTimeMillis()));
        if (job.getBoolean("mapred.task.is.map", false)) {
            MapContext context = (MapContext)PigMapReduce.sJobContext;
            PigSplit pigSplit = (PigSplit)context.getInputSplit();
            InputSplit wrappedSplit = pigSplit.getWrappedSplit();
            if (wrappedSplit instanceof FileSplit) {
                FileSplit mapInputFileSplit = (FileSplit)wrappedSplit;
                processError("\nInput-split file: " +
                             mapInputFileSplit.getPath().toString());
                processError("\nInput-split start-offset: " +
View Full Code Here

Examples of org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.PigSplit

        reader = inputFormat.createRecordReader(curSplit, tAContext);
        reader.initialize(curSplit, tAContext);
        // create a dummy pigsplit - other than the actual split, the other
        // params are really not needed here where we are just reading the
        // input completely
        PigSplit pigSplit = new PigSplit(new InputSplit[] {curSplit}, -1,
                new ArrayList<OperatorKey>(), -1);
        wrappedLoadFunc.prepareToRead(reader, pigSplit);
        return true;
    }
View Full Code Here

Examples of org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.PigSplit

                ArrayList<ArrayList<OperatorKey>> inpTargets =
                    (ArrayList<ArrayList<OperatorKey>>)
                      ObjectSerializer.deserialize(jobConf.get("pig.inpTargets"));
                intermediateData.clear();
                MapReduceOper mro = jobToMroMap.get(job);
                PigSplit split = null;
                List<POStore> stores = null;
                PhysicalOperator pack = null;
                // revisit as there are new physical operators from MR compilation
                if (!mro.mapPlan.isEmpty())
                    attacher.revisit(mro.mapPlan);
                if (!mro.reducePlan.isEmpty()) {
                    attacher.revisit(mro.reducePlan);
                    pack = mro.reducePlan.getRoots().get(0);
                }
               
                List<POLoad> lds = PlanHelper.getLoads(mro.mapPlan);
                if (!mro.mapPlan.isEmpty()) {
                    stores = PlanHelper.getStores(mro.mapPlan);
                }
                if (!mro.reducePlan.isEmpty()) {
                    if (stores == null)
                        stores = PlanHelper.getStores(mro.reducePlan);
                    else
                        stores.addAll(PlanHelper.getStores(mro.reducePlan));
                }

                for (POStore store : stores) {
                    output.put(store.getSFile().getFileName(), attacher.getDataMap().get(store));
                }
              
                OutputAttacher oa = new OutputAttacher(mro.mapPlan, output);
                oa.visit();
               
                if (!mro.reducePlan.isEmpty()) {
                    oa = new OutputAttacher(mro.reducePlan, output);
                    oa.visit();
                }
                int index = 0;
                for (POLoad ld : lds) {
                    input = output.get(ld.getLFile().getFileName());
                    if (input == null && baseData != null) {
                        for (LogicalRelationalOperator lo : baseData.keySet()) {
                            if (((LOLoad) lo).getSchemaFile().equals(ld.getLFile().getFileName()))
                            {
                                 input = baseData.get(lo);
                                 break;
                            }
                        }
                    }
                    if (input != null)
                        mro.mapPlan.remove(ld);
                }
                for (POLoad ld : lds) {
                    // check newly generated data first
                    input = output.get(ld.getLFile().getFileName());
                    if (input == null && baseData != null) {
                        if (input == null && baseData != null) {
                            for (LogicalRelationalOperator lo : baseData.keySet()) {
                                if (((LOLoad) lo).getSchemaFile().equals(ld.getLFile().getFileName()))
                                {
                                     input = baseData.get(lo);
                                     break;
                                }
                            }
                        }
                    }
                    needFileInput = (input == null);
                    split = new PigSplit(null, index, needFileInput ? emptyInpTargets : inpTargets.get(index), 0);
                    ++index;
                    Mapper<Text, Tuple, PigNullableWritable, Writable> map;
                   
                    if (mro.reducePlan.isEmpty()) {
                        // map-only
View Full Code Here

Examples of org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.PigSplit

    underTest = new BinarySequenceFileLoader();
  }
 
  public void testPrepareToRead() throws IOException
  {
    PigSplit split = null;
    RecordReader reader = EasyMock.createMock(SequenceFileRecordReader.class);
    EasyMock.replay(reader);
    underTest.prepareToRead(reader, null);
    assertTrue(reader == underTest.reader);
  }
View Full Code Here

Examples of org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.PigSplit

    }
  }
 
  public void testPrepareToRead()
  {
    PigSplit split = null;
    RecordReader reader = EasyMock.createMock(SequenceFileRecordReader.class);
    EasyMock.replay(reader);
   
    underTest.script = "src/test/resources/echo.sh";
   
View Full Code Here

Examples of org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.PigSplit

    reader.initialize(fileSplit, context);
    InputSplit[] wrappedSplits = new InputSplit[] { fileSplit };
    int inputIndex = 0;
    List<OperatorKey> targetOps = Arrays.asList(new OperatorKey("54321", 0));
    int splitIndex = 0;
    PigSplit split = new PigSplit(wrappedSplits, inputIndex, targetOps, splitIndex);
    split.setConf(HadoopCompat.getConfiguration(job));
    storage.prepareToRead(reader, split);

    // read tuples and validate
    validate(new LoadFuncTupleIterator(storage));
  }
View Full Code Here

Examples of org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.PigSplit

    LoadFunc loader = new LocationAsTuple();
    loader.setUDFContextSignature("foo");
    loader.setLocation("a\tb", job);

    RecordReader reader = EasyMock.createMock(RecordReader.class);
    PigSplit split = EasyMock.createMock(PigSplit.class);
    EasyMock.expect(split.getConf()).andStubReturn(conf);
    loader.prepareToRead(reader, split);
    Tuple next = loader.getNext();
    assertEquals("a", next.get(0));
    assertEquals("b", next.get(1));
View Full Code Here

Examples of org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.PigSplit

    LoadFunc loader = new LocationAsTuple(",");
    loader.setUDFContextSignature("foo");
    loader.setLocation("a,b\tc", job);

    RecordReader reader = EasyMock.createMock(RecordReader.class);
    PigSplit split = EasyMock.createMock(PigSplit.class);
    EasyMock.expect(split.getConf()).andStubReturn(conf);
    loader.prepareToRead(reader, split);
    Tuple next = loader.getNext();
    assertEquals("a", next.get(0));
    assertEquals("b\tc", next.get(1));
View Full Code Here

Examples of org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.PigSplit

    reader.initialize(fileSplit, context);
    final InputSplit[] wrappedSplits = new InputSplit[] { fileSplit };
    final int inputIndex = 0;
    final List<OperatorKey> targetOps = Arrays.asList(new OperatorKey("54321", 0));
    final int splitIndex = 0;
    final PigSplit split = new PigSplit(wrappedSplits, inputIndex, targetOps, splitIndex);
    split.setConf(HadoopCompat.getConfiguration(job));
    loader.prepareToRead(reader, split);

    // read tuples and validate
    validate(new LoadFuncTupleIterator(loader));
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.