Skip to content

Commit 85803a6

Browse files
Update vendored DuckDB sources to e8506d9
1 parent e8506d9 commit 85803a6

File tree

125 files changed

+1243
-1209
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

125 files changed

+1243
-1209
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ project(DuckDBJava)
2323

2424
include_directories(${JAVA_INCLUDE_PATH} ${JAVA_INCLUDE_PATH2})
2525

26-
include_directories(src/duckdb/src/include src/duckdb/third_party/concurrentqueue src/duckdb/third_party/fast_float src/duckdb/third_party/fastpforlib src/duckdb/third_party/fmt/include src/duckdb/third_party/fsst src/duckdb/third_party/httplib src/duckdb/third_party/hyperloglog src/duckdb/third_party/jaro_winkler src/duckdb/third_party/jaro_winkler/details src/duckdb/third_party/libpg_query src/duckdb/third_party/libpg_query/include src/duckdb/third_party/lz4 src/duckdb/third_party/brotli/include src/duckdb/third_party/brotli/common src/duckdb/third_party/brotli/dec src/duckdb/third_party/brotli/enc src/duckdb/third_party/mbedtls src/duckdb/third_party/mbedtls/include src/duckdb/third_party/mbedtls/library src/duckdb/third_party/miniz src/duckdb/third_party/pcg src/duckdb/third_party/re2 src/duckdb/third_party/skiplist src/duckdb/third_party/tdigest src/duckdb/third_party/utf8proc src/duckdb/third_party/utf8proc/include src/duckdb/third_party/yyjson/include src/duckdb/third_party/zstd/include src/duckdb/extension/core_functions/include src/duckdb/extension/parquet/include src/duckdb/third_party/parquet src/duckdb/third_party/thrift src/duckdb/third_party/lz4 src/duckdb/third_party/brotli/include src/duckdb/third_party/brotli/common src/duckdb/third_party/brotli/dec src/duckdb/third_party/brotli/enc src/duckdb/third_party/snappy src/duckdb/third_party/mbedtls src/duckdb/third_party/mbedtls/include src/duckdb/third_party/zstd/include src/duckdb/extension/icu/include src/duckdb/extension/icu/third_party/icu/common src/duckdb/extension/icu/third_party/icu/i18n src/duckdb/extension/json/include src/duckdb/extension/jemalloc/include src/duckdb/extension/jemalloc/jemalloc/include)
26+
include_directories(src/duckdb/src/include src/duckdb/third_party/concurrentqueue src/duckdb/third_party/fast_float src/duckdb/third_party/fastpforlib src/duckdb/third_party/fmt/include src/duckdb/third_party/fsst src/duckdb/third_party/httplib src/duckdb/third_party/hyperloglog src/duckdb/third_party/jaro_winkler src/duckdb/third_party/jaro_winkler/details src/duckdb/third_party/libpg_query src/duckdb/third_party/libpg_query/include src/duckdb/third_party/lz4 src/duckdb/third_party/brotli/include src/duckdb/third_party/brotli/common src/duckdb/third_party/brotli/dec src/duckdb/third_party/brotli/enc src/duckdb/third_party/mbedtls/include src/duckdb/third_party/mbedtls/library src/duckdb/third_party/miniz src/duckdb/third_party/pcg src/duckdb/third_party/re2 src/duckdb/third_party/skiplist src/duckdb/third_party/tdigest src/duckdb/third_party/utf8proc src/duckdb/third_party/utf8proc/include src/duckdb/third_party/yyjson/include src/duckdb/third_party/zstd/include src/duckdb/extension/core_functions/include src/duckdb/extension/parquet/include src/duckdb/third_party/parquet src/duckdb/third_party/thrift src/duckdb/third_party/lz4 src/duckdb/third_party/brotli/include src/duckdb/third_party/brotli/common src/duckdb/third_party/brotli/dec src/duckdb/third_party/brotli/enc src/duckdb/third_party/snappy src/duckdb/third_party/mbedtls src/duckdb/third_party/mbedtls/include src/duckdb/third_party/zstd/include src/duckdb/extension/icu/include src/duckdb/extension/icu/third_party/icu/common src/duckdb/extension/icu/third_party/icu/i18n src/duckdb/extension/json/include src/duckdb/extension/jemalloc/include src/duckdb/extension/jemalloc/jemalloc/include)
2727
add_definitions(-DDUCKDB_EXTENSION_CORE_FUNCTIONS_LINKED -DDUCKDB_EXTENSION_PARQUET_LINKED -DDUCKDB_EXTENSION_ICU_LINKED -DDUCKDB_EXTENSION_JSON_LINKED -DDUCKDB_EXTENSION_JEMALLOC_LINKED)
2828
add_definitions(-DDUCKDB_EXTENSION_AUTOLOAD_DEFAULT=1 -DDUCKDB_EXTENSION_AUTOINSTALL_DEFAULT=1)
2929

src/duckdb/extension/core_functions/core_functions_extension.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ namespace duckdb {
1212
template <class T>
1313
static void FillExtraInfo(const StaticFunctionDefinition &function, T &info) {
1414
info.internal = true;
15+
info.alias_of = function.alias_of;
1516
FillFunctionDescriptions(function, info);
1617
info.on_conflict = OnCreateConflict::ALTER_ON_CONFLICT;
1718
}

src/duckdb/extension/core_functions/function_list.cpp

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -24,27 +24,27 @@
2424
namespace duckdb {
2525

2626
// Scalar Function
27-
#define DUCKDB_SCALAR_FUNCTION_BASE(_PARAM, _NAME) \
28-
{ _NAME, _PARAM::Parameters, _PARAM::Description, _PARAM::Example, _PARAM::GetFunction, nullptr, nullptr, nullptr }
29-
#define DUCKDB_SCALAR_FUNCTION(_PARAM) DUCKDB_SCALAR_FUNCTION_BASE(_PARAM, _PARAM::Name)
30-
#define DUCKDB_SCALAR_FUNCTION_ALIAS(_PARAM) DUCKDB_SCALAR_FUNCTION_BASE(_PARAM::ALIAS, _PARAM::Name)
27+
#define DUCKDB_SCALAR_FUNCTION_BASE(_PARAM, _NAME, _ALIAS_OF) \
28+
{ _NAME, _ALIAS_OF, _PARAM::Parameters, _PARAM::Description, _PARAM::Example, _PARAM::GetFunction, nullptr, nullptr, nullptr }
29+
#define DUCKDB_SCALAR_FUNCTION(_PARAM) DUCKDB_SCALAR_FUNCTION_BASE(_PARAM, _PARAM::Name, _PARAM::Name)
30+
#define DUCKDB_SCALAR_FUNCTION_ALIAS(_PARAM) DUCKDB_SCALAR_FUNCTION_BASE(_PARAM::ALIAS, _PARAM::Name, _PARAM::ALIAS::Name)
3131
// Scalar Function Set
32-
#define DUCKDB_SCALAR_FUNCTION_SET_BASE(_PARAM, _NAME) \
33-
{ _NAME, _PARAM::Parameters, _PARAM::Description, _PARAM::Example, nullptr, _PARAM::GetFunctions, nullptr, nullptr }
34-
#define DUCKDB_SCALAR_FUNCTION_SET(_PARAM) DUCKDB_SCALAR_FUNCTION_SET_BASE(_PARAM, _PARAM::Name)
35-
#define DUCKDB_SCALAR_FUNCTION_SET_ALIAS(_PARAM) DUCKDB_SCALAR_FUNCTION_SET_BASE(_PARAM::ALIAS, _PARAM::Name)
32+
#define DUCKDB_SCALAR_FUNCTION_SET_BASE(_PARAM, _NAME, _ALIAS_OF) \
33+
{ _NAME, _ALIAS_OF, _PARAM::Parameters, _PARAM::Description, _PARAM::Example, nullptr, _PARAM::GetFunctions, nullptr, nullptr }
34+
#define DUCKDB_SCALAR_FUNCTION_SET(_PARAM) DUCKDB_SCALAR_FUNCTION_SET_BASE(_PARAM, _PARAM::Name, _PARAM::Name)
35+
#define DUCKDB_SCALAR_FUNCTION_SET_ALIAS(_PARAM) DUCKDB_SCALAR_FUNCTION_SET_BASE(_PARAM::ALIAS, _PARAM::Name, _PARAM::ALIAS::Name)
3636
// Aggregate Function
37-
#define DUCKDB_AGGREGATE_FUNCTION_BASE(_PARAM, _NAME) \
38-
{ _NAME, _PARAM::Parameters, _PARAM::Description, _PARAM::Example, nullptr, nullptr, _PARAM::GetFunction, nullptr }
39-
#define DUCKDB_AGGREGATE_FUNCTION(_PARAM) DUCKDB_AGGREGATE_FUNCTION_BASE(_PARAM, _PARAM::Name)
40-
#define DUCKDB_AGGREGATE_FUNCTION_ALIAS(_PARAM) DUCKDB_AGGREGATE_FUNCTION_BASE(_PARAM::ALIAS, _PARAM::Name)
37+
#define DUCKDB_AGGREGATE_FUNCTION_BASE(_PARAM, _NAME, _ALIAS_OF) \
38+
{ _NAME, _ALIAS_OF, _PARAM::Parameters, _PARAM::Description, _PARAM::Example, nullptr, nullptr, _PARAM::GetFunction, nullptr }
39+
#define DUCKDB_AGGREGATE_FUNCTION(_PARAM) DUCKDB_AGGREGATE_FUNCTION_BASE(_PARAM, _PARAM::Name, _PARAM::Name)
40+
#define DUCKDB_AGGREGATE_FUNCTION_ALIAS(_PARAM) DUCKDB_AGGREGATE_FUNCTION_BASE(_PARAM::ALIAS, _PARAM::Name, _PARAM::ALIAS::Name)
4141
// Aggregate Function Set
42-
#define DUCKDB_AGGREGATE_FUNCTION_SET_BASE(_PARAM, _NAME) \
43-
{ _NAME, _PARAM::Parameters, _PARAM::Description, _PARAM::Example, nullptr, nullptr, nullptr, _PARAM::GetFunctions }
44-
#define DUCKDB_AGGREGATE_FUNCTION_SET(_PARAM) DUCKDB_AGGREGATE_FUNCTION_SET_BASE(_PARAM, _PARAM::Name)
45-
#define DUCKDB_AGGREGATE_FUNCTION_SET_ALIAS(_PARAM) DUCKDB_AGGREGATE_FUNCTION_SET_BASE(_PARAM::ALIAS, _PARAM::Name)
42+
#define DUCKDB_AGGREGATE_FUNCTION_SET_BASE(_PARAM, _NAME, _ALIAS_OF) \
43+
{ _NAME, _ALIAS_OF, _PARAM::Parameters, _PARAM::Description, _PARAM::Example, nullptr, nullptr, nullptr, _PARAM::GetFunctions }
44+
#define DUCKDB_AGGREGATE_FUNCTION_SET(_PARAM) DUCKDB_AGGREGATE_FUNCTION_SET_BASE(_PARAM, _PARAM::Name, _PARAM::Name)
45+
#define DUCKDB_AGGREGATE_FUNCTION_SET_ALIAS(_PARAM) DUCKDB_AGGREGATE_FUNCTION_SET_BASE(_PARAM::ALIAS, _PARAM::Name, _PARAM::ALIAS::Name)
4646
#define FINAL_FUNCTION \
47-
{ nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr }
47+
{ nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr }
4848

4949
// this list is generated by scripts/generate_functions.py
5050
static const StaticFunctionDefinition core_functions[] = {

src/duckdb/extension/core_functions/include/core_functions/function_list.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ typedef AggregateFunctionSet (*get_aggregate_function_set_t)();
1919

2020
struct StaticFunctionDefinition {
2121
const char *name;
22+
const char *alias_of;
2223
const char *parameters;
2324
const char *description;
2425
const char *example;

src/duckdb/extension/json/json_functions/json_serialize_sql.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,10 @@ ScalarFunctionSet JSONFunctions::GetSerializeSqlFunction() {
161161
{LogicalType::VARCHAR, LogicalType::BOOLEAN, LogicalType::BOOLEAN, LogicalType::BOOLEAN}, LogicalType::JSON(),
162162
JsonSerializeFunction, JsonSerializeBind, nullptr, nullptr, JSONFunctionLocalState::Init));
163163

164+
set.AddFunction(ScalarFunction(
165+
{LogicalType::VARCHAR, LogicalType::BOOLEAN, LogicalType::BOOLEAN, LogicalType::BOOLEAN, LogicalType::BOOLEAN},
166+
LogicalType::JSON(), JsonSerializeFunction, JsonSerializeBind, nullptr, nullptr, JSONFunctionLocalState::Init));
167+
164168
return set;
165169
}
166170

src/duckdb/extension/parquet/parquet_metadata.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -771,7 +771,7 @@ void ParquetMetaDataImplementation(ClientContext &context, TableFunctionInput &d
771771
break;
772772
case ParquetMetadataOperatorType::BLOOM_PROBE: {
773773
auto &bloom_probe_bind_data = data_p.bind_data->Cast<ParquetBloomProbeBindData>();
774-
data.ExecuteBloomProbe(context, bind_data.return_types, bind_data.file_list->GetFirstFile(),
774+
data.ExecuteBloomProbe(context, bind_data.return_types, data.current_file,
775775
bloom_probe_bind_data.probe_column_name, bloom_probe_bind_data.probe_constant);
776776
break;
777777
}

src/duckdb/src/common/arrow/physical_arrow_collector.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ namespace duckdb {
1010

1111
unique_ptr<PhysicalResultCollector> PhysicalArrowCollector::Create(ClientContext &context, PreparedStatementData &data,
1212
idx_t batch_size) {
13-
if (!PhysicalPlanGenerator::PreserveInsertionOrder(context, *data.plan)) {
13+
if (!PhysicalPlanGenerator::PreserveInsertionOrder(context, data.physical_plan->Root())) {
1414
// the plan is not order preserving, so we just use the parallel materialized collector
1515
return make_uniq_base<PhysicalResultCollector, PhysicalArrowCollector>(data, true, batch_size);
16-
} else if (!PhysicalPlanGenerator::UseBatchIndex(context, *data.plan)) {
16+
} else if (!PhysicalPlanGenerator::UseBatchIndex(context, data.physical_plan->Root())) {
1717
// the plan is order preserving, but we cannot use the batch index: use a single-threaded result collector
1818
return make_uniq_base<PhysicalResultCollector, PhysicalArrowCollector>(data, false, batch_size);
1919
} else {

src/duckdb/src/common/multi_file_reader.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,6 @@ vector<string> MultiFileReader::ParsePaths(const Value &input) {
8383

8484
shared_ptr<MultiFileList> MultiFileReader::CreateFileList(ClientContext &context, const vector<string> &paths,
8585
FileGlobOptions options) {
86-
vector<string> result_files;
87-
8886
auto res = make_uniq<GlobMultiFileList>(context, paths, options);
8987
if (res->GetExpandResult() == FileExpandResult::NO_FILES && options == FileGlobOptions::DISALLOW_EMPTY) {
9088
throw IOException("%s needs at least one file to read", function_name);

src/duckdb/src/common/types/vector.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,6 @@ void Vector::SetValue(idx_t index, const Value &val) {
434434
}
435435
D_ASSERT(val.IsNull() || (val.type().InternalType() == GetType().InternalType()));
436436

437-
validity.EnsureWritable();
438437
validity.Set(index, !val.IsNull());
439438
auto physical_type = GetType().InternalType();
440439
if (val.IsNull() && !IsStructOrArrayRecursive(GetType())) {

src/duckdb/src/execution/index/art/plan_art.cpp

Lines changed: 19 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@
99

1010
namespace duckdb {
1111

12-
unique_ptr<PhysicalOperator> ART::CreatePlan(PlanIndexInput &input) {
12+
PhysicalOperator &ART::CreatePlan(PlanIndexInput &input) {
1313
auto &op = input.op;
14+
auto &planner = input.planner;
1415

1516
// PROJECTION on indexed columns.
1617
vector<LogicalType> new_column_types;
@@ -22,11 +23,11 @@ unique_ptr<PhysicalOperator> ART::CreatePlan(PlanIndexInput &input) {
2223
new_column_types.emplace_back(LogicalType::ROW_TYPE);
2324
select_list.push_back(make_uniq<BoundReferenceExpression>(LogicalType::ROW_TYPE, op.info->scan_types.size() - 1));
2425

25-
auto projection = make_uniq<PhysicalProjection>(new_column_types, std::move(select_list), op.estimated_cardinality);
26-
projection->children.push_back(std::move(input.table_scan));
26+
auto &proj = planner.Make<PhysicalProjection>(new_column_types, std::move(select_list), op.estimated_cardinality);
27+
proj.children.push_back(input.table_scan);
2728

2829
// Optional NOT NULL filter.
29-
unique_ptr<PhysicalOperator> prev_operator;
30+
reference<PhysicalOperator> prev_op(proj);
3031
auto is_alter = op.alter_table_info != nullptr;
3132
if (!is_alter) {
3233
vector<LogicalType> filter_types;
@@ -41,13 +42,10 @@ unique_ptr<PhysicalOperator> ART::CreatePlan(PlanIndexInput &input) {
4142
filter_select_list.push_back(std::move(is_not_null_expr));
4243
}
4344

44-
prev_operator =
45-
make_uniq<PhysicalFilter>(std::move(filter_types), std::move(filter_select_list), op.estimated_cardinality);
46-
prev_operator->types.emplace_back(LogicalType::ROW_TYPE);
47-
prev_operator->children.push_back(std::move(projection));
48-
49-
} else {
50-
prev_operator = std::move(projection);
45+
prev_op = planner.Make<PhysicalFilter>(std::move(filter_types), std::move(filter_select_list),
46+
op.estimated_cardinality);
47+
prev_op.get().types.emplace_back(LogicalType::ROW_TYPE);
48+
prev_op.get().children.push_back(proj);
5149
}
5250

5351
// Determine whether to push an ORDER BY operator.
@@ -59,13 +57,13 @@ unique_ptr<PhysicalOperator> ART::CreatePlan(PlanIndexInput &input) {
5957
}
6058

6159
// CREATE INDEX operator.
62-
auto physical_create_index = make_uniq<PhysicalCreateARTIndex>(
63-
op, op.table, op.info->column_ids, std::move(op.info), std::move(op.unbound_expressions),
64-
op.estimated_cardinality, sort, std::move(op.alter_table_info));
60+
auto &create_idx = planner.Make<PhysicalCreateARTIndex>(op, op.table, op.info->column_ids, std::move(op.info),
61+
std::move(op.unbound_expressions), op.estimated_cardinality,
62+
sort, std::move(op.alter_table_info));
6563

6664
if (!sort) {
67-
physical_create_index->children.push_back(std::move(prev_operator));
68-
return std::move(physical_create_index);
65+
create_idx.children.push_back(prev_op);
66+
return create_idx;
6967
}
7068

7169
// ORDER BY operator.
@@ -78,12 +76,11 @@ unique_ptr<PhysicalOperator> ART::CreatePlan(PlanIndexInput &input) {
7876
}
7977
projections.emplace_back(new_column_types.size() - 1);
8078

81-
auto physical_order =
82-
make_uniq<PhysicalOrder>(new_column_types, std::move(orders), std::move(projections), op.estimated_cardinality);
83-
84-
physical_order->children.push_back(std::move(prev_operator));
85-
physical_create_index->children.push_back(std::move(physical_order));
86-
return std::move(physical_create_index);
79+
auto &order = planner.Make<PhysicalOrder>(new_column_types, std::move(orders), std::move(projections),
80+
op.estimated_cardinality);
81+
order.children.push_back(prev_op);
82+
create_idx.children.push_back(order);
83+
return create_idx;
8784
}
8885

8986
} // namespace duckdb

0 commit comments

Comments
 (0)