diff --git a/core/src/main/java/com/datastrato/gravitino/catalog/CatalogOperationDispatcher.java b/core/src/main/java/com/datastrato/gravitino/catalog/CatalogOperationDispatcher.java index 3510d19e298..6e7928230bd 100644 --- a/core/src/main/java/com/datastrato/gravitino/catalog/CatalogOperationDispatcher.java +++ b/core/src/main/java/com/datastrato/gravitino/catalog/CatalogOperationDispatcher.java @@ -398,7 +398,7 @@ public Table loadTable(NameIdentifier ident) throws NoSuchTableException { .withHiddenPropertiesSet( getHiddenPropertyNames( catalogIdentifier, - HasPropertyMetadata::filesetPropertiesMetadata, + HasPropertyMetadata::tablePropertiesMetadata, table.properties())); } @@ -667,7 +667,9 @@ public Fileset loadFileset(NameIdentifier ident) throws NoSuchFilesetException { return EntityCombinedFileset.of(fileset) .withHiddenPropertiesSet( getHiddenPropertyNames( - catalogIdent, HasPropertyMetadata::tablePropertiesMetadata, fileset.properties())); + catalogIdent, + HasPropertyMetadata::filesetPropertiesMetadata, + fileset.properties())); } @Override @@ -705,7 +707,7 @@ public Fileset createFileset( .withHiddenPropertiesSet( getHiddenPropertyNames( catalogIdent, - HasPropertyMetadata::tablePropertiesMetadata, + HasPropertyMetadata::filesetPropertiesMetadata, createdFileset.properties())); } @@ -725,7 +727,7 @@ public Fileset alterFileset(NameIdentifier ident, FilesetChange... changes) .withHiddenPropertiesSet( getHiddenPropertyNames( catalogIdent, - HasPropertyMetadata::tablePropertiesMetadata, + HasPropertyMetadata::filesetPropertiesMetadata, alteredFileset.properties())); } diff --git a/core/src/test/java/com/datastrato/gravitino/TestCatalogOperations.java b/core/src/test/java/com/datastrato/gravitino/TestCatalogOperations.java index 2dbcd1c7958..8c828786805 100644 --- a/core/src/test/java/com/datastrato/gravitino/TestCatalogOperations.java +++ b/core/src/test/java/com/datastrato/gravitino/TestCatalogOperations.java @@ -63,7 +63,7 @@ public TestCatalogOperations(Map config) { filesets = Maps.newHashMap(); tablePropertiesMetadata = new TestBasePropertiesMetadata(); schemaPropertiesMetadata = new TestBasePropertiesMetadata(); - filesetPropertiesMetadata = new TestBasePropertiesMetadata(); + filesetPropertiesMetadata = new TestFilesetPropertiesMetadata(); this.config = config; } diff --git a/core/src/test/java/com/datastrato/gravitino/TestFilesetPropertiesMetadata.java b/core/src/test/java/com/datastrato/gravitino/TestFilesetPropertiesMetadata.java new file mode 100644 index 00000000000..73a9f600caf --- /dev/null +++ b/core/src/test/java/com/datastrato/gravitino/TestFilesetPropertiesMetadata.java @@ -0,0 +1,42 @@ +/* + * Copyright 2024 Datastrato Pvt Ltd. + * This software is licensed under the Apache License version 2. + */ +package com.datastrato.gravitino; + +import com.datastrato.gravitino.catalog.PropertyEntry; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.Maps; +import java.util.List; +import java.util.Map; + +public class TestFilesetPropertiesMetadata extends TestBasePropertiesMetadata { + + public static final String TEST_FILESET_HIDDEN_KEY = "fileset_key"; + + private static final Map> TEST_FILESET_PROPERTY; + + static { + List> tablePropertyMetadata = + ImmutableList.of( + PropertyEntry.stringPropertyEntry( + TEST_FILESET_HIDDEN_KEY, + "test fileset required k1 property", + false, + false, + "test", + true, + false)); + + TEST_FILESET_PROPERTY = Maps.uniqueIndex(tablePropertyMetadata, PropertyEntry::getName); + } + + @Override + protected Map> specificPropertyEntries() { + return ImmutableMap.>builder() + .putAll(super.specificPropertyEntries()) + .putAll(TEST_FILESET_PROPERTY) + .build(); + } +} diff --git a/core/src/test/java/com/datastrato/gravitino/catalog/TestCatalogOperationDispatcher.java b/core/src/test/java/com/datastrato/gravitino/catalog/TestCatalogOperationDispatcher.java index 63f36e3a1bf..16e9ad99b93 100644 --- a/core/src/test/java/com/datastrato/gravitino/catalog/TestCatalogOperationDispatcher.java +++ b/core/src/test/java/com/datastrato/gravitino/catalog/TestCatalogOperationDispatcher.java @@ -8,6 +8,7 @@ import static com.datastrato.gravitino.Entity.EntityType.TABLE; import static com.datastrato.gravitino.StringIdentifier.ID_KEY; import static com.datastrato.gravitino.TestBasePropertiesMetadata.COMMENT_KEY; +import static com.datastrato.gravitino.TestFilesetPropertiesMetadata.TEST_FILESET_HIDDEN_KEY; import static com.datastrato.gravitino.catalog.BasePropertiesMetadata.GRAVITINO_MANAGED_ENTITY; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertThrows; @@ -678,6 +679,7 @@ private void testProperties(Map expectedProps, Map