我正在为我正在开发的应用程序测试数据湖。我是 U-SQL 和数据湖的新手,我只是想查询 JSON 文件中的所有记录。现在,它只返回一条记录,我不知道为什么,因为该文件大约有 200 条。
我的代码是:
DECLARE @input string = @"/MSEStream/output/2016/08/12_0_fc829ede3c1d4cf9a3278d43e7e4e9d0.json";
REFERENCE ASSEMBLY [Newtonsoft.Json];
REFERENCE ASSEMBLY [Microsoft.Analytics.Samples.Formats];
@allposts =
EXTRACT
id string
FROM @input
USING new Microsoft.Analytics.Samples.Formats.Json.JsonExtractor();
@result =
SELECT *
FROM @allposts;
OUTPUT @result
TO "/ProcessedQueries/all_posts.csv"
USING Outputters.Csv();
数据示例:
{
"id":"398507",
"contenttype":"POST",
"posttype":"post",
"uri":"http://twitter.com/etc",
"title":null,
"profile":{
"@class":"PublisherV2_0",
"name":"Company",
"id":"2163171",
"profileIcon":"https://pbs.twimg.com/image",
"profileLocation":{
"@class":"DocumentLocation",
"locality":"Toronto",
"adminDistrict":"ON",
"countryRegion":"Canada",
"coordinates":{
"latitude":43.7217,
"longitude":-31.432},
"quadKey":"000000000000000"},
"displayName":"Name",
"externalId":"00000000000"},
"source":{
"name":"blogs",
"id":"18",
"param":"Twitter"},
"content":{
"text":"Description of post"},
"language":{
"name":"English",
"code":"en"},
"abstracttext":"More Text and links",
"score":{}
}
}
提前感谢您的帮助