duckdb 0.8.2-dev2399.0 → 0.8.2-dev2669.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/binding.gyp +1 -0
- package/package.json +1 -1
- package/src/duckdb/extension/icu/icu-datepart.cpp +3 -3
- package/src/duckdb/src/catalog/catalog_entry/duck_table_entry.cpp +1 -1
- package/src/duckdb/src/catalog/default/default_functions.cpp +5 -0
- package/src/duckdb/src/common/enum_util.cpp +35 -1
- package/src/duckdb/src/common/http_state.cpp +78 -0
- package/src/duckdb/src/core_functions/function_list.cpp +2 -2
- package/src/duckdb/src/core_functions/scalar/list/array_slice.cpp +314 -82
- package/src/duckdb/src/execution/expression_executor/execute_parameter.cpp +2 -2
- package/src/duckdb/src/execution/index/art/art.cpp +43 -31
- package/src/duckdb/src/execution/index/art/leaf.cpp +47 -33
- package/src/duckdb/src/execution/index/art/node.cpp +31 -24
- package/src/duckdb/src/execution/index/art/prefix.cpp +100 -16
- package/src/duckdb/src/execution/operator/schema/physical_create_index.cpp +54 -31
- package/src/duckdb/src/execution/physical_plan/plan_create_index.cpp +32 -15
- package/src/duckdb/src/function/table/arrow/arrow_duck_schema.cpp +57 -0
- package/src/duckdb/src/function/table/arrow.cpp +95 -92
- package/src/duckdb/src/function/table/arrow_conversion.cpp +45 -68
- package/src/duckdb/src/function/table/version/pragma_version.cpp +2 -2
- package/src/duckdb/src/include/duckdb/common/case_insensitive_map.hpp +1 -0
- package/src/duckdb/src/include/duckdb/common/enum_util.hpp +8 -0
- package/src/duckdb/src/include/duckdb/common/helper.hpp +8 -3
- package/src/duckdb/src/include/duckdb/common/http_state.hpp +61 -28
- package/src/duckdb/src/include/duckdb/common/types/value.hpp +4 -1
- package/src/duckdb/src/include/duckdb/core_functions/scalar/list_functions.hpp +4 -4
- package/src/duckdb/src/include/duckdb/execution/index/art/art.hpp +7 -5
- package/src/duckdb/src/include/duckdb/execution/index/art/leaf.hpp +6 -6
- package/src/duckdb/src/include/duckdb/execution/index/art/node.hpp +6 -0
- package/src/duckdb/src/include/duckdb/execution/index/art/prefix.hpp +9 -11
- package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_create_index.hpp +8 -1
- package/src/duckdb/src/include/duckdb/function/table/arrow/arrow_duck_schema.hpp +99 -0
- package/src/duckdb/src/include/duckdb/function/table/arrow.hpp +6 -36
- package/src/duckdb/src/include/duckdb/main/capi/capi_internal.hpp +3 -1
- package/src/duckdb/src/include/duckdb/main/client_context.hpp +15 -14
- package/src/duckdb/src/include/duckdb/main/prepared_statement.hpp +73 -5
- package/src/duckdb/src/include/duckdb/main/prepared_statement_data.hpp +6 -6
- package/src/duckdb/src/include/duckdb/parser/expression/operator_expression.hpp +20 -3
- package/src/duckdb/src/include/duckdb/parser/expression/parameter_expression.hpp +17 -1
- package/src/duckdb/src/include/duckdb/parser/statement/execute_statement.hpp +1 -1
- package/src/duckdb/src/include/duckdb/parser/transformer.hpp +5 -3
- package/src/duckdb/src/include/duckdb/planner/bound_parameter_map.hpp +2 -1
- package/src/duckdb/src/include/duckdb/planner/expression/bound_parameter_data.hpp +20 -5
- package/src/duckdb/src/include/duckdb/planner/expression/bound_parameter_expression.hpp +3 -3
- package/src/duckdb/src/include/duckdb/planner/planner.hpp +4 -3
- package/src/duckdb/src/include/duckdb/storage/object_cache.hpp +1 -1
- package/src/duckdb/src/include/duckdb/verification/prepared_statement_verifier.hpp +1 -1
- package/src/duckdb/src/include/duckdb.h +16 -0
- package/src/duckdb/src/main/capi/pending-c.cpp +6 -0
- package/src/duckdb/src/main/capi/prepared-c.cpp +52 -4
- package/src/duckdb/src/main/client_context.cpp +27 -17
- package/src/duckdb/src/main/client_verify.cpp +17 -0
- package/src/duckdb/src/main/extension/extension_helper.cpp +2 -1
- package/src/duckdb/src/main/prepared_statement.cpp +38 -11
- package/src/duckdb/src/main/prepared_statement_data.cpp +23 -18
- package/src/duckdb/src/parser/expression/parameter_expression.cpp +7 -7
- package/src/duckdb/src/parser/statement/execute_statement.cpp +2 -2
- package/src/duckdb/src/parser/transform/expression/transform_array_access.cpp +13 -4
- package/src/duckdb/src/parser/transform/expression/transform_param_ref.cpp +45 -26
- package/src/duckdb/src/parser/transform/statement/transform_prepare.cpp +28 -6
- package/src/duckdb/src/parser/transformer.cpp +27 -9
- package/src/duckdb/src/planner/binder/expression/bind_parameter_expression.cpp +10 -10
- package/src/duckdb/src/planner/binder/statement/bind_execute.cpp +13 -7
- package/src/duckdb/src/planner/expression/bound_parameter_expression.cpp +13 -13
- package/src/duckdb/src/planner/planner.cpp +7 -6
- package/src/duckdb/src/storage/checkpoint_manager.cpp +1 -1
- package/src/duckdb/src/storage/serialization/serialize_expression.cpp +3 -3
- package/src/duckdb/src/storage/serialization/serialize_parsed_expression.cpp +2 -2
- package/src/duckdb/src/verification/prepared_statement_verifier.cpp +16 -11
- package/src/duckdb/third_party/libpg_query/include/nodes/parsenodes.hpp +1 -0
- package/src/duckdb/third_party/libpg_query/src_backend_parser_gram.cpp +12855 -12282
- package/src/duckdb/ub_src_common.cpp +2 -0
- package/src/duckdb/ub_src_function_table_arrow.cpp +2 -0
package/binding.gyp
CHANGED
@@ -87,6 +87,7 @@
|
|
87
87
|
"src/duckdb/ub_src_function_scalar_string_regexp.cpp",
|
88
88
|
"src/duckdb/ub_src_function_scalar_struct.cpp",
|
89
89
|
"src/duckdb/ub_src_function_scalar_system.cpp",
|
90
|
+
"src/duckdb/ub_src_function_table_arrow.cpp",
|
90
91
|
"src/duckdb/ub_src_function_table.cpp",
|
91
92
|
"src/duckdb/ub_src_function_table_system.cpp",
|
92
93
|
"src/duckdb/ub_src_function_table_version.cpp",
|
package/package.json
CHANGED
@@ -54,13 +54,13 @@ struct ICUDatePart : public ICUDateFunc {
|
|
54
54
|
}
|
55
55
|
|
56
56
|
static int64_t ExtractDayOfWeek(icu::Calendar *calendar, const uint64_t micros) {
|
57
|
-
|
57
|
+
// [Sun(0), Sat(6)]
|
58
58
|
return ExtractField(calendar, UCAL_DAY_OF_WEEK) - UCAL_SUNDAY;
|
59
59
|
}
|
60
60
|
|
61
61
|
static int64_t ExtractISODayOfWeek(icu::Calendar *calendar, const uint64_t micros) {
|
62
|
-
|
63
|
-
return ExtractField(calendar, UCAL_DAY_OF_WEEK);
|
62
|
+
// [Mon(1), Sun(7)]
|
63
|
+
return 1 + (ExtractField(calendar, UCAL_DAY_OF_WEEK) + 7 - UCAL_MONDAY) % 7;
|
64
64
|
}
|
65
65
|
|
66
66
|
static int64_t ExtractWeek(icu::Calendar *calendar, const uint64_t micros) {
|
@@ -43,7 +43,7 @@ void AddDataTableIndex(DataTable &storage, const ColumnList &columns, const vect
|
|
43
43
|
// create an adaptive radix tree around the expressions
|
44
44
|
if (index_block) {
|
45
45
|
art = make_uniq<ART>(column_ids, TableIOManager::Get(storage), std::move(unbound_expressions), constraint_type,
|
46
|
-
storage.db, index_block->block_id, index_block->offset);
|
46
|
+
storage.db, nullptr, index_block->block_id, index_block->offset);
|
47
47
|
} else {
|
48
48
|
art = make_uniq<ART>(column_ids, TableIOManager::Get(storage), std::move(unbound_expressions), constraint_type,
|
49
49
|
storage.db);
|
@@ -98,6 +98,11 @@ static DefaultMacro internal_macros[] = {
|
|
98
98
|
{DEFAULT_SCHEMA, "fmod", {"x", "y", nullptr}, "(x-y*floor(x/y))"},
|
99
99
|
{DEFAULT_SCHEMA, "count_if", {"l", nullptr}, "sum(if(l, 1, 0))"},
|
100
100
|
{DEFAULT_SCHEMA, "split_part", {"string", "delimiter", "position", nullptr}, "coalesce(string_split(string, delimiter)[position],'')"},
|
101
|
+
{DEFAULT_SCHEMA, "geomean", {"x", nullptr}, "exp(avg(ln(x)))"},
|
102
|
+
{DEFAULT_SCHEMA, "geometric_mean", {"x", nullptr}, "geomean(x)"},
|
103
|
+
|
104
|
+
{DEFAULT_SCHEMA, "list_reverse", {"l", nullptr}, "l[:-:-1]"},
|
105
|
+
{DEFAULT_SCHEMA, "array_reverse", {"l", nullptr}, "list_reverse(l)"},
|
101
106
|
|
102
107
|
// FIXME implement as actual function if we encounter a lot of performance issues. Complexity now: n * m, with hashing possibly n + m
|
103
108
|
{DEFAULT_SCHEMA, "list_intersect", {"l1", "l2", nullptr}, "list_filter(l1, (x) -> list_contains(l2, x))"},
|
@@ -71,7 +71,7 @@
|
|
71
71
|
#include "duckdb/function/macro_function.hpp"
|
72
72
|
#include "duckdb/function/scalar/compressed_materialization_functions.hpp"
|
73
73
|
#include "duckdb/function/scalar/strftime_format.hpp"
|
74
|
-
#include "duckdb/function/table/arrow.hpp"
|
74
|
+
#include "duckdb/function/table/arrow/arrow_duck_schema.hpp"
|
75
75
|
#include "duckdb/main/appender.hpp"
|
76
76
|
#include "duckdb/main/capi/capi_internal.hpp"
|
77
77
|
#include "duckdb/main/config.hpp"
|
@@ -81,6 +81,7 @@
|
|
81
81
|
#include "duckdb/parallel/interrupt.hpp"
|
82
82
|
#include "duckdb/parallel/task.hpp"
|
83
83
|
#include "duckdb/parser/constraint.hpp"
|
84
|
+
#include "duckdb/parser/expression/parameter_expression.hpp"
|
84
85
|
#include "duckdb/parser/expression/window_expression.hpp"
|
85
86
|
#include "duckdb/parser/parsed_data/alter_info.hpp"
|
86
87
|
#include "duckdb/parser/parsed_data/alter_scalar_function_info.hpp"
|
@@ -4404,6 +4405,39 @@ PragmaType EnumUtil::FromString<PragmaType>(const char *value) {
|
|
4404
4405
|
throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented", value));
|
4405
4406
|
}
|
4406
4407
|
|
4408
|
+
template<>
|
4409
|
+
const char* EnumUtil::ToChars<PreparedParamType>(PreparedParamType value) {
|
4410
|
+
switch(value) {
|
4411
|
+
case PreparedParamType::AUTO_INCREMENT:
|
4412
|
+
return "AUTO_INCREMENT";
|
4413
|
+
case PreparedParamType::POSITIONAL:
|
4414
|
+
return "POSITIONAL";
|
4415
|
+
case PreparedParamType::NAMED:
|
4416
|
+
return "NAMED";
|
4417
|
+
case PreparedParamType::INVALID:
|
4418
|
+
return "INVALID";
|
4419
|
+
default:
|
4420
|
+
throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented", value));
|
4421
|
+
}
|
4422
|
+
}
|
4423
|
+
|
4424
|
+
template<>
|
4425
|
+
PreparedParamType EnumUtil::FromString<PreparedParamType>(const char *value) {
|
4426
|
+
if (StringUtil::Equals(value, "AUTO_INCREMENT")) {
|
4427
|
+
return PreparedParamType::AUTO_INCREMENT;
|
4428
|
+
}
|
4429
|
+
if (StringUtil::Equals(value, "POSITIONAL")) {
|
4430
|
+
return PreparedParamType::POSITIONAL;
|
4431
|
+
}
|
4432
|
+
if (StringUtil::Equals(value, "NAMED")) {
|
4433
|
+
return PreparedParamType::NAMED;
|
4434
|
+
}
|
4435
|
+
if (StringUtil::Equals(value, "INVALID")) {
|
4436
|
+
return PreparedParamType::INVALID;
|
4437
|
+
}
|
4438
|
+
throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented", value));
|
4439
|
+
}
|
4440
|
+
|
4407
4441
|
template<>
|
4408
4442
|
const char* EnumUtil::ToChars<ProfilerPrintFormat>(ProfilerPrintFormat value) {
|
4409
4443
|
switch(value) {
|
@@ -0,0 +1,78 @@
|
|
1
|
+
#include "duckdb/common/http_state.hpp"
|
2
|
+
|
3
|
+
namespace duckdb {
|
4
|
+
|
5
|
+
CachedFileHandle::CachedFileHandle(shared_ptr<CachedFile> &file_p) {
|
6
|
+
// If the file was not yet initialized, we need to grab a lock.
|
7
|
+
if (!file_p->initialized) {
|
8
|
+
lock = make_uniq<lock_guard<mutex>>(file_p->lock);
|
9
|
+
}
|
10
|
+
file = file_p;
|
11
|
+
}
|
12
|
+
|
13
|
+
void CachedFileHandle::SetInitialized() {
|
14
|
+
if (file->initialized) {
|
15
|
+
throw InternalException("Cannot set initialized on cached file that was already initialized");
|
16
|
+
}
|
17
|
+
if (!lock) {
|
18
|
+
throw InternalException("Cannot set initialized on cached file without lock");
|
19
|
+
}
|
20
|
+
file->initialized = true;
|
21
|
+
lock = nullptr;
|
22
|
+
}
|
23
|
+
|
24
|
+
void CachedFileHandle::AllocateBuffer(idx_t size) {
|
25
|
+
if (file->initialized) {
|
26
|
+
throw InternalException("Cannot allocate a buffer for a cached file that was already initialized");
|
27
|
+
}
|
28
|
+
file->data = std::shared_ptr<char>(new char[size], std::default_delete<char[]>());
|
29
|
+
file->capacity = size;
|
30
|
+
}
|
31
|
+
|
32
|
+
void CachedFileHandle::GrowBuffer(idx_t new_capacity, idx_t bytes_to_copy) {
|
33
|
+
// copy shared ptr to old data
|
34
|
+
auto old_data = file->data;
|
35
|
+
// allocate new buffer that can hold the new capacity
|
36
|
+
AllocateBuffer(new_capacity);
|
37
|
+
// copy the old data
|
38
|
+
Write(old_data.get(), bytes_to_copy);
|
39
|
+
}
|
40
|
+
|
41
|
+
void CachedFileHandle::Write(const char *buffer, idx_t length, idx_t offset) {
|
42
|
+
//! Only write to non-initialized files with a lock;
|
43
|
+
D_ASSERT(!file->initialized && lock);
|
44
|
+
memcpy(file->data.get() + offset, buffer, length);
|
45
|
+
}
|
46
|
+
|
47
|
+
void HTTPState::Reset() {
|
48
|
+
// Reset Counters
|
49
|
+
head_count = 0;
|
50
|
+
get_count = 0;
|
51
|
+
put_count = 0;
|
52
|
+
post_count = 0;
|
53
|
+
total_bytes_received = 0;
|
54
|
+
total_bytes_sent = 0;
|
55
|
+
|
56
|
+
// Reset cached files
|
57
|
+
cached_files.clear();
|
58
|
+
}
|
59
|
+
|
60
|
+
shared_ptr<HTTPState> HTTPState::TryGetState(FileOpener *opener) {
|
61
|
+
auto client_context = FileOpener::TryGetClientContext(opener);
|
62
|
+
if (client_context) {
|
63
|
+
return client_context->client_data->http_state;
|
64
|
+
}
|
65
|
+
return nullptr;
|
66
|
+
}
|
67
|
+
|
68
|
+
//! Get cache entry, create if not exists
|
69
|
+
shared_ptr<CachedFile> &HTTPState::GetCachedFile(const string &path) {
|
70
|
+
lock_guard<mutex> lock(cached_files_mutex);
|
71
|
+
auto &cache_entry_ref = cached_files[path];
|
72
|
+
if (!cache_entry_ref) {
|
73
|
+
cache_entry_ref = make_shared<CachedFile>();
|
74
|
+
}
|
75
|
+
return cache_entry_ref;
|
76
|
+
}
|
77
|
+
|
78
|
+
} // namespace duckdb
|
@@ -73,7 +73,7 @@ static StaticFunctionDefinition internal_functions[] = {
|
|
73
73
|
DUCKDB_SCALAR_FUNCTION_ALIAS(ArrayDistinctFun),
|
74
74
|
DUCKDB_SCALAR_FUNCTION_ALIAS(ArrayFilterFun),
|
75
75
|
DUCKDB_SCALAR_FUNCTION_SET_ALIAS(ArrayReverseSortFun),
|
76
|
-
|
76
|
+
DUCKDB_SCALAR_FUNCTION_SET_ALIAS(ArraySliceFun),
|
77
77
|
DUCKDB_SCALAR_FUNCTION_SET_ALIAS(ArraySortFun),
|
78
78
|
DUCKDB_SCALAR_FUNCTION_ALIAS(ArrayTransformFun),
|
79
79
|
DUCKDB_SCALAR_FUNCTION_ALIAS(ArrayUniqueFun),
|
@@ -200,7 +200,7 @@ static StaticFunctionDefinition internal_functions[] = {
|
|
200
200
|
DUCKDB_SCALAR_FUNCTION(ListFilterFun),
|
201
201
|
DUCKDB_SCALAR_FUNCTION_ALIAS(ListPackFun),
|
202
202
|
DUCKDB_SCALAR_FUNCTION_SET(ListReverseSortFun),
|
203
|
-
|
203
|
+
DUCKDB_SCALAR_FUNCTION_SET(ListSliceFun),
|
204
204
|
DUCKDB_SCALAR_FUNCTION_SET(ListSortFun),
|
205
205
|
DUCKDB_SCALAR_FUNCTION(ListTransformFun),
|
206
206
|
DUCKDB_SCALAR_FUNCTION(ListUniqueFun),
|