Skip to content

Commit

Permalink
Merge branch 'main' into uhugeint
Browse files Browse the repository at this point in the history
  • Loading branch information
nickgerrets committed Nov 22, 2023
2 parents d280fd7 + b81d8c2 commit 655af48
Show file tree
Hide file tree
Showing 302 changed files with 16,991 additions and 14,055 deletions.
23 changes: 18 additions & 5 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,27 @@ body:
attributes:
value: >
DuckDB has several repositories for different components, please make sure you're raising your issue in the correct one:
* [Our docs/website](https://github.com/duckdb/duckdb-web/issues/new)
* [DuckDB-Wasm](https://github.com/duckdb/duckdb-wasm/issues/new)
* [DuckDB-R](https://github.com/duckdb/duckdb-r/issues/new)
* [SQLite scanner](https://github.com/duckdblabs/sqlite_scanner/issues/new)
* [Postgres scanner](https://github.com/duckdblabs/postgres_scanner/issues/new)
* [Documentation/website](https://github.com/duckdb/duckdb-web/issues/new)
* APIs:
* [duckdb-node](https://github.com/duckdb/duckdb-node/issues/new)
* [duckdb-r](https://github.com/duckdb/duckdb-r/issues/new)
* [duckdb-rs](https://github.com/duckdb/duckdb-rs/issues/new)
* [duckdb-wasm](https://github.com/duckdb/duckdb-wasm/issues/new)
* [go-duckdb](https://github.com/marcboeker/go-duckdb/issues/new)
* Extensions:
* [AWS extension](https://github.com/duckdb/duckdb_aws/issues/new)
* [Azure extension](https://github.com/duckdb/duckdb_azure/issues/new)
* [Iceberg extension](https://github.com/duckdb/duckdb_iceberg/issues/new)
* [MySQL extension](https://github.com/duckdb/duckdb_mysql/issues/new)
* [Postgres scanner](https://github.com/duckdb/postgres_scanner/issues/new)
* [Spatial extension](https://github.com/duckdb/duckdb_spatial/issues/new)
* [SQLite scanner](https://github.com/duckdb/sqlite_scanner/issues/new)
If none of the above repositories are applicable, feel free to raise it in this one
Please report security vulnerabilities using GitHub's [report vulnerability form](https://github.com/duckdb/duckdb/security/advisories/new).
- type: textarea
attributes:
label: What happens?
Expand Down
2 changes: 1 addition & 1 deletion .github/config/out_of_tree_extensions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ duckdb_extension_load(postgres_scanner
duckdb_extension_load(spatial
DONT_LINK LOAD_TESTS
GIT_URL https://github.com/duckdb/duckdb_spatial.git
GIT_TAG 36e5a126976ac3b66716893360ef7e6295707082
GIT_TAG a86c504d60e0f4400564c0f2d633547f39feef2c
INCLUDE_DIR spatial/include
TEST_DIR test/sql
APPLY_PATCHES
Expand Down
1 change: 0 additions & 1 deletion .github/config/uncovered_files.csv
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,6 @@ execution/operator/join/physical_asof_join.cpp 38
execution/operator/join/physical_blockwise_nl_join.cpp 2
execution/operator/join/physical_hash_join.cpp 8
execution/operator/join/physical_iejoin.cpp 32
execution/operator/join/physical_index_join.cpp 3
execution/operator/join/physical_nested_loop_join.cpp 4
execution/operator/join/physical_piecewise_merge_join.cpp 142
execution/operator/join/physical_range_join.cpp 62
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
diff --git a/spatial/src/spatial/gdal/functions/st_write.cpp b/spatial/src/spatial/gdal/functions/st_write.cpp
index 36a71da..15ebcf4 100644
index 266a52a..15ebcf4 100644
--- a/spatial/src/spatial/gdal/functions/st_write.cpp
+++ b/spatial/src/spatial/gdal/functions/st_write.cpp
@@ -55,8 +55,8 @@ struct GlobalState : public GlobalFunctionData {
@@ -55,14 +55,9 @@ struct GlobalState : public GlobalFunctionData {
//===--------------------------------------------------------------------===//
// Bind
//===--------------------------------------------------------------------===//
-// The parameters are const in duckdb > 0.9.1, ifdef so we can build for both versions for now.
-#if DUCKDB_PATCH_VERSION == 1
-static unique_ptr<FunctionData> Bind(ClientContext &context, CopyInfo &info, vector<string> &names,
- vector<LogicalType> &sql_types) {
+static unique_ptr<FunctionData> Bind(ClientContext &context, const CopyInfo &info, const vector<string> &names,
+ const vector<LogicalType> &sql_types) {

-#else
static unique_ptr<FunctionData> Bind(ClientContext &context, const CopyInfo &info, const vector<string> &names,
const vector<LogicalType> &sql_types) {
-#endif
+
GdalFileHandler::SetLocalClientContext(context);

auto bind_data = make_uniq<BindData>(info.file_path, sql_types, names);
1 change: 1 addition & 0 deletions .github/regression/tpcds.csv
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ benchmark/tpcds/sf1/q81.benchmark
benchmark/tpcds/sf1/q82.benchmark
benchmark/tpcds/sf1/q83.benchmark
benchmark/tpcds/sf1/q84.benchmark
benchmark/tpcds/sf1/q85.benchmark
benchmark/tpcds/sf1/q86.benchmark
benchmark/tpcds/sf1/q87.benchmark
benchmark/tpcds/sf1/q88.benchmark
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/LinuxRelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -385,8 +385,8 @@ jobs:
- name: Test
shell: bash
run: |
python3 scripts/get_test_list.py --file-contains 'require-env S3_TEST_SERVER_AVAILABLE 1' --list '"*"' > test.list
build/release/test/unittest -f test.list
python3 scripts/get_test_list.py --file-contains 'require httpfs' --list '"*"' > test.list
python3 scripts/run_tests_one_by_one.py ./build/release/test/unittest '-f test.list'
amalgamation-tests:
name: Amalgamation Tests
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/Wasm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
duckdb_wasm_arch: [ 'mvp', 'eh' ]
duckdb_wasm_arch: [ 'mvp', 'eh', 'threads' ]
env:
GEN: Ninja
VCPKG_TOOLCHAIN_PATH: ${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake
Expand Down
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,12 @@ wasm_eh: ${EXTENSION_CONFIG_STEP}
emmake make -j8 -Cbuild/wasm_eh && \
cd build/wasm_eh && bash ../../scripts/link-wasm-extensions.sh

wasm_threads: ${EXTENSION_CONFIG_STEP}
mkdir -p ./build/wasm_threads && \
emcmake cmake $(GENERATOR) -DWASM_LOADABLE_EXTENSIONS=1 -DBUILD_EXTENSIONS_ONLY=1 -Bbuild/wasm_threads -DCMAKE_CXX_FLAGS="-fwasm-exceptions -DWEBDB_FAST_EXCEPTIONS=1 -DWITH_WASM_THREADS=1 -DWITH_WASM_SIMD=1 -DWITH_WASM_BULK_MEMORY=1 -DDUCKDB_CUSTOM_PLATFORM=wasm_threads" && \
emmake make -j8 -Cbuild/wasm_threads && \
cd build/wasm_threads && bash ../../scripts/link-wasm-extensions.sh

cldebug: ${EXTENSION_CONFIG_STEP}
mkdir -p ./build/cldebug && \
cd build/cldebug && \
Expand Down
11 changes: 9 additions & 2 deletions benchmark/micro/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
include_directories(../../third_party/sqlite/include)
add_library(
duckdb_benchmark_micro OBJECT append.cpp append_mix.cpp bulkupdate.cpp
cast.cpp in.cpp storage.cpp)
duckdb_benchmark_micro OBJECT
append.cpp
append_mix.cpp
attach.cpp
bulkupdate.cpp
cast.cpp
in.cpp
storage.cpp)

set(BENCHMARK_OBJECT_FILES
${BENCHMARK_OBJECT_FILES} $<TARGET_OBJECTS:duckdb_benchmark_micro>
PARENT_SCOPE)
168 changes: 168 additions & 0 deletions benchmark/micro/attach.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,168 @@
#include "benchmark_runner.hpp"
#include "duckdb_benchmark_macro.hpp"

#include <thread>
#include <iostream>
#include <fstream>

using namespace duckdb;

DUCKDB_BENCHMARK(ParallelAttach, "[attach]")

// NOTE: the FILE_COUNT number is intentionally low. However, this test is intended to run with
// higher numbers after increasing the OS open file limit

static void FileWorker(const string &dir, const string &template_path, const idx_t start, const idx_t end) {

for (idx_t i = start; i < end; i++) {

auto duplicate_path = dir + "/board_" + to_string(i) + ".db";
std::ifstream template_file(template_path, std::ios::binary);
std::ofstream duplicate(duplicate_path, std::ios::binary);
duplicate << template_file.rdbuf();
}
}

void CreateFiles(const idx_t file_count, string db_file_dir) {

db_file_dir += "/" + to_string(file_count) + "_files";
duckdb::unique_ptr<FileSystem> fs = FileSystem::CreateLocal();
if (!fs->DirectoryExists(db_file_dir)) {
fs->CreateDirectory(db_file_dir);
}

DuckDB db(nullptr);
Connection con(db);

// create the template file
auto template_path = db_file_dir + "/template_file.db";
auto attach_result = con.Query("ATTACH '" + template_path + "';");
D_ASSERT(!attach_result->HasError());

auto create_table_result = con.Query("CREATE TABLE tbl AS "
"SELECT range::INTEGER AS id, range::BIGINT AS status, range::DOUBLE AS "
"amount, repeat(range::VARCHAR, 20) AS text "
"FROM range(100);");
D_ASSERT(!create_table_result->HasError());

auto detach_result = con.Query("DETACH template_file;");
D_ASSERT(!detach_result->HasError());

// loop setup
const idx_t thread_count = 32;
vector<std::thread> threads;
idx_t files_per_thread = double(file_count) / double(thread_count);
idx_t remaining_files = file_count % thread_count;
idx_t end = 0;

// spawn and run file creation workers
for (idx_t i = 0; i < thread_count; i++) {

idx_t thread_file_count = files_per_thread;
if (i < remaining_files) {
thread_file_count++;
}
idx_t start = end;
end += thread_file_count;

threads.push_back(std::thread(FileWorker, db_file_dir, template_path, start, end));
}

for (idx_t i = 0; i < thread_count; i++) {
threads[i].join();
}
}

static void AttachWorker(const string &dir, const idx_t start, const idx_t end, DuckDB &db) {

Connection con(db);

for (idx_t i = start; i < end; i++) {
auto filepath = dir + "/board_" + to_string(i) + ".db";
auto result = con.Query("ATTACH '" + filepath + "' (READ_ONLY, TYPE DUCKDB);");
D_ASSERT(!result->HasError());
}
}

void Attach(const idx_t file_count, const idx_t thread_count, string db_file_dir) {

db_file_dir += "/" + to_string(file_count) + "_files";
DuckDB db(nullptr);

// loop setup
vector<std::thread> threads;
idx_t files_per_thread = double(file_count) / double(thread_count);
idx_t remaining_files = file_count % thread_count;
idx_t end = 0;

// spawn and run attach workers
for (idx_t i = 0; i < thread_count; i++) {

idx_t thread_file_count = files_per_thread;
if (i < remaining_files) {
thread_file_count++;
}
idx_t start = end;
end += thread_file_count;

threads.push_back(std::thread(AttachWorker, db_file_dir, start, end, std::ref(db)));
}

for (idx_t i = 0; i < thread_count; i++) {
threads[i].join();
}

// verify the result
Connection con(db);
auto result = con.Query("SELECT count(*) > $1 AS count FROM duckdb_databases()", file_count);
D_ASSERT(!result->HasError());

auto result_str = result->ToString();
D_ASSERT(result_str.find("true") != string::npos);
}

void Load(DuckDBBenchmarkState *state) override {

const string DB_DIR = TestDirectoryPath() + "/attach";
const string DB_FILE_DIR = DB_DIR + "/db_files";

// set up the directories
unique_ptr<FileSystem> fs = FileSystem::CreateLocal();
if (!fs->DirectoryExists(DB_DIR)) {
fs->CreateDirectory(DB_DIR);
}
if (!fs->DirectoryExists(DB_FILE_DIR)) {
fs->CreateDirectory(DB_FILE_DIR);
}

// create the files
const idx_t FILE_COUNT = 100;
CreateFiles(FILE_COUNT, DB_FILE_DIR);
}

void RunBenchmark(DuckDBBenchmarkState *state) override {

const string DB_DIR = TestDirectoryPath() + "/attach";
const string DB_FILE_DIR = DB_DIR + "/db_files";

const idx_t FILE_COUNT = 100;
const idx_t THREAD_COUNT = 64;
Attach(FILE_COUNT, THREAD_COUNT, DB_FILE_DIR);
}

string VerifyResult(QueryResult *result) override {

const string DB_DIR = TestDirectoryPath() + "/attach";
const string DB_FILE_DIR = DB_DIR + "/db_files";

// we use this function to clean up the directories
unique_ptr<FileSystem> fs = FileSystem::CreateLocal();
fs->RemoveDirectory(DB_FILE_DIR);

return string();
}

string BenchmarkInfo() override {
return "Run parallel attach statements";
}
FINISH_BENCHMARK(ParallelAttach)
17 changes: 0 additions & 17 deletions benchmark/micro/index/join/index_join_art.benchmark

This file was deleted.

22 changes: 0 additions & 22 deletions benchmark/micro/join/indexjoin_highcardinality.benchmark

This file was deleted.

15 changes: 0 additions & 15 deletions benchmark/micro/join/indexjoin_lhsarithmetic.benchmark

This file was deleted.

1 change: 0 additions & 1 deletion benchmark/micro/storage.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#include "benchmark_runner.hpp"
#include "duckdb_benchmark_macro.hpp"
#include "duckdb/main/appender.hpp"

using namespace duckdb;

Expand Down
Loading

0 comments on commit 655af48

Please sign in to comment.