@@ -4280,4 +4280,54 @@ public void test_DBConnection_upload_illegal_string() throws IOException {
42804280 assertEquals ("" , table2 .getColumn (3 ).get (1 ).getString ());
42814281 assertEquals ("blob1AMZN" , table2 .getColumn (3 ).get (2 ).getString ());
42824282 }
4283+ @ Test
4284+ public void test_connection_enableSeqNo_true () throws Exception {
4285+ DBConnection connection = new DBConnection (false , false , false );
4286+ connection .connect (HOST , PORT , "admin" , "123456" ,
4287+ "" , true , ipports );
4288+ connection .run ("\n " +
4289+ "dbPath = \" dfs://tableUpsert_test\" \n " +
4290+ "if(existsDatabase(dbPath)){\n " +
4291+ "\t dropDatabase(dbPath)\n " +
4292+ "}\n " +
4293+ "t = table(100:1, `id`id2`value, `INT`INT`INT)\n " +
4294+ "db = database(dbPath, RANGE,1 50 10000)\n " +
4295+ "pt1 = db.createPartitionedTable(t,`pt1,`id).append!(t)\n " +
4296+ "pt = db.createPartitionedTable(t,`pt,`id).append!(t)" );
4297+ BasicTable ex = (BasicTable )connection .run ("t=table( take(1..3000,3000) as id, 1..3000 as id2, 1..3000 as value);t;" ,null ,4 , 4 , 0 , false ,"" , true );
4298+ for (int i = 0 ; i < 10 ; i ++){
4299+ connection .run ("pt = loadTable(\" dfs://tableUpsert_test\" ,\" pt\" ); pt.append!(t) ; pt1 = loadTable(\" dfs://tableUpsert_test\" ,\" pt1\" ); pt1.append!(t) ;" ,null ,4 , 4 , 0 , false ,"" , true );
4300+ }
4301+ BasicTable res1 = (BasicTable ) connection .run ("select * from loadTable(\" dfs://tableUpsert_test\" ,\" pt\" )" );
4302+ BasicTable res2 = (BasicTable ) connection .run ("select * from loadTable(\" dfs://tableUpsert_test\" ,\" pt1\" )" );
4303+ assertEquals (30000 , res1 .rows ());
4304+ assertEquals (30000 , res1 .rows ());
4305+ connection .close ();
4306+ }
4307+
4308+ @ Test
4309+ public void test_connection_enableSeqNo_false () throws Exception {
4310+ DBConnection connection = new DBConnection (false , false , false );
4311+ connection .connect (HOST , PORT , "admin" , "123456" ,
4312+ "" , true , ipports );
4313+ connection .run ("\n " +
4314+ "dbPath = \" dfs://tableUpsert_test\" \n " +
4315+ "if(existsDatabase(dbPath)){\n " +
4316+ "\t dropDatabase(dbPath)\n " +
4317+ "}\n " +
4318+ "t = table(100:1, `id`id2`value, `INT`INT`INT)\n " +
4319+ "db = database(dbPath, RANGE,1 50 10000)\n " +
4320+ "pt1 = db.createPartitionedTable(t,`pt1,`id).append!(t)\n " +
4321+ "pt = db.createPartitionedTable(t,`pt,`id).append!(t)" );
4322+ BasicTable ex = (BasicTable )connection .run ("t=table( take(1..3000,3000) as id, 1..3000 as id2, 1..3000 as value);t;" ,null ,4 , 4 , 0 , false ,"" , false );
4323+ for (int i = 0 ; i < 10 ; i ++){
4324+ connection .run ("pt = loadTable(\" dfs://tableUpsert_test\" ,\" pt\" ); pt.append!(t) ; pt1 = loadTable(\" dfs://tableUpsert_test\" ,\" pt1\" ); pt1.append!(t) ;" ,null ,4 , 4 , 0 , false ,"" , false );
4325+ }
4326+ BasicTable res1 = (BasicTable ) connection .run ("select * from loadTable(\" dfs://tableUpsert_test\" ,\" pt\" )" );
4327+ BasicTable res2 = (BasicTable ) connection .run ("select * from loadTable(\" dfs://tableUpsert_test\" ,\" pt1\" )" );
4328+ assertEquals (30000 , res1 .rows ());
4329+ assertEquals (30000 , res1 .rows ());
4330+ connection .close ();
4331+ }
4332+
42834333}
0 commit comments