public class RunRScript extends CompositeOperator implements RecordPipelineOperator
This operator is parallelized by default. This implies that multiple R instances are initialized and the given script is executed within each instance with a different segment of the input data. Disable parallelism for the operator if any data dependencies exist due to R functions used in the script.
Two variables are initially set within the R environment prior to execution within each operator instance:
Use the setPathToRScript(String)
method to set the path to the Rscript executable. This executable
is used instead of the R
executable as it is meant to run a single R script specified on the
command line.
Constructor and Description |
---|
RunRScript() |
Modifier and Type | Method and Description |
---|---|
protected void |
compose(CompositionContext ctx)
Compose the body of this operator.
|
String |
getCharset()
Get character set value for input and output data.
|
static String |
getIdentifierRegex()
Function to return a Regular Expression string that can be used to identify a valid R identifier.
|
RecordPort |
getInput()
Returns the input port
|
RecordPort |
getOutput()
Returns the output port
|
RecordTokenType |
getOutputType()
Get the configured output type.
|
String |
getPathToRScript()
Get the path to the Rscript binary within the local R installation.
|
DataDistribution |
getRequiredDataDistribution()
Get the value set for the required data distribution of the input port of this
operator.
|
String |
getScriptSnippet()
Get the R script to execute.
|
void |
setCharset(String charsetName)
Set character set value which is used to format input and output data for R.
|
void |
setOutputType(RecordTokenType outputType)
Configure the output token type.
|
void |
setPathToRScript(String pathToRScript)
Set the path to the Rscript binary within the local R installation.
|
void |
setRequiredDataDistribution(DataDistribution dataDistribution)
Set the data distribution requirements for the input port of this operator.
|
void |
setScriptSnippet(String scriptSnippet)
Set the R script to execute.
|
static String |
validateFieldName(int position,
String fldName)
Function to ensure an input/output field name conforms to R variable identifier requirements.
|
disableParallelism, getInputPorts, getOutputPorts, newInput, newInput, newOutput, newRecordInput, newRecordInput, newRecordOutput, notifyError
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
disableParallelism, getInputPorts, getOutputPorts
public RecordPort getInput()
PipelineOperator
getInput
in interface PipelineOperator<RecordPort>
public RecordPort getOutput()
PipelineOperator
getOutput
in interface PipelineOperator<RecordPort>
public RecordTokenType getOutputType()
public void setOutputType(RecordTokenType outputType)
outputType
- output record token typepublic String getPathToRScript()
public void setPathToRScript(String pathToRScript)
pathToRScript
- path to RScript executablepublic String getScriptSnippet()
public void setScriptSnippet(String scriptSnippet)
scriptSnippet
- public void setRequiredDataDistribution(DataDistribution dataDistribution)
dataDistribution
- input data distributionpublic DataDistribution getRequiredDataDistribution()
public void setCharset(String charsetName)
charsetName
- character set name for encodingpublic String getCharset()
protected void compose(CompositionContext ctx)
CompositeOperator
OperatorComposable.add(O)
OperatorComposable.connect(P, P)
. This includes
connections from the composite's input ports to sub-operators, connections between sub-operators, and
connections from sub-operators output ports to the composite's output portscompose
in class CompositeOperator
ctx
- the contextpublic static String validateFieldName(int position, String fldName)
position
- the ordinal position of the field in the source/target schema - may be needed to disambiguate field names after character substitution takes place.fldName
- the name of the field being validatedpublic static String getIdentifierRegex()
Copyright © 2020 Actian Corporation. All rights reserved.