예제 #1
0
        public void createPartitionedTableAppender()
        {
            IDBConnectionPool pool = new ExclusiveDBConnectionPool("192.168.1.37", 8848, "admin", "123456", 5, true, true);
            IDBTask           conn = new BasicDBTask("dbPath = \"dfs://demohash\";if(existsDatabase(dbPath))    dropDatabase(dbPath); db = database(dbPath, HASH,[STRING, 2]);t= table(100:0,`id`valuie,[STRING,INT]);pt=db.createPartitionedTable(t,`pt,`id);");

            pool.execute(conn);


            PartitionedTableAppender appender = new PartitionedTableAppender("dfs://demohash", "pt", "id", pool);
            List <String>            colNames = new List <String>(2);

            colNames.Add("id");
            colNames.Add("value");
            List <IVector>    cols = new List <IVector>(2);
            BasicStringVector id   = new BasicStringVector(3);

            id.setString(0, "ORCA");
            id.setString(1, "YHOO");
            id.setString(2, "Ford");
            cols.Add(id);

            BasicIntVector value = new BasicIntVector(3);

            value.setInt(0, 10);
            value.setInt(1, 11);
            value.setInt(2, 12);
            cols.Add(value);

            int res = appender.append(new BasicTable(colNames, cols));

            Assert.AreEqual(3, res);
        }
예제 #2
0
        public void Test_execute()
        {
            ExclusiveDBConnectionPool pool  = new ExclusiveDBConnectionPool(SERVER, PORT, USER, PASSWORD, 20, true, true);
            List <IDBTask>            tasks = new List <IDBTask>(20);

            for (int i = 0; i < 20; i++)
            {
                BasicDBTask task = new BasicDBTask("table(1 2 3 as id, 4 5 6 as value);");
                tasks.Add(task);
            }
            pool.execute(tasks);
            for (int i = 0; i < 20; i++)
            {
                bool flag = tasks[i].isSuccessful();
            }
        }