예제 #1
0
        public override void JoinFromClientHandler(JoinMessageReader request, JoinResponceWriter response)
        {
            idDict.Clear();
            List <List <List <long> > > classify = Classify(request.cellidsB, request.condb);

            for (int i = 0; i < Global.ServerCount; i++)
            {
                JoinMessageWriter msg = new JoinMessageWriter(request.cellidsA, classify[i], request.conda, request.condb);
                Global.CloudStorage.DoJoinFromProxyToDatabaseServer(i, msg);
            }
            sem.WaitOne();
            response.celllids = new List <List <long> >();
            for (int i = 0; i < Global.ServerCount; i++)
            {
                response.celllids.AddRange(idDict[i]);
            }
            response.serverid = 0;
        }
예제 #2
0
파일: Table.cs 프로젝트: zoukaifa/TriSQL
        /// <summary>
        /// 按照another第一个元素进行分类 another尽可能是单表, this 最好尺寸小
        /// </summary>
        /// <param name="anotherTable"></param>
        /// <param name="cond">条件表达式</param>
        /// <returns></returns>
        public Table innerJoinOnCluster(Table anotherTable, List <dint> cond = null)
        {
            //first
            //cellids columnNames columntypes
            Table newtable = new Table();

            foreach (var a in this.columnNames)
            {
                newtable.columnNames.Add(tableNames[0] + "." + a);
            }
            foreach (var a in this.columnTypes)
            {
                newtable.columnTypes.Add(a);
            }
            foreach (var a in anotherTable.columnNames)
            {
                newtable.columnNames.Add(anotherTable.tableNames[0] + "." + a);
            }
            foreach (var a in anotherTable.columnTypes)
            {
                newtable.columnTypes.Add(a);
            }
            newtable.tableNames.Add(this.tableNames[0] + anotherTable.tableNames[0]);
            //process
            if (cond == null)//使用默认条件,名字相同
            {
                cond = calcond(anotherTable.columnNames);
            }

            List <int> conda = new List <int>();
            List <int> condb = new List <int>();

            foreach (var a in cond)
            {
                conda.Add(a.a);
                condb.Add(a.b);
            }
            JoinMessageWriter msg = new JoinMessageWriter(this.cellIds, anotherTable.cellIds, conda, condb);

            newtable.cellIds = Global.CloudStorage.JoinFromClientToDatabaseProxy(0, msg).celllids;

            return(newtable);
        }