return new StorageDescriptorKey(tablePath, input.getSd()); return new StorageDescriptorKey(input.getSd()); });
/** * Two empty StorageDescriptorKey should be equal. */ @Test public void testCompareNullSdKey() { assertThat(MetaStoreServerUtils.StorageDescriptorKey.UNSET_KEY, is(new MetaStoreServerUtils.StorageDescriptorKey())); }
/** * Two StorageDescriptorKey objects with null storage descriptors should be * equal iff the base location is equal. */ @Test public void testCompareNullSd() { assertThat(new MetaStoreServerUtils.StorageDescriptorKey("a", null), is(new MetaStoreServerUtils.StorageDescriptorKey("a", null))); // Different locations produce different objects assertThat(new MetaStoreServerUtils.StorageDescriptorKey("a", null), IsNot.not(equalTo(new MetaStoreServerUtils.StorageDescriptorKey("b", null)))); }
.addValue("val1") .build(null); assertThat(new MetaStoreServerUtils.StorageDescriptorKey("a", p1.getSd()), IsNot.not(new MetaStoreServerUtils.StorageDescriptorKey("a", p2.getSd()))); assertThat(new MetaStoreServerUtils.StorageDescriptorKey("a", p1.getSd()), is(new MetaStoreServerUtils.StorageDescriptorKey("a", p3.getSd())));
.setInputFormat("foo") .build(null); assertThat(new MetaStoreServerUtils.StorageDescriptorKey("a", p1.getSd()), IsNot.not(new MetaStoreServerUtils.StorageDescriptorKey("a", p2.getSd()))); assertThat(new MetaStoreServerUtils.StorageDescriptorKey("a", p1.getSd()), is(new MetaStoreServerUtils.StorageDescriptorKey("a", p3.getSd())));
.addValue("val1") .build(null); assertThat(new MetaStoreServerUtils.StorageDescriptorKey("a", p1.getSd()), IsNot.not(new MetaStoreServerUtils.StorageDescriptorKey("a", p2.getSd()))); assertThat(new MetaStoreServerUtils.StorageDescriptorKey("a", p1.getSd()), is(new MetaStoreServerUtils.StorageDescriptorKey("a", p3.getSd())));
/** * Two StorageDescriptorKey objects with the same base location but different * SD location should be equal */ @Test public void testCompareWithSdSamePrefixDifferentLocation() throws MetaException { Partition p1 = new PartitionBuilder() .setDbName("DB_NAME") .setTableName(TABLE_NAME) .setLocation("l1") .addCol("a", "int") .addValue("val1") .build(null); Partition p2 = new PartitionBuilder() .setDbName("DB_NAME") .setTableName(TABLE_NAME) .setLocation("l2") .addCol("a", "int") .addValue("val1") .build(null); assertThat(new MetaStoreServerUtils.StorageDescriptorKey("a", p1.getSd()), is(new MetaStoreServerUtils.StorageDescriptorKey("a", p2.getSd()))); }