Package org.apache.flink.api.common.io.FileInputFormat

Examples of org.apache.flink.api.common.io.FileInputFormat.FileBaseStatistics


  public OptimizedPlan compileNoStats(Plan p) {
    return this.noStatsCompiler.compile(p);
  }
 
  public void setSourceStatistics(GenericDataSourceBase<?, ?> source, long size, float recordWidth) {
    setSourceStatistics(source, new FileBaseStatistics(Long.MAX_VALUE, size, recordWidth));
  }
View Full Code Here


      DummyFileInputFormat format = new DummyFileInputFormat();
      format.setFilePath(tempFile);
      format.configure(new Configuration());
     
     
      FileBaseStatistics stats = format.getStatistics(null);
      Assert.assertEquals("The file size from the statistics is wrong.", SIZE, stats.getTotalInputSize());
     
      format = new DummyFileInputFormat();
      format.setFilePath(tempFile);
      format.configure(new Configuration());
     
      FileBaseStatistics newStats = format.getStatistics(stats);
      Assert.assertTrue("Statistics object was changed", newStats == stats);

      // insert fake stats with the correct modification time. the call should return the fake stats
      format = new DummyFileInputFormat();
      format.setFilePath(tempFile);
      format.configure(new Configuration());
     
      FileBaseStatistics fakeStats = new FileBaseStatistics(stats.getLastModificationTime(), FAKE_SIZE, BaseStatistics.AVG_RECORD_BYTES_UNKNOWN);
      BaseStatistics latest = format.getStatistics(fakeStats);
      Assert.assertEquals("The file size from the statistics is wrong.", FAKE_SIZE, latest.getTotalInputSize());
     
      // insert fake stats with the expired modification time. the call should return new accurate stats
      format = new DummyFileInputFormat();
      format.setFilePath(tempFile);
      format.configure(new Configuration());
     
      FileBaseStatistics outDatedFakeStats = new FileBaseStatistics(stats.getLastModificationTime()-1, FAKE_SIZE, BaseStatistics.AVG_RECORD_BYTES_UNKNOWN);
      BaseStatistics reGathered = format.getStatistics(outDatedFakeStats);
      Assert.assertEquals("The file size from the statistics is wrong.", SIZE, reGathered.getTotalInputSize());
     
    } catch (Exception ex) {
      ex.printStackTrace();
View Full Code Here

     
      DummyFileInputFormat format = new DummyFileInputFormat();
      format.setFilePath(tempDir);
      format.configure(new Configuration());
     
      FileBaseStatistics stats = format.getStatistics(null);
      Assert.assertEquals("The file size from the statistics is wrong.", TOTAL, stats.getTotalInputSize());
     
      format = new DummyFileInputFormat();
      format.setFilePath(tempDir);
      format.configure(new Configuration());
     
      FileBaseStatistics newStats = format.getStatistics(stats);
      Assert.assertTrue("Statistics object was changed", newStats == stats);

      // insert fake stats with the correct modification time. the call should return the fake stats
      format = new DummyFileInputFormat();
      format.setFilePath(tempDir);
      format.configure(new Configuration());
     
      FileBaseStatistics fakeStats = new FileBaseStatistics(stats.getLastModificationTime(), FAKE_SIZE, BaseStatistics.AVG_RECORD_BYTES_UNKNOWN);
      BaseStatistics latest = format.getStatistics(fakeStats);
      Assert.assertEquals("The file size from the statistics is wrong.", FAKE_SIZE, latest.getTotalInputSize());
     
      // insert fake stats with the correct modification time. the call should return the fake stats
      format = new DummyFileInputFormat();
      format.setFilePath(tempDir);
      format.configure(new Configuration());
     
      FileBaseStatistics outDatedFakeStats = new FileBaseStatistics(stats.getLastModificationTime()-1, FAKE_SIZE, BaseStatistics.AVG_RECORD_BYTES_UNKNOWN);
      BaseStatistics reGathered = format.getStatistics(outDatedFakeStats);
      Assert.assertEquals("The file size from the statistics is wrong.", TOTAL, reGathered.getTotalInputSize());
     
    } catch (Exception ex) {
      ex.printStackTrace();
View Full Code Here

    // only gather base statistics for FileInputFormats
    if(!(mapredInputFormat instanceof FileInputFormat)) {
      return null;
    }
   
    final FileBaseStatistics cachedFileStats = (cachedStats != null && cachedStats instanceof FileBaseStatistics) ?
        (FileBaseStatistics) cachedStats : null;
   
    try {
      final org.apache.hadoop.fs.Path[] paths = FileInputFormat.getInputPaths(this.jobConf);
     
View Full Code Here

    // sanity check
    if (len <= 0) {
      len = BaseStatistics.SIZE_UNKNOWN;
    }
   
    return new FileBaseStatistics(latestModTime, len, BaseStatistics.AVG_RECORD_BYTES_UNKNOWN);
  }
View Full Code Here

      jobContext = HadoopUtils.instantiateJobContext(configuration, null);
    } catch (Exception e) {
      throw new RuntimeException(e);
    }
   
    final FileBaseStatistics cachedFileStats = (cachedStats != null && cachedStats instanceof FileBaseStatistics) ?
        (FileBaseStatistics) cachedStats : null;
       
        try {
          final org.apache.hadoop.fs.Path[] paths = FileInputFormat.getInputPaths(jobContext);
          return getFileStats(cachedFileStats, paths, new ArrayList<FileStatus>(1));
View Full Code Here

    // sanity check
    if (len <= 0) {
      len = BaseStatistics.SIZE_UNKNOWN;
    }
   
    return new FileBaseStatistics(latestModTime, len, BaseStatistics.AVG_RECORD_BYTES_UNKNOWN);
  }
View Full Code Here

  public OptimizedPlan compileNoStats(Plan p) {
    return this.noStatsCompiler.compile(p);
  }
 
  public void setSourceStatistics(GenericDataSourceBase<?, ?> source, long size, float recordWidth) {
    setSourceStatistics(source, new FileBaseStatistics(Long.MAX_VALUE, size, recordWidth));
  }
View Full Code Here

TOP

Related Classes of org.apache.flink.api.common.io.FileInputFormat.FileBaseStatistics

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.