我已经确定如何使用spark-shell来显示字段名称,但是它很丑陋并且不包括类型
val sqlContext = new org.apache.spark.sql.SQLContext(sc)
println(sqlContext.parquetFile(path))
打印:
ParquetTableScan [cust_id#114,blar_field#115,blar_field2#116], (ParquetRelation /blar/blar), None
最佳答案
您应该可以执行以下操作:
sqlContext.read.parquet(path).printSchema()
从Spark docs:
// Print the schema in a tree format
df.printSchema()
// root
// |-- age: long (nullable = true)
// |-- name: string (nullable = true)
关于scala - 如何从命令行或Spark Shell中显示 Parquet 文件的方案(包括类型)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28904856/