static org.apache.paimon.types.DataType visit(DataType type, SparkToPaimonTypeVisitor visitor) {
      if (type instanceof StructType) {
        StructField[] fields = ((StructType) type).fields();
        List<org.apache.paimon.types.DataType> fieldResults = new ArrayList<>(fields.length);

        for (StructField field : fields) {
          fieldResults.add(visit(field.dataType(), visitor));
        }

        return visitor.struct((StructType) type, fieldResults);
      } else if (type instanceof org.apache.spark.sql.types.MapType) {
        return visitor.map(
            (org.apache.spark.sql.types.MapType) type,
            visit(((org.apache.spark.sql.types.MapType) type).keyType(), visitor),
            visit(((org.apache.spark.sql.types.MapType) type).valueType(), visitor));
      } else if (type instanceof org.apache.spark.sql.types.ArrayType) {
        return visitor.array(
            (org.apache.spark.sql.types.ArrayType) type,
            visit(((org.apache.spark.sql.types.ArrayType) type).elementType(), visitor));
      } else if (type instanceof UserDefinedType) {
        throw new UnsupportedOperationException("User-defined types are not supported");
      } else {
        return visitor.atomic(type);
      }
    }
For simplicity, as a temporary solution, we directly convert the non-null attribute to
nullable on the Spark side.
amoro-format-paimon/src/main/java/org/apache/amoro/formats/paimon/PaimonTypeToSparkType.java