Example usage for org.apache.hadoop.fs LocalFileSystem setVerifyChecksum

List of usage examples for org.apache.hadoop.fs LocalFileSystem setVerifyChecksum

Introduction

In this page you can find the example usage for org.apache.hadoop.fs LocalFileSystem setVerifyChecksum.

Prototype

@Override
public void setVerifyChecksum(boolean verifyChecksum) 

Source Link

Document

Set whether to verify checksum.

Usage

From source file:com.uber.hoodie.TestConsistencyGuard.java

License:Apache License

@Before
public void setup() throws IOException {
    TemporaryFolder testFolder = new TemporaryFolder();
    testFolder.create();/*from w w w . j  a va2s  . com*/
    basePath = testFolder.getRoot().getAbsolutePath();
    fs = FSUtils.getFs(basePath, new Configuration());
    if (fs instanceof LocalFileSystem) {
        LocalFileSystem lfs = (LocalFileSystem) fs;
        // With LocalFileSystem, with checksum disabled, fs.open() returns an inputStream which is FSInputStream
        // This causes ClassCastExceptions in LogRecordScanner (and potentially other places) calling fs.open
        // So, for the tests, we enforce checksum verification to circumvent the problem
        lfs.setVerifyChecksum(true);
    }
}

From source file:com.uber.hoodie.TestHoodieClientBase.java

License:Apache License

@Before
public void init() throws IOException {
    // Initialize a local spark env
    jsc = new JavaSparkContext(HoodieClientTestUtils.getSparkConfForTest("TestHoodieClient"));
    jsc.setLogLevel("ERROR");

    //SQLContext stuff
    sqlContext = new SQLContext(jsc);

    folder = new TemporaryFolder();
    folder.create();//from w ww .  j a  v  a 2s  .c o  m
    basePath = folder.getRoot().getAbsolutePath();

    fs = FSUtils.getFs(basePath, jsc.hadoopConfiguration());
    if (fs instanceof LocalFileSystem) {
        LocalFileSystem lfs = (LocalFileSystem) fs;
        // With LocalFileSystem, with checksum disabled, fs.open() returns an inputStream which is FSInputStream
        // This causes ClassCastExceptions in LogRecordScanner (and potentially other places) calling fs.open
        // So, for the tests, we enforce checksum verification to circumvent the problem
        lfs.setVerifyChecksum(true);
    }
    HoodieTestUtils.initTableType(jsc.hadoopConfiguration(), basePath, getTableType());
    dataGen = new HoodieTestDataGenerator();
}