Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[UT] refactor ut of paimon metadata #30552

Merged
merged 1 commit into from
Sep 8, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
[UT] refactor ut of paimon metadata
Signed-off-by: miomiocat <284487410@qq.com>
  • Loading branch information
miomiocat committed Sep 8, 2023
commit 441013ea7cbb56982d0f5ec5b5687f9009f84b16
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import org.apache.paimon.types.DataField;
import org.apache.paimon.types.DataType;
import org.apache.paimon.types.DateType;
import org.apache.paimon.types.DoubleType;
import org.apache.paimon.types.IntType;
import org.apache.paimon.types.RowType;
import org.junit.Assert;
Expand Down Expand Up @@ -91,7 +92,8 @@ public void setUp() {
@Test
public void testGetTable(@Mocked AbstractFileStoreTable paimonNativeTable) throws Catalog.TableNotExistException {
List<DataField> fields = new ArrayList<>();
fields.add(new DataField(1, "col2", new IntType()));
fields.add(new DataField(1, "col2", new IntType(true)));
fields.add(new DataField(2, "col3", new DoubleType(false)));
new Expectations() {
{
paimonNativeCatalog.getTable((Identifier) any);
Expand All @@ -111,7 +113,11 @@ public void testGetTable(@Mocked AbstractFileStoreTable paimonNativeTable) throw
Assert.assertEquals(Lists.newArrayList("col1"), paimonTable.getPartitionColumnNames());
Assert.assertEquals("hdfs://127.0.0.1:10000/paimon", paimonTable.getTableLocation());
Assert.assertEquals(ScalarType.INT, paimonTable.getBaseSchema().get(0).getType());
Assert.assertTrue(paimonTable.getBaseSchema().get(0).isAllowNull());
Assert.assertEquals(ScalarType.DOUBLE, paimonTable.getBaseSchema().get(1).getType());
Assert.assertFalse(paimonTable.getBaseSchema().get(1).isAllowNull());
Assert.assertEquals("paimon_catalog", paimonTable.getCatalogName());
Assert.assertEquals("paimon_catalog.db1.tbl1", paimonTable.getUUID());
}

@Test
Expand Down Expand Up @@ -169,13 +175,6 @@ public void testGetRemoteFileInfos(@Mocked AbstractFileStoreTable paimonNativeTa
Assert.assertEquals(2, result.get(0).getFiles().get(0).getPaimonSplitsInfo().getPaimonSplits().size());
}

@Test
public void testUUID(@Mocked AbstractFileStoreTable paimonNativeTable,
@Mocked ReadBuilder readBuilder) {
PaimonTable paimonTable = (PaimonTable) metadata.getTable("db1", "tbl1");
Assert.assertTrue(paimonTable.getUUID().startsWith("paimon_catalog.db1.tbl1"));
}

@Test
public void testGetCloudConfiguration() {
CloudConfiguration cc = metadata.getCloudConfiguration();
Expand Down