From 9d4501e8d8df548b728b0689547f4c8e78dd7e14 Mon Sep 17 00:00:00 2001 From: Ritalin Date: Wed, 9 Oct 2024 19:13:52 +0900 Subject: [PATCH 1/2] Add static library dependency for cmake configuration --- lib/cmake/duckdb.cmake | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/cmake/duckdb.cmake b/lib/cmake/duckdb.cmake index fcea7d7da..34ba093c0 100644 --- a/lib/cmake/duckdb.cmake +++ b/lib/cmake/duckdb.cmake @@ -87,6 +87,7 @@ target_link_libraries( INTERFACE ${install_dir}/lib/libduckdb_miniz.a INTERFACE ${install_dir}/lib/libduckdb_mbedtls.a INTERFACE ${install_dir}/lib/libduckdb_yyjson.a + INTERFACE ${install_dir}/lib/libduckdb_skiplistlib.a INTERFACE ${install_dir}/lib/libduckdb_pg_query.a INTERFACE ${install_dir}/lib/libduckdb_utf8proc.a INTERFACE ${install_dir}/lib/libduckdb_fastpforlib.a From e77c6eafb484cf3b630067b2ab4f9cd7c8745d13 Mon Sep 17 00:00:00 2001 From: Ritalin Date: Fri, 25 Oct 2024 13:42:48 +0900 Subject: [PATCH 2/2] Modify unit tests --- lib/test/all_types_test.cc | 17 ++++++++++++++--- lib/test/file_page_buffer_test.cc | 20 +++++++++++++++----- lib/test/insert_csv_test.cc | 2 +- lib/test/parquet_test.cc | 3 --- lib/test/web_filesystem_test.cc | 2 -- 5 files changed, 30 insertions(+), 14 deletions(-) diff --git a/lib/test/all_types_test.cc b/lib/test/all_types_test.cc index d6b1a7041..25da3d205 100644 --- a/lib/test/all_types_test.cc +++ b/lib/test/all_types_test.cc @@ -211,6 +211,7 @@ vector SUPPORTED_TYPES = {"bool", "uint", "ubigint", "hugeint", + "uhugeint", "time", "date", "float", @@ -233,7 +234,15 @@ vector SUPPORTED_TYPES = {"bool", "dec38_10", "blob", "bit", - "union"}; + "union", + "fixed_int_array", + "fixed_varchar_array", + "fixed_nested_int_array", + "fixed_nested_varchar_array", + "fixed_struct_array", + "struct_of_fixed_array", + "fixed_array_of_int_list", + "list_of_fixed_int_array"}; vector UNSUPPORTED_TYPES = { // Does not work full range as it overflows during multiplication @@ -306,7 +315,9 @@ TEST(AllTypesTest, FullRangeTypes) { numeric_limits::max(), batch); // Date/Time types - AssertParamTypeCorrect("time", 0, 86399999999, batch, + // Maximum value for duckdb is 86400000000 ('24:00:00.000000') but apache arrow is 86399999999 ('23.59.59.999999') + // so this assertion tests with duckdb value + AssertParamTypeCorrect("time", 0, 86400000000, batch, arrow::time64(arrow::TimeUnit::MICRO)); // AssertParamTypeCorrect("time_tz", 0, 86399999999, batch, // arrow::time64(arrow::TimeUnit::MICRO)); @@ -327,7 +338,7 @@ TEST(AllTypesTest, FullRangeTypes) { arrow::Decimal128("9999999999999999999999999999.9999999999"), batch, arrow::decimal128(38, 10)); // HugeInt from DuckDB is also emitted as a decimal AssertParamTypeCorrect( - "hugeint", arrow::Decimal128("-170141183460469231731687303715884105727"), + "hugeint", arrow::Decimal128("-170141183460469231731687303715884105728"), arrow::Decimal128("170141183460469231731687303715884105727"), batch, arrow::decimal128(38, 0)); // Enum types diff --git a/lib/test/file_page_buffer_test.cc b/lib/test/file_page_buffer_test.cc index 8c6f00fc3..a90b5f6ff 100644 --- a/lib/test/file_page_buffer_test.cc +++ b/lib/test/file_page_buffer_test.cc @@ -90,7 +90,7 @@ TEST(FilePageBufferTest, FixSingle) { // Close the file. // Since there's no more ref, the buffer manager should evict all frames - file->Release(); + file->Release(false); ASSERT_FALSE(buffer->BuffersFile(file_path.c_str())); ASSERT_EQ(buffer->GetFiles().size(), 0); ASSERT_EQ(buffer->GetFrames().size(), 0); @@ -206,7 +206,7 @@ TEST(FilePageBufferTest, FIFOEviction) { EXPECT_EQ(expected_fifo, buffer->GetFIFOList()); EXPECT_TRUE(buffer->GetLRUList().empty()); - file->Release(); + file->Release(false); ASSERT_EQ(buffer->GetFiles().size(), 0); ASSERT_EQ(buffer->GetFrames().size(), 0); } @@ -282,7 +282,7 @@ TEST(FilePageBufferTest, LRUEviction) { EXPECT_EQ(expected_fifo, buffer->GetFIFOList()); EXPECT_EQ(expected_lru, buffer->GetLRUList()); - file->Release(); + file->Release(false); ASSERT_FALSE(buffer->BuffersFile(file_path.c_str())); ASSERT_EQ(buffer->GetFiles().size(), 0); ASSERT_EQ(buffer->GetFrames().size(), 0); @@ -316,7 +316,7 @@ TEST(FilePageBufferTest, ParallelFix) { EXPECT_EQ(expected_fifo, fifo_list); EXPECT_TRUE(buffer->GetLRUList().empty()); - file->Release(); + file->Release(false); ASSERT_FALSE(buffer->BuffersFile(file_path.c_str())); ASSERT_EQ(buffer->GetFiles().size(), 0); ASSERT_EQ(buffer->GetFrames().size(), 0); @@ -362,7 +362,7 @@ TEST(FilePageBufferTest, ParallelExclusiveAccess) { uint64_t value = *reinterpret_cast(page_data.data()); EXPECT_EQ(4000, value); } - file->Release(); + file->Release(false); ASSERT_FALSE(buffer->BuffersFile(file_path.c_str())); ASSERT_EQ(buffer->GetFiles().size(), 0); ASSERT_EQ(buffer->GetFrames().size(), 0); @@ -399,6 +399,8 @@ TEST(FilePageBufferTest, ParallelScans) { std::memset(page_data.data(), 0, buffer->GetPageSize()); page.MarkAsDirty(); } + + file_ref->Release(false); } for (auto& file_path : test_files) { ASSERT_FALSE(buffer->BuffersFile(file_path.c_str())); @@ -440,6 +442,10 @@ TEST(FilePageBufferTest, ParallelScans) { ASSERT_EQ(value, 0) << "j=" << j << " page=" << page_id; } } + + for (auto& file : file_refs) { + file->Release(false); + } }); } @@ -482,6 +488,8 @@ TEST(FilePageBufferTest, ParallelReaderWriter) { std::memset(page_data.data(), 0, buffer->GetPageSize()); page.MarkAsDirty(); } + + file_ref->Release(false); } for (auto& file_path : test_files) { ASSERT_FALSE(buffer->BuffersFile(file_path.c_str())); @@ -560,6 +568,8 @@ TEST(FilePageBufferTest, ParallelReaderWriter) { page.MarkAsDirty(); } } + + file->Release(false); } }); } diff --git a/lib/test/insert_csv_test.cc b/lib/test/insert_csv_test.cc index e152435a3..27ff1038d 100644 --- a/lib/test/insert_csv_test.cc +++ b/lib/test/insert_csv_test.cc @@ -314,7 +314,7 @@ TEST(CSVExportTest, TestExport) { auto path = duckdb::web::test::SOURCE_DIR / ".." / "data" / "test.csv"; // Import csv - auto db = std::make_shared(NATIVE); + auto db = std::make_shared(WEB); WebDB::Connection conn{*db}; auto maybe_ok = conn.InsertCSVFromPath(path.c_str(), R"JSON({ "schema": "main", diff --git a/lib/test/parquet_test.cc b/lib/test/parquet_test.cc index d40038214..ce12557f1 100644 --- a/lib/test/parquet_test.cc +++ b/lib/test/parquet_test.cc @@ -19,7 +19,6 @@ namespace { TEST(ParquetLoadTest, LoadParquet) { auto db = make_shared(NATIVE); - duckdb_web_parquet_init(&db->database()); WebDB::Connection conn{*db}; std::stringstream ss; auto data = test::SOURCE_DIR / ".." / "data" / "uni" / "studenten.parquet"; @@ -34,7 +33,6 @@ TEST(ParquetLoadTest, LoadParquet) { TEST(ParquetLoadTest, LoadParquetTwice) { auto db = make_shared(NATIVE); - duckdb_web_parquet_init(&db->database()); WebDB::Connection conn{*db}; std::stringstream ss; auto data = test::SOURCE_DIR / ".." / "data" / "uni" / "studenten.parquet"; @@ -57,7 +55,6 @@ TEST(ParquetLoadTest, LoadParquetTwice) { TEST(FileSystemBufferTest, FlushFrameMemoryBugRegression) { auto db = make_shared(NATIVE); - duckdb_web_parquet_init(&db->database()); WebDB::Connection conn{*db}; std::string files[] = {"customer", "lineitem", "nation", "orders", "partsupp", "part", "region", "supplier"}; for (const auto& f : files) { diff --git a/lib/test/web_filesystem_test.cc b/lib/test/web_filesystem_test.cc index 0dc83e6eb..78851d3c2 100644 --- a/lib/test/web_filesystem_test.cc +++ b/lib/test/web_filesystem_test.cc @@ -53,7 +53,6 @@ namespace { TEST(WebFileSystemTest, LoadParquet) { auto db = std::make_shared(WEB); - duckdb_web_parquet_init(&db->database()); WebDB::Connection conn{*db}; std::stringstream ss; auto data = test::SOURCE_DIR / ".." / "data" / "uni" / "studenten.parquet"; @@ -68,7 +67,6 @@ TEST(WebFileSystemTest, LoadParquet) { TEST(WebFileSystemTest, TestTPCHScans) { auto db = std::make_shared(WEB); - duckdb_web_parquet_init(&db->database()); WebDB::Connection conn{*db}; std::string files[] = {"customer", "lineitem", "nation", "orders", "partsupp", "part", "region", "supplier"}; for (const auto& f : files) {