Please use the code attached below for your reference:
To save the parquet file:
sqlContext.sql("SET hive.exec.dynamic.partition.mode= nonstrict")
sqlContext.sql("SET hive.exec.dynamic.partition = true")
sel.write.format("parquet").save("custResult.parquet")
Then you can use the command:
sqlContext.sql("CREATE EXTERNAL TABLE nedw_11 (code string,name string,quantity int, price float) PARTITIONED BY (`productID` int) STORED AS parquet LOCATION "/user/edureka_431591/'custResult.parquet'")
To know more, It's recommended to join Big Data Certification today.