protected TableSchema buildTableSchema(String[] fieldNames, TypeInformation<?>[] fieldTypes) {
        Preconditions.checkArgument(fieldNames.length == fieldTypes.length, "fieldNames length must equals fieldTypes length !");

        DataType[] dataTypes = IntStream.range(0, fieldTypes.length)
                .mapToObj(i -> fromLegacyInfoToDataType(fieldTypes[i]))
                .toArray(DataType[]::new);

        TableSchema tableSchema = TableSchema.builder()
                .fields(fieldNames, dataTypes)
                .build();
        return tableSchema;
    }
Date: 2020/3/30
Company: www.dtstack.com
@author maqi
kafka-base/kafka-base-sink/src/main/java/com/dtstack/flink/sql/sink/kafka/AbstractKafkaSink.java