# 12. Spark Internals

## SPARK INTERNALS

What actually happenend?

### An Execution Plan Is Created From Your RDD'S

* This start from textFile() -> map() -> countByValue()

### The Job Is Broken Into Stages Based On When Data Needs To Be Organized

* Stage 1 -> textFile(), map()
* Stage 2 -> countByValue()

### Each Stage Is Broken Into Tasks (Which May Be Distributed Across A Cluster)

### Finally The Tasks Are Scheduled Across Your Cluster And Executed


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://alvintoh.gitbook.io/apache-2-0-spark-with-scala/section-3-spark-basics-and-simple-examples/12.-spark-internals.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
