Hi, I am generating schema programatically as show below val schemaFile = sc.textFile("/TestDivya/Spark/cars.csv") val schemaString = schemaFile.first() val schema = StructType(Array( schemaString.split(" ").map(fieldName => StructField(fieldName, StringType(), true))))
I want to change the datatype of year column to int and for many other columns as my schemaString is huge with more than 100+ columns any suggestions? Thanks, Divya