Skip to content

Commit 608119a

Browse files
author
Jeff Stokes
committed
new script
1 parent f2e38d3 commit 608119a

File tree

1 file changed

+19
-9
lines changed

1 file changed

+19
-9
lines changed

articles/hdinsight/hdinsight-hadoop-r-server-get-started.md

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -376,29 +376,39 @@ The following provides some sample code on use of the new functions:
376376
myHadoopCluster <- rxSparkConnect(reset = TRUE)
377377

378378

379+
```
380+
#..create a Spark compute context
381+
382+
myHadoopCluster <- rxSparkConnect(reset = TRUE)
383+
rxSetComputeContext(myHadoopCluster)
384+
```
385+
386+
379387
```
380388
#..retrieve some sample data from Hive and run a model
381389
382390
hiveData <- RxHiveData("select * from hivesampletable",
383391
colInfo = list(devicemake = list(type = "factor")))
384392
rxGetInfo(hiveData, getVarInfo = TRUE)
385393
386-
rxSetComputeContext(myHadoopCluster)
387394
rxLinMod(querydwelltime ~ devicemake, data=hiveData)
388395
```
389396

397+
390398
```
391-
#..retrieve some sample data from Parquet and run a model
392-
pqData <- RxParquetData("/share/SampleData/AirlineDemoSmallParquet")
393-
rxGetInfo(pqData, getVarInfo = TRUE)
399+
#..retrieve some sample data from Parquet and run a model
394400
395-
rxSetComputeContext(myHadoopCluster)
396-
rxLinMod(ArrDelay~CRSDepTime + DayOfWeek, data = pqData)
397-
```
398-
401+
pqData <- RxParquetData("/share/SampleData/AirlineDemoSmallParquet",
402+
colInfo = list(DayOfWeek = list(type = "factor")))
403+
rxGetInfo(pqData, getVarInfo = TRUE)
399404
405+
rxLinMod(ArrDelay~CRSDepTime + DayOfWeek, data = pqData)
400406
```
401-
#..check on Spark data objects, cleanup, and close the Spark session
407+
408+
409+
```
410+
#..check on Spark data objects, cleanup, and close the Spark session
411+
402412
ls <- rxSparkListData() # two data objs are cached
403413
rxSparkRemoveData(ls)
404414
rxSparkListData() # it should show empty list

0 commit comments

Comments
 (0)