How to pass a list of paths to spark.read.load?

前端 未结 4 1566
梦如初夏
梦如初夏 2021-01-06 09:31

I can load multiple files at once by passing multiple paths to the load method, e.g.

spark.read
  .format(\"com.databricks.spark.avro\")
  .load         


        
4条回答
  •  野趣味
    野趣味 (楼主)
    2021-01-06 10:15

    load method support varargs type of argument, not the list type. So you have explicitly convert list to varargs adding : _* in load function.

    spark.read.format("com.databricks.spark.avro").load(paths: _*)
    

提交回复
热议问题