Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions docs/connect/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,38 @@ starting org.apache.spark.sql.connect.service.SparkConnectServer, logging to...
$ tail -1 logs/spark-jacek-org.apache.spark.sql.connect.service.SparkConnectServer-1-Jaceks-Mac-mini.local.out
... Spark Connect server started.
```

Use Spark Connect for interactive analysis:

```bash
./bin/pyspark --remote "sc://localhost"
```

And you will notice that the PySpark shell welcome message tells you that you have connected to Spark using Spark Connect:

```python
Client connected to the Spark Connect server at localhost
```

Check the Spark session type:

```python
SparkSession available as 'spark'.
>>> type(spark)
<class 'pyspark.sql.connect.session.SparkSession'>
```

Now you can run PySpark code in the shell to see Spark Connect in action:

```python
>>> columns = ["id","name"]
>>> data = [(1,"Sarah"),(2,"Maria")]
>>> df = spark.createDataFrame(data).toDF(*columns)
>>> df.show()
+---+-----+
| id| name|
+---+-----+
| 1|Sarah|
| 2|Maria|
+---+-----+
```