我有大约300个变量,我正试图通过csv传递customschema。 下面是我正在使用的示例代码。 但是,在通过csv文件上载架构时…输出不包含列列表:
Output : StructType(List(StructField(StructType([,StringType,true)))
CSV格式的代码:
schema = StructType([ \
StructField("COl1",StringType(),True), \
StructField("COL2",DecimalType(20,10),True), \
StructField("COL3",DecimalType(20,10),True)
])
# reading schema
sch_df = spark.read.option("header", "true").csv("schema.csv").schema
# Passing schema
df = spark.read.schema(sch_df).option("header", "true").csv("/sample.csv")
您能否立即提供通过csv文件上传模式的权限
目前没有回答
相关问题 更多 >
编程相关推荐