@Override
    public TTableDescriptor toThrift(List<DescriptorTable.ReferencedPartitionInfo> partitions) {
        TFileTable tFileTable = new TFileTable();
        tFileTable.setLocation(getTableLocation());

        List<TColumn> tColumns = Lists.newArrayList();

        for (Column column : getBaseSchema()) {
            tColumns.add(column.toThrift());
        }
        tFileTable.setColumns(tColumns);

        TTableDescriptor tTableDescriptor = new TTableDescriptor(id, TTableType.FILE_TABLE, fullSchema.size(),
                0, "", "");
        tTableDescriptor.setFileTable(tFileTable);

        HiveStorageFormat storageFormat = HiveStorageFormat.get(fileProperties.get(JSON_KEY_FORMAT));
        tFileTable.setSerde_lib(storageFormat.getSerde());
        tFileTable.setInput_format(storageFormat.getInputFormat());

        String columnNames = fullSchema.stream().map(Column::getName).collect(Collectors.joining(","));
        //when create table with string type, sr will change string to varchar(65533) in parser, but hive need string.
        // we have no choice but to transfer varchar(65533) into string explicitly in external table for avro/rcfile/sequence
        String columnTypes = fullSchema.stream().map(Column::getType).map(ColumnTypeConverter::toHiveType)
                .map(type -> type.replace("varchar(65533)", "string"))
                .collect(Collectors.joining("#"));

        tFileTable.setHive_column_names(columnNames);
        tFileTable.setHive_column_types(columnTypes);
        tFileTable.setTime_zone(TimeUtils.getSessionTimeZone());

        return tTableDescriptor;
    }
@Test
    public void testCreateTextExternalTableFormat() throws Exception {
        String createTableSql =
                "create external table if not exists db.file_tbl (col1 int, col2 int, col3 string) engine=file properties " +
                        "(\"path\"=\"hdfs://127.0.0.1:10000/hive/\", \"format\"=\"avro\")";
        CreateTableStmt
                createTableStmt = (CreateTableStmt) UtFrameUtils.parseStmtWithNewParser(createTableSql, connectContext);
        com.starrocks.catalog.Table table = createTable(createTableStmt);

        Assert.assertTrue(table instanceof FileTable);
        FileTable fileTable = (FileTable) table;
        List<DescriptorTable.ReferencedPartitionInfo> partitions = new ArrayList<>();
        TTableDescriptor tTableDescriptor = fileTable.toThrift(partitions);

        Assert.assertEquals(tTableDescriptor.getFileTable().getInput_format(),
                HiveStorageFormat.get("avro").getInputFormat());
        Assert.assertEquals(tTableDescriptor.getFileTable().getSerde_lib(), HiveStorageFormat.get("avro").getSerde());
        Assert.assertEquals(tTableDescriptor.getFileTable().getHive_column_names(), "col1,col2,col3");
        Assert.assertEquals(tTableDescriptor.getFileTable().getHive_column_types(), "int#int#string");
    }