来自 SchemaRDD 的模式?

Schema from SchemaRDD?

给定一个 SchemaRDD (loaded using SQLContext.parquetFile),我如何提取它的 metadata/schema/list 列?

可以通过 SchemaRDD 作为 [rdd].schema.fields.

访问字段列表
lazy val schema: StructType
         Returns the schema of this SchemaRDD (represented by a StructType).

SchemaRDD下还有一个printSchema()方法,见SchemaRDD