druid io 0.9.0 を使用しています。集計後フィールドをメトリック仕様として追加しようとしています。私の意図は、メトリクス (メジャー) が表示される方法と同様に、集計後のフィールドの値を表示することです (ピボットを使用した Druid io で)。
私のDruid ioスキーマファイルは
{
"dataSources" : {
"NPS1112" : {
"spec" : {
"dataSchema" : {
"dataSource" : "NPS1112",
"parser" : {
"type" : "string",
"parseSpec" : {
"timestampSpec" : {
"column" : "timestamp",
"format" : "auto"
},
"dimensionsSpec" : {
"dimensions" : ["dimension1","dimension2","dimension3"],
"dimensionExclusions" : [
"timestamp",
"OverallRating",
"DeliveryTimeRating",
"ItemQualityRating",
"isPromoter",
"isDetractor"
]
},
"format" : "json"
}
},
"granularitySpec" : {
"type" : "uniform",
"segmentGranularity" : "hour",
"queryGranularity" : "none"
},
"aggregations" : [
{ "type" : "count", "name" : "rows"},
{ "type" : "doubleSum", "name" : "CountOfPromoters", "fieldName" : "isPromoter" },
{ "type" : "doubleSum", "name" : "CountOfDetractor", "fieldName" : "isDetractor" }
],
"postAggregations" : [
{ "type" : "arithmetic",
"name" : "PromoterPercentage",
"fn" : "/",
"fields" : [
{ "type" : "fieldAccess", "name" : "CountOfPromoters", "fieldName" : "CountOfPromoters" },
{ "type" : "fieldAccess", "name" : "rows", "fieldName" : "rows" }
]
},
{ "type" : "arithmetic",
"name" : "DetractorPercentage",
"fn" : "/",
"fields" : [
{ "type" : "fieldAccess", "name" : "CountOfDetractor", "fieldName" : "CountOfDetractor" },
{ "type" : "fieldAccess", "name" : "rows", "fieldName" : "rows" }
]
},
{ "type" : "arithmetic",
"name" : "NPS",
"fn" : "-",
"fields" : [
{ "type" : "fieldAccess", "name" : "PromoterPercentage", "fieldName" : "PromoterPercentage" },
{ "type" : "fieldAccess", "name" : "DetractorPercentage", "fieldName" : "DetractorPercentage" }
]
}
],
"metricsSpec" : [
{
"type" : "count",
"name" : "CountOfResponses"
},
{
"type" : "fieldAccess",
"name" : "CountOfPromoters"
}
]
},
"ioConfig" : {
"type" : "realtime"
},
"tuningConfig" : {
"type" : "realtime",
"maxRowsInMemory" : "10000",
"intermediatePersistPeriod" : "PT10M",
"windowPeriod" : "PT10M"
}
},
"properties" : {
"task.partitions" : "1",
"task.replicants" : "1"
}
}
},
"properties" : {
"zookeeper.connect" : "localhost",
"druid.discovery.curator.path" : "/druid/discovery",
"druid.selectors.indexing.serviceName" : "druid/overlord",
"http.port" : "8200",
"http.threads" : "4"
}
}
Java クライアントを使用してフィールドを送信するための私のコード。
final Map<String,Object> obj = new HashMap<String, Object>();
obj.put("timestamp", new DateTime().toString());
obj.put("OverallRating", (ran.nextInt(high-low) + low));
obj.put("DeliveryTimeRating", (ran.nextInt(high-low) + low));
obj.put("ItemQualityRating", (ran.nextInt(high-low) + low));
obj.put("isPromoter", ((ran.nextInt(high-low) + low)%2) == 0 ? 1 : 0);
obj.put("isDetractor", ((ran.nextInt(high-low) + low)%2) == 0 ? 1 : 0);
obj.put("dimension1", "dimension1-"+ (ran.nextInt(high-low) + low));
obj.put("dimension2", "dimension2-"+ (ran.nextInt(high-low) + low));
obj.put("dimension3", "dimension3-"+ (ran.nextInt(high-low) + low));
誰でも私の間違いを指摘できますか。