This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# start Spark app | |
sparkCC <- rxSparkConnect() | |
# upload data to hdfs | |
rxHadoopMakeDir("/share/SampleData") | |
rxHadoopCopyFromLocal(file.path(dataPath = rxGetOption("sampleDataDir"), "*"), "/share/SampleData") | |
# define a user function that builds a linear model | |
".linMod" <- function(keys, data) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# SQL SERVER COMPUTE CONTEXT | |
sqlServerConnString <- "SERVER=hostname;DATABASE=RevoTestDB;UID=DBUser;PWD=Password;" | |
inTable <- paste0("airlinedemosmall") | |
sqlServerDataDS <- RxSqlServerData(table = inTable, connectionString = sqlServerConnString) | |
# user function | |
".Count" <- function(keys, data, params) | |
{ | |
myDF <- rxImport(inData = data) | |
return (nrow(myDF)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Set Compute Context | |
rxSetComputeContext("localpar") | |
# use all the cores available | |
rxOptions(numCoresToUse = -1) | |
# Data Sources | |
sampleDataDir <- rxGetOption("sampleDataDir") | |
XdfDataSource <- RxXdfData(file.path(sampleDataDir, "claims.xdf")) | |
TextDataSource <- RxTextData(file.path(sampleDataDir, "claims.txt")) | |
SasDataSource <- RxSasData(file.path(sampleDataDir, "claims.sas7bdat")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
exec sp_execute_external_script | |
@language = N'R' , | |
@script = N'print(R.Version()$version)' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Fill in the blanks with appropriate values | |
library(AzureSMR) | |
client_id <- "---------------------" | |
app_key <- "---------------------" | |
tenant_id <- "---------------------" | |
sc <- createAzureContext(tenantID = tenant_id, clientID = client_id, authKey = app_key) | |
rgs <- azureListRG(sc) | |
rgs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
exec sp_execute_external_script | |
@language = N'R' , | |
@script = N'library(MicrosoftML)' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Requires the following Azure NuGet packages and related dependencies: | |
// package id="Microsoft.Azure.Management.Authorization" version="2.0.0" | |
// package id="Microsoft.Azure.Management.ResourceManager" version="1.4.0-preview" | |
// package id="Microsoft.Rest.ClientRuntime.Azure.Authentication" version="2.2.8-preview" | |
using Microsoft.Azure.Management.ResourceManager; | |
using Microsoft.Azure.Management.ResourceManager.Models; | |
using Microsoft.Rest.Azure.Authentication; | |
using Newtonsoft.Json; | |
using Newtonsoft.Json.Linq; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'azure_mgmt_resources' | |
class Deployer | |
# Initialize the deployer class with subscription, resource group and resource group location. The class will raise an | |
# ArgumentError if there are empty values for Tenant Id, Client Id or Client Secret environment variables. | |
# | |
# @param [String] subscription_id the subscription to deploy the template | |
# @param [String] resource_group the resource group to create or update and then deploy the template | |
# @param [String] resource_group_location the location of the resource group |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -euo pipefail | |
IFS=$'\n\t' | |
# -e: immediately exit if any command has a non-zero exit status | |
# -o: prevents errors in a pipeline from being masked | |
# IFS new value is less likely to cause confusing bugs when looping arrays or arguments (e.g. $@) | |
usage() { echo "Usage: $0 -i <subscriptionId> -g <resourceGroupName> -n <deploymentName> -l <resourceGroupLocation>" 1>&2; exit 1; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -euo pipefail | |
IFS=$'\n\t' | |
# -e: immediately exit if any command has a non-zero exit status | |
# -o: prevents errors in a pipeline from being masked | |
# IFS new value is less likely to cause confusing bugs when looping arrays or arguments (e.g. $@) | |
usage() { echo "Usage: $0 -i <subscriptionId> -g <resourceGroupName> -n <deploymentName> -l <resourceGroupLocation>" 1>&2; exit 1; } |