| 1 | #include "catch.hpp" | 
| 2 | #include "test_helpers.hpp" | 
| 3 | #include "duckdb/storage/storage_info.hpp" | 
| 4 |  | 
| 5 | using namespace duckdb; | 
| 6 | using namespace std; | 
| 7 |  | 
| 8 | TEST_CASE("Test big append" , "[append][.]" ) { | 
| 9 | 	unique_ptr<QueryResult> result; | 
| 10 | 	DuckDB db(nullptr); | 
| 11 | 	Connection con(db); | 
| 12 | 	con.EnableQueryVerification(); | 
| 13 |  | 
| 14 | 	// append entries bigger than one block | 
| 15 | 	REQUIRE_NO_FAIL(con.Query("CREATE TABLE integers(i INTEGER);" )); | 
| 16 | 	REQUIRE_NO_FAIL(con.Query("INSERT INTO integers VALUES (1), (2), (3), (NULL)" )); | 
| 17 |  | 
| 18 | 	idx_t desired_count = (Storage::BLOCK_SIZE * 2) / sizeof(int); | 
| 19 | 	idx_t current_count = 4; | 
| 20 | 	while (current_count < desired_count) { | 
| 21 | 		REQUIRE_NO_FAIL(con.Query("INSERT INTO integers SELECT * FROM integers" )); | 
| 22 | 		current_count *= 2; | 
| 23 | 	} | 
| 24 |  | 
| 25 | 	result = con.Query("SELECT COUNT(*), COUNT(i), SUM(i) FROM integers" ); | 
| 26 | 	REQUIRE(CHECK_COLUMN(result, 0, {Value::BIGINT(current_count)})); | 
| 27 | 	REQUIRE(CHECK_COLUMN(result, 1, {Value::BIGINT(current_count / 4 * 3)})); | 
| 28 | 	REQUIRE(CHECK_COLUMN(result, 2, {Value::BIGINT(current_count / 4 * 6)})); | 
| 29 | } | 
| 30 |  |