public static StructType fromAttributes(List<? extends Attribute> attributes) {
        return new StructType(attributes.stream().map(a -> new StructField(a.name(), a.dataType())).collect(Collectors.toList()));
    }
Returns all field names in an array.
indexr-query-opt/src/main/java/org/apache/spark/sql/types/StructType.java