I am having trouble reading csv using spark.read.csv - I am not sure what wrong with this particular location I am getting null pointer exceptions error. When I read other csv files it looks fine . Anyone faced similar issues . Please let me know
[]$ hdfs dfs -ls /hdfsData/bdipoc/poc/Inbound/tmp/.TEST/23329_20210430_162409/src_copy_file.file
Found 3 items
-rw-r--r-- 3 qweqweqw hadoop 0 2021-04-30 16:24 /hdfsData/poc/Inbound/tmp/.TEST/23329_20210430_162409/src_copy_file.file/_SUCCESS
-rw-r--r-- 3 qweqweqw hadoop 10091562 2021-04-30 16:24 /hdfsData/poc/qweqweqw/tmp/.TEST/23329_20210430_162409/src_copy_file.file/part-00000-4a4cd500-4e34-4403-a75f-61e09210f9ee-c000.csv
-rw-r--r-- 3 qweqweqw hadoop 11237536 2021-04-30 16:24 /hdfsData/poc/Inbound/tmp/.TEST/23329_20210430_162409/src_copy_file.file/part-00000-ee9ad347-14ef-42a6-ab20-3ac329b9ce71-c000.csv
$ pyspark
Python 2.7.5 (default, Aug 13 2020, 02:51:10)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-39)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
Setting default log level to "WARN".
To adjust logging level use sc.setLogLevel(newLevel). For SparkR, use setLogLevel(newLevel).
21/05/03 12:43:40 WARN Utils: Service 'SparkUI' could not bind on port 4040. Attempting port 4041.
21/05/03 12:43:40 WARN Utils: Service 'SparkUI' could not bind on port 4041. Attempting port 4042.
21/05/03 12:43:40 WARN Utils: Service 'SparkUI' could not bind on port 4042. Attempting port 4043.
Welcome to
____ __
/ __/__ ___ _____/ /__
_\ \/ _ \/ _ `/ __/ '_/
/__ / .__/\_,_/_/ /_/\_\ version 2.3.2.3.1.5.0-152
/_/
Using Python version 2.7.5 (default, Aug 13 2020 02:51:10)
SparkSession available as 'spark'.
>>> spark.read.csv("/hdfsData/bdipoc/poc/Inbound/tmp/.TEST/23329_20210430_162409/src_copy_file.file/*.csv")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/hdp/current/spark2-client/python/pyspark/sql/readwriter.py", line 441, in csv
return self._df(self._jreader.csv(self._spark._sc._jvm.PythonUtils.toSeq(path)))
File "/usr/hdp/current/spark2-client/python/lib/py4j-0.10.7-src.zip/py4j/java_gateway.py", line 1257, in __call__
File "/usr/hdp/current/spark2-client/python/pyspark/sql/utils.py", line 63, in deco
return f(*a, **kw)
File "/usr/hdp/current/spark2-client/python/lib/py4j-0.10.7-src.zip/py4j/protocol.py", line 328, in get_return_value
py4j.protocol.Py4JJavaError: An error occurred while calling o132.csv.
: java.lang.NullPointerException
at scala.collection.mutable.ArrayOps$ofRef$.length$extension(ArrayOps.scala:192)
at scala.collection.mutable.ArrayOps$ofRef.length(ArrayOps.scala:192)
at scala.collection.IndexedSeqOptimized$class.zipWithIndex(IndexedSeqOptimized.scala:99)
at scala.collection.mutable.ArrayOps$ofRef.zipWithIndex(ArrayOps.scala:186)
at org.apache.spark.sql.execution.datasources.csv.CSVDataSource.makeSafeHeader(CSVDataSource.scala:104)
at org.apache.spark.sql.execution.datasources.csv.TextInputCSVDataSource$.inferFromDataset(CSVDataSource.scala:163)
at org.apache.spark.sql.execution.datasources.csv.TextInputCSVDataSource$.infer(CSVDataSource.scala:149)
at org.apache.spark.sql.execution.datasources.csv.CSVDataSource.inferSchema(CSVDataSource.scala:63)
at org.apache.spark.sql.execution.datasources.csv.CSVFileFormat.inferSchema(CSVFileFormat.scala:57)
at org.apache.spark.sql.execution.datasources.DataSource$$anonfun$8.apply(DataSource.scala:203)
at org.apache.spark.sql.execution.datasources.DataSource$$anonfun$8.apply(DataSource.scala:203)
at scala.Option.orElse(Option.scala:289)
at org.apache.spark.sql.execution.datasources.DataSource.getOrInferFileFormatSchema(DataSource.scala:202)
at org.apache.spark.sql.execution.datasources.DataSource.resolveRelation(DataSource.scala:393)
at org.apache.spark.sql.DataFrameReader.loadV1Source(DataFrameReader.scala:239)
at org.apache.spark.sql.DataFrameReader.load(DataFrameReader.scala:227)
at org.apache.spark.sql.DataFrameReader.csv(DataFrameReader.scala:596)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at py4j.reflection.MethodInvoker.invoke(MethodInvoker.java:244)
at py4j.reflection.ReflectionEngine.invoke(ReflectionEngine.java:357)
at py4j.Gateway.invoke(Gateway.java:282)
at py4j.commands.AbstractCommand.invokeMethod(AbstractCommand.java:132)
at py4j.commands.CallCommand.execute(CallCommand.java:79)
at py4j.GatewayConnection.run(GatewayConnection.java:238)
at java.lang.Thread.run(Thread.java:748)
The file was created by another spark process and read in this step for processing . Will folders have . cause any issue ? or is it anything basic I am doing wrong.