I have an apache spark sql job (using Datasets), coded in Java, that get's it's input from between 70,000 to 150,000 files.
It appears to take anywhere from 45 minutes to 1.5 hours to build the InMemoryFileIndex.
There are no logs, very low network usage, and almost no CPU usage during this time.
Here's a sample of what I see in the std output:
24698 [main] INFO org.spark_project.jetty.server.handler.ContextHandler - Started o.s.j.s.ServletContextHandler@32ec9c90{/static/sql,null,AVAILABLE,@Spark}
25467 [main] INFO org.apache.spark.sql.execution.streaming.state.StateStoreCoordinatorRef - Registered StateStoreCoordinator endpoint
2922000 [main] INFO org.apache.spark.sql.execution.datasources.InMemoryFileIndex - Listing leaf files and directories in parallel under: <a LOT of file url's...>
2922435 [main] INFO org.apache.spark.SparkContext - Starting job: textFile at SomeClass.java:103
In this case, there was 45 minutes of essentially nothing happening (as far as I could tell).
I load the files using:
sparkSession.read().textFile(pathsArray)
Can someone explain what is going on in InMemoryFileIndex, and how can I make this step faster?