Package org.apache.pig.impl.io

Examples of org.apache.pig.impl.io.BufferedPositionedInputStream


    } else {
      is = FileLocalizer.openDFSFile(keyDistFile);
    }
    BinStorage loader = new BinStorage();
    DataBag partitionList;
    loader.bindTo(keyDistFile, new BufferedPositionedInputStream(is), 0, Long.MAX_VALUE);
    Tuple t = loader.getNext();
    if(t==null) {
      throw new RuntimeException("Empty samples file");
    }
    // The keydist file is structured as (key, min, max)
View Full Code Here


       
        try{
            InputStream is = FileLocalizer.openDFSFile(quantilesFile,ConfigurationUtil.toProperties(job));
            BinStorage loader = new BinStorage();
            DataBag quantilesList;
            loader.bindTo(quantilesFile, new BufferedPositionedInputStream(is), 0, Long.MAX_VALUE);
            Tuple t = loader.getNext();
            if(t==null) throw new RuntimeException("Empty samples file");
            // the Quantiles file has a tuple as under:
            // (numQuantiles, bag of samples)
            // numQuantiles here is the reduce parallelism
View Full Code Here

        String filename = lFile.getFileName();
        loader = (LoadFunc)PigContext.instantiateFuncFromSpec(lFile.getFuncSpec());
       
        is = (this.offset == 0) ? FileLocalizer.open(filename, pc) : FileLocalizer.open(filename, this.offset,pc);
       
        loader.bindTo(filename , new BufferedPositionedInputStream(is), this.offset, Long.MAX_VALUE);
    }
View Full Code Here

            return null;
        }
       
        InputStream is = FileLocalizer.open(fileName, execType, storage);
      
        bindTo(fileName, new BufferedPositionedInputStream(is), 0, Long.MAX_VALUE);
        // get the first record from the input file
        // and figure out the schema from the data in
        // the first record
        Tuple t = getNext();
        is.close();
View Full Code Here

        loader = (LoadFunc)PigContext.instantiateFuncFromSpec(lFile.getFuncSpec());
        if (loader instanceof PigStorage)
            ((PigStorage)loader).setSignature(signature);
        is = (this.offset == 0) ? FileLocalizer.open(filename, pc) : FileLocalizer.open(filename, this.offset,pc);
       
        loader.bindTo(filename , new BufferedPositionedInputStream(is), this.offset, Long.MAX_VALUE);
    }
View Full Code Here

        PigMapReduce.sJobConf.set("pig.loader.signature", signature);
        rightLoader.initialize(PigMapReduce.sJobConf);
        // the main purpose of this bindTo call is supply the input file name
        // to the right loader - in the case of Pig's DefaultIndexableLoader
        // this is really not used since the index has all information required
        rightLoader.bindTo(rightInputFileName, new BufferedPositionedInputStream(is), 0, Long.MAX_VALUE);
        rightLoader.seekNear(
                firstLeftKey instanceof Tuple ? (Tuple)firstLeftKey : mTupleFactory.newTuple(firstLeftKey));
    }
View Full Code Here

    public void testPigLineRecordReader() {
        try {
            File testFile = File.createTempFile("testPigLineRecordReader", ".txt");
            LocalSeekableInputStream is = new LocalSeekableInputStream( testFile );
           
            BufferedPositionedInputStream bpis = new BufferedPositionedInputStream( is );
           
            PigLineRecordReader reader = new PigLineRecordReader( bpis, 0, Integer.MAX_VALUE );
           
            Field lineReader = reader.getClass().getDeclaredField("lineReader");
            lineReader.setAccessible(true);
View Full Code Here

            out.write(buffer, 0, buffer.length);
            out.close();
           
            LocalSeekableInputStream is = new LocalSeekableInputStream( testFile );
            CBZip2InputStream bzis = new CBZip2InputStream( is );
            BufferedPositionedInputStream bpis = new BufferedPositionedInputStream( bzis );
           
            PigLineRecordReader reader = new PigLineRecordReader( bpis, 0, 100 );

            Field lineReader = reader.getClass().getDeclaredField("lineReader");
            lineReader.setAccessible(true);
View Full Code Here

                ps.println( text );
            }
            ps.close();
           
            LocalSeekableInputStream is = new LocalSeekableInputStream( testFile );
            BufferedPositionedInputStream bpis = new BufferedPositionedInputStream( is );
            PigLineRecordReader reader = new PigLineRecordReader( bpis, 0, Integer.MAX_VALUE );
           
            Text value = new Text();
            int counter = 0;
            while( reader.next(value) ) {
View Full Code Here

            }
            ps.close();
           
            LocalSeekableInputStream is = new LocalSeekableInputStream( testFile );
            CBZip2InputStream bzis = new CBZip2InputStream( is );
            BufferedPositionedInputStream bpis = new BufferedPositionedInputStream( bzis );
            PigLineRecordReader reader = new PigLineRecordReader( bpis, 0, Integer.MAX_VALUE );
           
            Text value = new Text();
            int counter = 0;
            while( reader.next(value) ) {
View Full Code Here

TOP

Related Classes of org.apache.pig.impl.io.BufferedPositionedInputStream

Copyright © 2018 www.massapicom. 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.