public static void checkSchema(Schema kuduTableSchema, String[] fieldNames, RowTypeInfo typeInfo) {
        List<ColumnSchema> kuduColumns = kuduTableSchema.getColumns();
        String actualTypes = kuduColumns.stream().map((ColumnSchema ti) -> {
            String fieldName = ti.getName();
            TypeInfo info = KUDU_TYPE_2_TYPE_INFO_MAP.get(ti.getType());
            if (info == null) {
                return fieldName + ":" + ti.getType().getName();
            } else {
                String simpleName = info.getClass().getSimpleName();
                return fieldName + ":" + simpleName.substring(0, simpleName.length() - 8);
            }
        }).collect(Collectors.joining(", ", "[", "]"));

        TypeInfo[] fieldTypeInfos = typeInfo.getFieldTypeInfos();
        String expectedTypes = IntStream.range(0, fieldTypeInfos.length).boxed().map(index -> {
            String simpleName = fieldTypeInfos[index].getClass().getSimpleName();
            String typeName = simpleName.substring(0, simpleName.length() - 8);
            String fieldName = fieldNames[index];
            return fieldName + ":" + typeName;
        }).collect(Collectors.joining(", ", "[", "]"));

        checkState(kuduColumns.size() == fieldTypeInfos.length,
                "The number of kudu fields mismatch, expected is %s, but actual is %s, "
                        + "\nexpect: %s,\nactual: %s.",
                kuduColumns.size(), fieldTypeInfos.length, expectedTypes, actualTypes);

        for (int i = 0; i < kuduColumns.size(); i++) {
            ColumnSchema columnSchema = kuduColumns.get(i);
            Type columnSchemaType = columnSchema.getType();
            TypeInfo actualTypeInfo = fieldTypeInfos[i];
            TypeInfo expectedTypeInfo = KUDU_TYPE_2_TYPE_INFO_MAP.get(columnSchemaType);

            checkState(Objects.equals(actualTypeInfo, expectedTypeInfo),
                    "The %sth field type mismatch, \nexpect: %s, \nactual: %s.",
                    i + 1, expectedTypes, actualTypes);
        }
    }
Check if types match.

@param kuduTableSchema the table schema of kudu.
@param fieldNames the name of field.
@param typeInfo the type of user settings.
inlong-sort/sort-flink/sort-flink-v1.13/sort-connectors/kudu/src/main/java/org/apache/inlong/sort/kudu/common/KuduUtils.java