私は開発中のアプリケーションのデータ・レイクをテストしています。私はU-SQLとデータレーキを初めて使い、JSONファイルのすべてのレコードを照会しようとしています。今、それは1つのレコードのみを返すだし、ファイルを約200U-SQL Json Extractorはレコードを1つだけ引っ張っています
私のコードがあるしているので、私はなぜわからない:
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":{}
}
}
をいただき、ありがとうございます事前にヘルプ
私はそれを置くと何も返しません。私はポストに引っ張っているデータの例を追加します。 – WorkHardWork
私は何が起きているのかを理解しました。出力ファイルは行で区切られたファイルです。それを読む方法がありますか、それとも配列としてフォーマットする必要がありますか? – WorkHardWork
現在のJSONExtractorを拡張することで、ラインごとの処理を行う独自の抽出プログラムを書くこともできます(http://usql.ioのGitHubの他の抽出プログラムの一部を見てください) JSONを文字列として読み込みます(最大長は128kBです)。たとえばhttps://github.com/Azure/usql/blob/master/Examples/DataFormats/Microsoft.Analytics.Samples.Formats/readme.md –