Skip to content

Commit a563203

Browse files
author
chengyitian
committed
Merge remote-tracking branch 'origin/dev' into dev
2 parents 1acb163 + ef19d19 commit a563203

File tree

6 files changed

+61
-11
lines changed

6 files changed

+61
-11
lines changed

test/com/xxdb/route/AutoFitTableAppenderTest.java

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2028,8 +2028,11 @@ public void Test_AutoFitTableAppender_streamTable_allDateType() throws IOExcepti
20282028
script += "share t as st;";
20292029
conn.run(script);
20302030
BasicTable bt = (BasicTable)conn.run("table(true as cbool,'d' as cchar,86h as cshort,10 as cint,726l as clong,2021.09.23 as cdate,2021.10M as cmonth,14:55:26.903 as ctime,15:27m as cminute,14:27:35 as csecond,2018.11.11 11:11:11 as cdatetime,2010.09.29 11:35:47.295 as ctimestamp,12:25:45.284729843 as cnanotime,2018.09.15 15:32:32.734728902 as cnanotimestamp,5.7f as cfloat,0.86 as cdouble,\"single\" as cstring,datehour(2022.08.23 17:33:54.324) as cdatehour,blob(\"dolphindb\")as cblob,decimal32(19,2) as cdecimal32,decimal64(27,4) as cdecimal64,decimal128(27,10) as cdecimal128)");
2031+
long start = System.nanoTime();
20312032
AutoFitTableAppender aftu = new AutoFitTableAppender("", "st", conn);
20322033
aftu.append(bt);
2034+
long end = System.nanoTime();
2035+
System.out.println((end - start) / 1000000);
20332036
BasicTable ua = (BasicTable)conn.run("select * from st;");
20342037
Assert.assertEquals(4, ua.rows());
20352038
BasicTable act = (BasicTable)conn.run("select * from st where cint = 10;");
@@ -2038,8 +2041,8 @@ public void Test_AutoFitTableAppender_streamTable_allDateType() throws IOExcepti
20382041
}
20392042
@Test
20402043
public void Test_AutoFitTableAppender_streamTable_allDateType_1() throws IOException {
2041-
String script = "n=100;\n";
2042-
script += "intv = 1..100;\n";
2044+
String script = "n=5000000;\n";
2045+
script += "intv = 1..5000000;\n";
20432046
script += "uuidv = rand(rand(uuid(), 10) join take(uuid(), 4), n);\n";
20442047
script += "ippaddrv = rand(rand(ipaddr(), 1000) join take(ipaddr(), 4), n)\n";
20452048
script += "int128v = rand(rand(int128(), 1000) join take(int128(), 4), n);\n";
@@ -2049,12 +2052,25 @@ public void Test_AutoFitTableAppender_streamTable_allDateType_1() throws IOExcep
20492052
script += "t1 = table(100:0,`intv`uuidv`ippaddrv`int128v`complexv`pointv,[INT,UUID,IPADDR,INT128,COMPLEX,POINT])\n";
20502053
conn.run(script);
20512054
BasicTable bt = (BasicTable)conn.run("select * from t");
2055+
BasicTable bt1 = (BasicTable)conn.run("select top 10 * from t");
20522056
AutoFitTableAppender aftu = new AutoFitTableAppender("", "t1", conn);
2053-
aftu.append(bt);
2057+
long start = System.nanoTime();
2058+
Entity re = aftu.append(bt);
2059+
assertEquals("5000000",re.getString());
2060+
long end = System.nanoTime();
2061+
System.out.println((end - start) / 1000000);
2062+
assertEquals(true,((end - start) / 1000000)<5000);
2063+
for(int i=0;i<10;i++){
2064+
Entity re1 = aftu.append(bt1);
2065+
assertEquals("10",re1.getString());
2066+
}
2067+
long end1 = System.nanoTime();
2068+
System.out.println((end1 - end)/ 10000000);
2069+
assertEquals(true,((end1 - end)/ 10000000)<2);
20542070
BasicTable ua = (BasicTable)conn.run("select * from t1;");
2055-
Assert.assertEquals(100, ua.rows());
2056-
BasicTable act = (BasicTable)conn.run("select * from t");
2057-
compareBasicTable(bt, act);
2071+
assertEquals(5000100, ua.rows());
2072+
BasicTable ua1 = (BasicTable)conn.run("select * from t1 limit 5000000;");
2073+
compareBasicTable(bt, ua1);
20582074
}
20592075
@Test
20602076
public void Test_AutoFitTableAppender_DfsTable_allDateType() throws IOException {
@@ -2444,7 +2460,6 @@ public void Test_AutoFitTableAppender_dateType_not_match() throws IOException {
24442460
aftu.append(bt);
24452461
BasicTable bt10 = (BasicTable) conn.run("select * from pt;");
24462462
assertEquals(0, bt10.rows());
2447-
24482463
}
24492464

24502465
}

test/com/xxdb/route/AutoFitTableUpsertTest.java

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1691,4 +1691,39 @@ public void test_AutoFitTableUpsert_allDataType_array_null() throws Exception {
16911691
assertEquals(0, bt.rows());
16921692
conn.close();
16931693
}
1694+
@Test
1695+
public void Test_AutoFitTableAppender_streamTable_allDateType_11() throws Exception {
1696+
String script = "n=5000000;\n";
1697+
script += "intv = 1..5000000;\n";
1698+
script += "uuidv = rand(rand(uuid(), 10) join take(uuid(), 4), n);\n";
1699+
script += "ippaddrv = rand(rand(ipaddr(), 1000) join take(ipaddr(), 4), n)\n";
1700+
script += "int128v = rand(rand(int128(), 1000) join take(int128(), 4), n);\n";
1701+
script += "complexv = rand(complex(rand(100, 1000), rand(100, 1000)) join NULL, n);\n";
1702+
script += "pointv = rand(point(rand(100, 1000), rand(100, 1000)) join NULL, n);\n";
1703+
script += " share table(intv,uuidv,ippaddrv,int128v,complexv,pointv) as tt\n";
1704+
script += "t1=keyedTable(`intv,100:0,`intv`uuidv`ippaddrv`int128v`complexv`pointv,[INT,UUID,IPADDR,INT128,COMPLEX,POINT])\n";
1705+
1706+
conn.run(script);
1707+
BasicTable bt = (BasicTable)conn.run("select * from tt");
1708+
BasicTable bt1 = (BasicTable)conn.run("select top 10 * from tt");
1709+
AutoFitTableUpsert aftu = new AutoFitTableUpsert("","t1",conn,true,null,null);
1710+
1711+
long start = System.nanoTime();
1712+
int re = aftu.upsert(bt);
1713+
assertEquals(0,re);
1714+
long end = System.nanoTime();
1715+
System.out.println((end - start) / 1000000);
1716+
assertEquals(true,((end - start) / 1000000)<5000);
1717+
for(int i=0;i<10;i++) {
1718+
int re1 = aftu.upsert(bt1);
1719+
assertEquals( 0,re1);
1720+
}
1721+
aftu.upsert(bt1);
1722+
long end1 = System.nanoTime();
1723+
System.out.println((end1 - end));
1724+
assertEquals(true,((end1 - end)/ 10000000)<2);
1725+
1726+
BasicTable ua = (BasicTable)conn.run("select * from t1;");
1727+
assertEquals(5000000, ua.rows());
1728+
}
16941729
}

test/com/xxdb/streaming/client/cep/EventSenderTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1000,7 +1000,7 @@ public void test_EventSender_connect_not_connect() throws IOException, Interrup
10001000
}catch(Exception ex){
10011001
re = ex.getMessage();
10021002
}
1003-
Assert.assertEquals("The connection to dolphindb has not been established.",re);
1003+
Assert.assertEquals("Couldn't send script/function to the remote host because the connection has been closed",re);
10041004
}
10051005
@Test
10061006
public void test_EventSender_connect_duplicated() throws IOException, InterruptedException {

test/com/xxdb/streaming/reverse/PollingClientReverseTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1865,7 +1865,7 @@ public void test_PollingClient_subscribe_backupSites_not_true()throws IOExceptio
18651865
}catch(Exception ex){
18661866
re = ex.getMessage();
18671867
}
1868-
Assert.assertEquals("The format of backupSite 192.168.0.69,18921 is incorrect, should be host:port, e.g. 192.168.1.1:8848", re);
1868+
Assert.assertEquals("The format of backupSite "+HOST+","+PORT+" is incorrect, should be host:port, e.g. 192.168.1.1:8848", re);
18691869
}
18701870

18711871
@Test(timeout = 120000)

test/com/xxdb/streaming/reverse/ThreadPooledClientReverseTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1703,7 +1703,7 @@ public void Test_ThreadPooledClient_subscribe_backupSites_not_true()throws IOExc
17031703
}catch(Exception ex){
17041704
re = ex.getMessage();
17051705
}
1706-
Assert.assertEquals("The format of backupSite 192.168.0.69,18921 is incorrect, should be host:port, e.g. 192.168.1.1:8848", re);
1706+
Assert.assertEquals("The format of backupSite "+HOST+","+PORT+" is incorrect, should be host:port, e.g. 192.168.1.1:8848", re);
17071707
}
17081708

17091709
@Test(timeout = 120000)

test/com/xxdb/streaming/reverse/ThreadedClientsubscribeReverseTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3241,7 +3241,7 @@ public void test_ThreadClient_subscribe_backupSites_not_true()throws IOException
32413241
}catch(Exception ex){
32423242
re = ex.getMessage();
32433243
}
3244-
Assert.assertEquals("The format of backupSite 192.168.0.69,18921 is incorrect, should be host:port, e.g. 192.168.1.1:8848", re);
3244+
Assert.assertEquals("The format of backupSite "+HOST+","+PORT+" is incorrect, should be host:port, e.g. 192.168.1.1:8848", re);
32453245
}
32463246

32473247
@Test(timeout = 120000)

0 commit comments

Comments
 (0)