You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"By default the latest version of the API and the latest supported Spark version is chosen. To specify your own: %use spark-streaming(spark=3.2, v=1.1.0)"
7
+
],
8
+
"metadata": {
9
+
"collapsed": false,
10
+
"pycharm": {
11
+
"name": "#%% md\n"
12
+
}
13
+
}
14
+
},
15
+
{
16
+
"cell_type": "code",
17
+
"execution_count": 2,
18
+
"outputs": [
19
+
{
20
+
"name": "stdout",
21
+
"output_type": "stream",
22
+
"text": [
23
+
"To start a spark streaming session, simply use `withSparkStreaming { }` inside a cell. To use Spark normally, use `withSpark { }` in a cell, or use `%use spark` to start a Spark session for the whole notebook.\n"
24
+
]
25
+
}
26
+
],
27
+
"source": [
28
+
"%use spark-streaming"
29
+
],
30
+
"metadata": {
31
+
"collapsed": false,
32
+
"pycharm": {
33
+
"name": "#%%\n"
34
+
}
35
+
}
36
+
},
37
+
{
38
+
"cell_type": "markdown",
39
+
"source": [
40
+
"Let's define some data class to work with."
41
+
],
42
+
"metadata": {
43
+
"collapsed": false,
44
+
"pycharm": {
45
+
"name": "#%% md\n"
46
+
}
47
+
}
48
+
},
49
+
{
50
+
"cell_type": "code",
51
+
"execution_count": 4,
52
+
"outputs": [],
53
+
"source": [
54
+
"data class TestRow(\n",
55
+
" val word: String,\n",
56
+
")"
57
+
],
58
+
"metadata": {
59
+
"collapsed": false,
60
+
"pycharm": {
61
+
"name": "#%%\n"
62
+
}
63
+
}
64
+
},
65
+
{
66
+
"cell_type": "markdown",
67
+
"source": [
68
+
"To run this on your local machine, you need to first run a Netcat server: `$ nc -lk 9999`.\n",
69
+
"\n",
70
+
"This example will collect the data from this stream for 10 seconds and 1 second intervals, splitting and counting the input per word."
0 commit comments