@Test public void testContains() throws IOException { Config config1 = ConfigFactory.empty().withValue(DatasetDescriptorConfigKeys.PATH_KEY, ConfigValueFactory.fromAnyRef("/a/b/c/*")) .withValue(DatasetDescriptorConfigKeys.PLATFORM_KEY, ConfigValueFactory.fromAnyRef("hdfs")); FSDatasetDescriptor descriptor1 = new FSDatasetDescriptor(config1); Config config2 = ConfigFactory.empty().withValue(DatasetDescriptorConfigKeys.PATH_KEY, ConfigValueFactory.fromAnyRef("/a/b/c/d")) .withValue(DatasetDescriptorConfigKeys.PLATFORM_KEY, ConfigValueFactory.fromAnyRef("hdfs")) .withValue(DatasetDescriptorConfigKeys.FORMAT_KEY, ConfigValueFactory.fromAnyRef("avro")) .withValue(DatasetDescriptorConfigKeys.CODEC_KEY, ConfigValueFactory.fromAnyRef("gzip")); FSDatasetDescriptor descriptor2 = new FSDatasetDescriptor(config2); Assert.assertTrue(descriptor1.contains(descriptor2)); Config encConfig = ConfigFactory.empty().withValue(DatasetDescriptorConfigKeys.ENCRYPTION_LEVEL_KEY, ConfigValueFactory.fromAnyRef("file")) .withValue(DatasetDescriptorConfigKeys.ENCRYPTION_ALGORITHM_KEY, ConfigValueFactory.fromAnyRef("aes_rotating")) .atPath(DatasetDescriptorConfigKeys.ENCYPTION_PREFIX); Config config3 = config2.withFallback(encConfig); FSDatasetDescriptor descriptor3 = new FSDatasetDescriptor(config3); Assert.assertTrue(descriptor2.contains(descriptor3)); Assert.assertTrue(descriptor1.contains(descriptor3)); Config partitionConfig = ConfigFactory.empty().withValue(DatasetDescriptorConfigKeys.PARTITION_TYPE_KEY, ConfigValueFactory.fromAnyRef("datetime")) .withValue(DatasetDescriptorConfigKeys.PARTITION_PATTERN_KEY, ConfigValueFactory.fromAnyRef("yyyy/MM/dd")) .atPath(DatasetDescriptorConfigKeys.PARTITION_PREFIX); Config config4 = config3.withFallback(partitionConfig); FSDatasetDescriptor descriptor4 = new FSDatasetDescriptor(config4); Assert.assertTrue(descriptor3.contains(descriptor4)); Assert.assertTrue(descriptor2.contains(descriptor4)); Assert.assertTrue(descriptor1.contains(descriptor4)); Config miscConfig = ConfigFactory.empty().withValue(DatasetDescriptorConfigKeys.IS_COMPACTED_AND_DEDUPED_KEY, ConfigValueFactory.fromAnyRef("true")) .withValue(DatasetDescriptorConfigKeys.IS_RETENTION_APPLIED_KEY, ConfigValueFactory.fromAnyRef("true")); Config config5 = config4.withFallback(miscConfig); FSDatasetDescriptor descriptor5 = new FSDatasetDescriptor(config5); Assert.assertFalse(descriptor4.contains(descriptor5)); Assert.assertFalse(descriptor3.contains(descriptor5)); Assert.assertFalse(descriptor2.contains(descriptor5)); Assert.assertFalse(descriptor1.contains(descriptor5)); Config subPathConfig = ConfigFactory.empty().withValue(DatasetDescriptorConfigKeys.PATH_KEY, ConfigValueFactory.fromAnyRef("/a/b/c")) .withValue(DatasetDescriptorConfigKeys.SUBPATHS_KEY, ConfigValueFactory.fromAnyRef("{e,f,g}")) .withValue(DatasetDescriptorConfigKeys.PLATFORM_KEY, ConfigValueFactory.fromAnyRef("hdfs")); FSDatasetDescriptor descriptor6 = new FSDatasetDescriptor(subPathConfig); Assert.assertTrue(descriptor1.contains(descriptor6)); Assert.assertFalse(descriptor2.contains(descriptor6)); }
@Override public boolean contains(DatasetDescriptor o) { if (!super.contains(o)) { return false; } FSDatasetDescriptor other = (FSDatasetDescriptor) o; if ((this.isCompacted() != other.isCompacted()) || (this.isCompactedAndDeduped() != other.isCompactedAndDeduped())) { return false; } return this.getPartitionConfig().contains(other.getPartitionConfig()); }
FSDatasetDescriptor extends BaseDatasetDescriptor implements DatasetDescriptor { @Override public boolean contains(DatasetDescriptor o) { if (!super.contains(o)) { return false; } FSDatasetDescriptor other = (FSDatasetDescriptor) o; if ((this.isCompacted() != other.isCompacted()) || (this.isCompactedAndDeduped() != other.isCompactedAndDeduped())) { return false; } return this.getPartitionConfig().contains(other.getPartitionConfig()); } }
FSDatasetDescriptor extends BaseDatasetDescriptor implements DatasetDescriptor { @Override public boolean contains(DatasetDescriptor o) { if (!super.contains(o)) { return false; } FSDatasetDescriptor other = (FSDatasetDescriptor) o; if ((this.isCompacted() != other.isCompacted()) || (this.isCompactedAndDeduped() != other.isCompactedAndDeduped())) { return false; } return this.getPartitionConfig().contains(other.getPartitionConfig()); } FSDatasetDescriptor(Config config); }
FSDatasetDescriptor extends BaseDatasetDescriptor implements DatasetDescriptor { @Override public boolean contains(DatasetDescriptor o) { if (!super.contains(o)) { return false; } FSDatasetDescriptor other = (FSDatasetDescriptor) o; if ((this.isCompacted() != other.isCompacted()) || (this.isCompactedAndDeduped() != other.isCompactedAndDeduped())) { return false; } return this.getPartitionConfig().contains(other.getPartitionConfig()); } FSDatasetDescriptor(Config config); @Override boolean contains(DatasetDescriptor o); }
FSDatasetDescriptor extends BaseDatasetDescriptor implements DatasetDescriptor { @Override public boolean contains(DatasetDescriptor o) { if (!super.contains(o)) { return false; } FSDatasetDescriptor other = (FSDatasetDescriptor) o; if ((this.isCompacted() != other.isCompacted()) || (this.isCompactedAndDeduped() != other.isCompactedAndDeduped())) { return false; } return this.getPartitionConfig().contains(other.getPartitionConfig()); } FSDatasetDescriptor(Config config); @Override boolean contains(DatasetDescriptor o);  }