【发布时间】:2018-04-26 14:40:33
【问题描述】:
当我尝试从 json 文件中提取时出现错误:
adl 在用户类型“Microsoft.Analytics.Samples.Formats.Json.MultiLevelJsonExtractor”上调用方法“Extract”时,报告了来自用户代码的未处理异常
我已经安装了程序集,但是当我尝试对 .json 文件执行作业时,我总是收到此错误。
这是我的代码:
REFERENCE ASSEMBLY BankingADLDB.[Newtonsoft.Json];
REFERENCE ASSEMBLY BankingADLDB.[Microsoft.Analytics.Samples.Formats];
USING Microsoft.Analytics.Samples.Formats.Json;
DECLARE @in string=@"adl://xxx.azuredatalakestore.net/14-04-2018/00_0_18144c820d664dfea18583f9ce515bd3.json";
DECLARE @out string=@"Test.csv";
@result =
EXTRACT message string,
messageTypeId string,
providerTypeId string,
identifier string,
key string,
extras string
FROM @in
USING new MultiLevelJsonExtractor("TranscriptionSections[*].Sentences[*]",
false,
"message",
"messageTypeId",
"providerTypeId",
"identifier",
"key",
"extras");
OUTPUT @result
TO @out
USING Outputters.Csv();
这里是一个json文件的示例:
{"solution":"poo","message":{"messageTypeId":1,"providerTypeId":1,"identifier":"1-7jh88","entries":[{"key":" userinfo","value":{"name":"John Jo Carvalho","gender":"unknown","birthDate":"","nif":"","email":"sample@sample.me ","phoneNumber":"+351789582471","userLocation":{"address":"","town":"Lisbon","postalCode":"","country":"Portugal"},"photoUrl" :"https://xxx.jpg"}}],"extras":[]},"EventProcessedUtcTime":"2018-04-14T00:00:19.2501003Z","PartitionId":1,"EventEnqueuedUtcTime":"2018-04- 14T00:00:19.1970000Z","IoTHub":{"MessageId":null,"CorrelationId":null,"ConnectionDeviceId":"1-7jh88","ConnectionDeviceGenerationId":"123456789123456789","EnqueuedTime":"2018- 04-14T00:00:19.0120000Z","StreamId":null}}
【问题讨论】:
-
你能提供一些样本(必要时匿名)json吗?
-
是的@wBob 你有它
-
您也可以提供其余的错误消息。通常会有更多的细节告诉你发生了什么错误。
-
此 json 与您试图在代码中分解的 json 没有任何相似之处。例如,您的 json 示例在父
TranscriptionSections节点中不包含Sentencesndoes。请提供一些准确反映您真实json的json。
标签: json azure-data-lake u-sql argument-dependent-lookup