使用pySpark将hdfs中的零件文件读取到数据帧中
我有多个文件存储在hdfs位置,如下所示 /用户/项目/202005/part-01798 /用户/项目/202005/part-01799 有2000个这样的零件文件。每个文件的格式都相同使用pySpark将hdfs中的零件文件读取到数据帧中,pyspark,apache-spark-sql,hdfs,partitioning,Pyspark,Apache Spark Sql,Hdfs,Partitioning,我有多个文件存储在hdfs位置,如下所示 /用户/项目/202005/part-01798 /用户/项目/202005/part-01799 有2000个这样的零件文件。每个文件的格式都相同 {'Name':'abc','Age':28,'Marks':[20,25,30]} {'Name':...} 等等。我有两个问题 1) How to check whether these are multiple files or multiple partitions of the same f
{'Name':'abc','Age':28,'Marks':[20,25,30]}
{'Name':...}
等等。我有两个问题
1) How to check whether these are multiple files or multiple partitions of the same file
2) How to read these in a data frame using pyspark
spark.read.json
帮了我的忙。但谢谢你给我指出了正确的方向,并澄清了第一个问题
df = spark.read.csv('/user/project/202005/*',header=True, inferSchema=True)