@Override
    public TTableDescriptor toThrift(List<DescriptorTable.ReferencedPartitionInfo> partitions) {
        TPaimonTable tPaimonTable = new TPaimonTable();
        String encodedTable = PaimonScanNode.encodeObjectToString(paimonNativeTable);
        tPaimonTable.setPaimon_native_table(encodedTable);
        tPaimonTable.setTime_zone(TimeUtils.getSessionTimeZone());
        TTableDescriptor tTableDescriptor = new TTableDescriptor(id, TTableType.PAIMON_TABLE,
                fullSchema.size(), 0, tableName, databaseName);
        tTableDescriptor.setPaimonTable(tPaimonTable);
        return tTableDescriptor;
    }
@Test
    public void testToThrift(@Mocked FileStoreTable paimonNativeTable) {
        RowType rowType =
                RowType.builder().field("a", DataTypes.INT()).field("b", DataTypes.INT()).field("c", DataTypes.INT())
                        .build();
        List<DataField> fields = rowType.getFields();
        List<Column> fullSchema = new ArrayList<>(fields.size());
        ArrayList<String> partitions = Lists.newArrayList("b", "c");
        new Expectations() {
            {
                paimonNativeTable.rowType();
                result = rowType;
                paimonNativeTable.partitionKeys();
                result = partitions;
            }
        };
        String dbName = "testDB";
        String tableName = "testTable";
        PaimonTable paimonTable = new PaimonTable("testCatalog", dbName, tableName, fullSchema,
                paimonNativeTable, 100L);

        TTableDescriptor tTableDescriptor = paimonTable.toThrift(null);
        Assert.assertEquals(tTableDescriptor.getDbName(), dbName);
        Assert.assertEquals(tTableDescriptor.getTableName(), tableName);
    }