Example usage for org.apache.hadoop.hdfs.protocol EncryptionZone equals

List of usage examples for org.apache.hadoop.hdfs.protocol EncryptionZone equals

Introduction

In this page you can find the example usage for org.apache.hadoop.hdfs.protocol EncryptionZone equals.

Prototype

@Override
    public boolean equals(Object obj) 

Source Link

Usage

From source file:org.apache.impala.common.FileSystemUtil.java

License:Apache License

/**
 * Returns true if path p1 and path p2 are in the same encryption zone in HDFS.
 * Returns false if they are in different encryption zones or if either of the paths
 * are not on HDFS./*from w  w w. j  a v  a 2s  . c  om*/
 */
private static boolean arePathsInSameHdfsEncryptionZone(FileSystem fs, Path p1, Path p2) throws IOException {
    // Only distributed file systems have encryption zones.
    if (!isDistributedFileSystem(p1) || !isDistributedFileSystem(p2))
        return false;
    HdfsAdmin hdfsAdmin = new HdfsAdmin(fs.getUri(), CONF);
    EncryptionZone z1 = hdfsAdmin.getEncryptionZoneForPath(p1);
    EncryptionZone z2 = hdfsAdmin.getEncryptionZoneForPath(p2);
    if (z1 == null && z2 == null)
        return true;
    if (z1 == null || z2 == null)
        return false;
    return z1.equals(z2);
}