Skip to content

Commit d89ef27

Browse files
authored
Added spark session , this is require to run code from VSCode
1 parent 479d001 commit d89ef27

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

articles/hdinsight/hdinsight-for-vscode.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,10 @@ Using the PySpark interactive command to submit the queries, follow these steps:
183183

184184
```python
185185
from operator import add
186+
from pyspark.sql import SparkSession
187+
spark = SparkSession.builder \
188+
.appName('hdisample') \
189+
.getOrCreate()
186190
lines = spark.read.text("/HdiSamples/HdiSamples/FoodInspectionData/README").rdd.map(lambda r: r[0])
187191
counters = lines.flatMap(lambda x: x.split(' ')) \
188192
.map(lambda x: (x, 1)) \

0 commit comments

Comments
 (0)