Example #1
0
        static void ProcessN3(string n1, string n2)
        {
            CqlResult n1Result = ThriftTool.GetByCql("Select * from M01UserRelaction where key='" + n1 + "' limit 50000");
            CqlResult n2Result = ThriftTool.GetByCql("Select * from M01UserRelaction where key='" + n2 + "' limit 50000");
            var       n1List   = n1Result.Rows.First().Columns.Select(col => ThriftTool.ToString(col.Name)).Where(name => name != "KEY").ToList();
            var       n2List   = n2Result.Rows.First().Columns.Select(col => ThriftTool.ToString(col.Name)).Where(name => name != "KEY").ToList();

            foreach (var n3 in n1List.Intersect(n2List))
            {
                //Utility.Logging("n3=" + n3, Utility.DebugLevel.Info);
                if (n1 == n3 || n2 == n3)
                {
                    continue;
                }
                var sum       = Get2NodeValue(n1, n2) + Get2NodeValue(n2, n3) + Get2NodeValue(n1, n3);
                var orderList = new List <int> {
                    int.Parse(n1), int.Parse(n2), int.Parse(n3)
                };
                orderList.Sort();
                var key = orderList[2] + "_" + orderList[1] + "_" + orderList[0];
                ThriftTool.CounterAdd(key, "M01UserRelactionN3", "sum", sum);
                ThriftTool.CounterAdd(key, "M01UserRelactionN3", orderList[2] + "_" + orderList[1], Get2NodeValue(orderList[2].ToString(CultureInfo.InvariantCulture), orderList[1].ToString(CultureInfo.InvariantCulture)));
                ThriftTool.CounterAdd(key, "M01UserRelactionN3", orderList[2] + "_" + orderList[0], Get2NodeValue(orderList[2].ToString(CultureInfo.InvariantCulture), orderList[0].ToString(CultureInfo.InvariantCulture)));
                ThriftTool.CounterAdd(key, "M01UserRelactionN3", orderList[1] + "_" + orderList[0], Get2NodeValue(orderList[1].ToString(CultureInfo.InvariantCulture), orderList[0].ToString(CultureInfo.InvariantCulture)));
            }
        }