提交 1fccc783 authored 作者: Evgenij Ryazanov's avatar Evgenij Ryazanov

Add more tests

上级 4ab34a53
......@@ -121,6 +121,22 @@ public class TestBigResult extends TestBase {
testSortingAndDistinct2(stat, sql, count, partCount);
// external result
testSortingAndDistinct2(stat, sql, 10, partCount);
/*
* One more distinct only
*/
sql = "SELECT VALUE1 FROM (SELECT DISTINCT VALUE1 FROM TEST)";
// local result
testSortingAndDistinct3DistinctOnly(stat, sql, count, partCount);
// external result
testSortingAndDistinct3DistinctOnly(stat, sql, 1, partCount);
/*
* One more sorting and distinct
*/
sql = "SELECT VALUE1 FROM (SELECT DISTINCT VALUE1 FROM TEST ORDER BY VALUE1)";
// local result
testSortingAndDistinct3(stat, sql, count, partCount);
// external result
testSortingAndDistinct3(stat, sql, 1, partCount);
conn.close();
}
......@@ -166,6 +182,30 @@ public class TestBigResult extends TestBase {
assertFalse(rs.next());
}
private void testSortingAndDistinct3(Statement stat, String sql, int maxRows, int partCount) throws SQLException {
ResultSet rs;
stat.execute("SET MAX_MEMORY_ROWS " + maxRows);
rs = stat.executeQuery(sql);
for (int i = 1; i <= partCount; i++) {
assertTrue(rs.next());
assertEquals(i, rs.getInt(1));
}
assertFalse(rs.next());
}
private void testSortingAndDistinct3DistinctOnly(Statement stat, String sql, int maxRows, int partCount) throws SQLException {
ResultSet rs;
stat.execute("SET MAX_MEMORY_ROWS " + maxRows);
rs = stat.executeQuery(sql);
BitSet set = new BitSet(partCount);
for (int i = 1; i <= partCount; i++) {
assertTrue(rs.next());
set.set(rs.getInt(1));
}
assertEquals(partCount + 1, set.nextClearBit(1));
assertFalse(rs.next());
}
private void testLargeUpdateDelete() throws SQLException {
deleteDb("bigResult");
Connection conn = getConnection("bigResult");
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论