在Azure数据湖U-SQL中运行R代码错误

时间:2019-01-25 02:11:30

标签: u-sql

我有一个应该在Azure数据湖中运行的Run Script R代码。在Azure数据湖中安装R扩展后,我尝试为此使用u-SQL,但是当我运行U-SQL脚本时,我遇到了下面的错误。任何人都可以协助解决以下问题。我被困在一个月左右。

REFERENCE ASSEMBLY [ExtR];   //enable R extensions for the U-SQL Script

//declare the R script as a string variable and pass it as a parameter to the Reducer:
DECLARE @myRScript = @"
temp = inputFromUSQL
temp$mynewcol = ncol(temp)  
outputToUSQL = temp
";


DECLARE @myInputFile string  = @"/dev/iris.csv";
DECLARE @myOutputFile string = @"/dev/outex1.txt";

@InputIrisData = EXTRACT 
sepal_length string,
sepal_width string,
petal_length string,
petal_width string,
species string  
FROM @myInputFile
USING Extractors.Csv(skipFirstNRows: 1);


@ExtendedData = SELECT 
0 AS Par,    // pseudo partition
*
FROM @InputIrisData;

//Column names and types must be same in usql and r scripts
@RScriptOutput = REDUCE @ExtendedData ON Par PRODUCE 
Par, 
RowId int,
ROutput string
USING new Extension.R.Reducer(command:@myRScript, rReturnType:"charactermatrix");

//OUTPUT @RScriptOutput TO @myOutputFile USING Outputters.Tsv();    
OUTPUT @RScriptOutput TO @myOutputFile USING Outputters.Csv(outputHeader : true, quoting:false);  //if want the headers as well

错误:

====捕获的异常RDotNet.EvaluationException

在RDotNet.REngine.Parse中

(字符串语句,StringBuilder incompleteStatement)    在RDotNet.REngine.d__0.MoveNext()    在System.Linq.Enumerable.LastOrDefault [TSource](IEnumerable`1源)处    在RDotNet.REngine.Evaluate(String语句)    在Extension.R.RDriver.RunRCode(REngine rEngine,字符串rText,RTextTypes rTextType,布尔isReturnTypeDataFrame)    在C:\ agent_1 \ USqlExtensions \ lang \ R \ ExtR \ RDriver.cs:第125行    在Extension:R.RDriver.PrepareEnvironmentRunRCode()中的C:\ agent_1 \ USqlExtensions \ lang \ R \ ExtR \ RDriver.cs:第148行    在Extension.R.UsqlHelperFunctions.d__2.MoveNext()我    C:\ agent_1 \ USqlExtensions \ lang \ R \ ExtR \ UsqlHelperFunctions.cs:第73行    在ScopeEngine.RunUdoCodeExceptionhandled>    (ScopeTypedManagedHandle * className,SByte * methodName,    *代码)    d:\ data \ yarnnm \ local \ usercache \ 34c0a3b0-a710-4367-b2b7-3bb36d9fa3ba \ appcache \ application_1546151044065_290541 \ container_e290_1546151044065_290541_01_000001 \ wd \ managed.h:line 2034

0 个答案:

没有答案