public static LogicalType deriveLogicalType(FormatInfo formatInfo) {
        if (formatInfo instanceof StringFormatInfo) {
            return new VarCharType(VarCharType.MAX_LENGTH);
        } else if (formatInfo instanceof VarCharFormatInfo) {
            return new VarCharType(((VarCharFormatInfo) formatInfo).getLength());
        } else if (formatInfo instanceof BooleanFormatInfo) {
            return new BooleanType();
        } else if (formatInfo instanceof ByteFormatInfo) {
            return new TinyIntType();
        } else if (formatInfo instanceof ShortFormatInfo) {
            return new SmallIntType();
        } else if (formatInfo instanceof IntFormatInfo) {
            return new IntType();
        } else if (formatInfo instanceof LongFormatInfo) {
            return new BigIntType();
        } else if (formatInfo instanceof FloatFormatInfo) {
            return new FloatType();
        } else if (formatInfo instanceof DoubleFormatInfo) {
            return new DoubleType();
        } else if (formatInfo instanceof DecimalFormatInfo) {
            DecimalFormatInfo decimalFormatInfo = (DecimalFormatInfo) formatInfo;
            return new DecimalType(decimalFormatInfo.getPrecision(), decimalFormatInfo.getScale());
        } else if (formatInfo instanceof TimeFormatInfo) {
            return new TimeType(((TimeFormatInfo) formatInfo).getPrecision());
        } else if (formatInfo instanceof DateFormatInfo) {
            return new DateType();
        } else if (formatInfo instanceof TimestampFormatInfo) {
            return new TimestampType(((TimestampFormatInfo) formatInfo).getPrecision());
        } else if (formatInfo instanceof LocalZonedTimestampFormatInfo) {
            return new LocalZonedTimestampType(((LocalZonedTimestampFormatInfo) formatInfo).getPrecision());
        } else if (formatInfo instanceof ArrayFormatInfo) {
            FormatInfo elementFormatInfo = ((ArrayFormatInfo) formatInfo).getElementFormatInfo();
            return new ArrayType(deriveLogicalType(elementFormatInfo));
        } else if (formatInfo instanceof MapFormatInfo) {
            MapFormatInfo mapFormatInfo = (MapFormatInfo) formatInfo;
            FormatInfo keyFormatInfo = mapFormatInfo.getKeyFormatInfo();
            FormatInfo valueFormatInfo = mapFormatInfo.getValueFormatInfo();
            return new MapType(deriveLogicalType(keyFormatInfo), deriveLogicalType(valueFormatInfo));
        } else if (formatInfo instanceof RowFormatInfo) {
            RowFormatInfo rowFormatInfo = (RowFormatInfo) formatInfo;
            FormatInfo[] formatInfos = rowFormatInfo.getFieldFormatInfos();
            int formatInfosSize = formatInfos.length;
            LogicalType[] logicalTypes = new LogicalType[formatInfosSize];

            for (int i = 0; i < formatInfosSize; ++i) {
                logicalTypes[i] = deriveLogicalType(formatInfos[i]);
            }
            return RowType.of(logicalTypes, rowFormatInfo.getFieldNames());
        } else if (formatInfo instanceof BinaryFormatInfo) {
            BinaryFormatInfo binaryFormatInfo = (BinaryFormatInfo) formatInfo;
            return new BinaryType(binaryFormatInfo.getLength());
        } else if (formatInfo instanceof VarBinaryFormatInfo) {
            VarBinaryFormatInfo varBinaryFormatInfo = (VarBinaryFormatInfo) formatInfo;
            return new VarBinaryType(varBinaryFormatInfo.getLength());
        } else if (formatInfo instanceof NullFormatInfo) {
            return new NullType();
        } else {
            throw new IllegalArgumentException(String.format("not found formatInfo %s",
                    formatInfo == null ? "null" : formatInfo.toString()));
        }
    }
Derive the LogicalType for the given FormatInfo.
inlong-sort/sort-formats/format-common/src/main/java/org/apache/inlong/sort/formats/base/TableFormatUtils.java