duckdb 0.9.1-dev69.0 → 0.9.1-dev95.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/package.json +1 -1
- package/src/duckdb/src/core_functions/scalar/map/map.cpp +66 -32
- package/src/duckdb/src/function/table/version/pragma_version.cpp +2 -2
- package/src/duckdb/src/include/duckdb.h +5 -5
- package/src/duckdb/src/main/extension/extension_helper.cpp +7 -0
- package/src/duckdb/src/planner/binder/tableref/plan_joinref.cpp +3 -0
package/package.json
CHANGED
@@ -87,11 +87,24 @@ static bool ListEntriesEqual(Vector &keys, Vector &values, idx_t count) {
|
|
87
87
|
return true;
|
88
88
|
}
|
89
89
|
|
90
|
+
static list_entry_t *GetBiggestList(Vector &key, Vector &value, idx_t &size) {
|
91
|
+
auto key_size = ListVector::GetListSize(key);
|
92
|
+
auto value_size = ListVector::GetListSize(value);
|
93
|
+
if (key_size > value_size) {
|
94
|
+
size = key_size;
|
95
|
+
return ListVector::GetData(key);
|
96
|
+
}
|
97
|
+
size = value_size;
|
98
|
+
return ListVector::GetData(value);
|
99
|
+
}
|
100
|
+
|
90
101
|
static void MapFunction(DataChunk &args, ExpressionState &state, Vector &result) {
|
91
102
|
D_ASSERT(result.GetType().id() == LogicalTypeId::MAP);
|
92
103
|
|
93
|
-
auto
|
94
|
-
|
104
|
+
auto count = args.size();
|
105
|
+
|
106
|
+
auto &map_key_vector = MapVector::GetKeys(result);
|
107
|
+
auto &map_value_vector = MapVector::GetValues(result);
|
95
108
|
auto result_data = ListVector::GetData(result);
|
96
109
|
|
97
110
|
result.SetVectorType(VectorType::CONSTANT_VECTOR);
|
@@ -99,52 +112,73 @@ static void MapFunction(DataChunk &args, ExpressionState &state, Vector &result)
|
|
99
112
|
ListVector::SetListSize(result, 0);
|
100
113
|
result_data->offset = 0;
|
101
114
|
result_data->length = 0;
|
102
|
-
result.Verify(
|
115
|
+
result.Verify(count);
|
103
116
|
return;
|
104
117
|
}
|
105
118
|
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
119
|
+
D_ASSERT(args.ColumnCount() == 2);
|
120
|
+
auto &key_vector = args.data[0];
|
121
|
+
auto &value_vector = args.data[1];
|
122
|
+
|
123
|
+
if (args.AllConstant()) {
|
124
|
+
auto key_data = ListVector::GetData(key_vector);
|
125
|
+
auto value_data = ListVector::GetData(value_vector);
|
126
|
+
auto key_entry = key_data[0];
|
127
|
+
auto value_entry = value_data[0];
|
128
|
+
if (key_entry != value_entry) {
|
129
|
+
throw BinderException("Key and value list sizes don't match");
|
130
|
+
}
|
131
|
+
result_data[0] = key_entry;
|
132
|
+
ListVector::SetListSize(result, ListVector::GetListSize(key_vector));
|
133
|
+
map_key_vector.Reference(ListVector::GetEntry(key_vector));
|
134
|
+
map_value_vector.Reference(ListVector::GetEntry(value_vector));
|
135
|
+
MapVector::MapConversionVerify(result, count);
|
136
|
+
result.Verify(count);
|
137
|
+
return;
|
110
138
|
}
|
111
139
|
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
140
|
+
result.SetVectorType(VectorType::FLAT_VECTOR);
|
141
|
+
|
142
|
+
if (key_vector.GetVectorType() == VectorType::CONSTANT_VECTOR) {
|
143
|
+
D_ASSERT(value_vector.GetVectorType() != VectorType::CONSTANT_VECTOR);
|
144
|
+
Vector expanded_const(ListType::GetChildType(key_vector.GetType()), count);
|
145
|
+
AlignVectorToReference(key_vector, value_vector, count, expanded_const);
|
146
|
+
map_key_vector.Reference(expanded_const);
|
147
|
+
|
148
|
+
value_vector.Flatten(count);
|
149
|
+
map_value_vector.Reference(ListVector::GetEntry(value_vector));
|
150
|
+
} else if (value_vector.GetVectorType() == VectorType::CONSTANT_VECTOR) {
|
151
|
+
D_ASSERT(key_vector.GetVectorType() != VectorType::CONSTANT_VECTOR);
|
152
|
+
Vector expanded_const(ListType::GetChildType(value_vector.GetType()), count);
|
153
|
+
AlignVectorToReference(value_vector, key_vector, count, expanded_const);
|
154
|
+
map_value_vector.Reference(expanded_const);
|
155
|
+
|
156
|
+
key_vector.Flatten(count);
|
157
|
+
map_key_vector.Reference(ListVector::GetEntry(key_vector));
|
123
158
|
} else {
|
124
|
-
|
159
|
+
key_vector.Flatten(count);
|
160
|
+
value_vector.Flatten(count);
|
161
|
+
|
162
|
+
if (!ListEntriesEqual(key_vector, value_vector, count)) {
|
125
163
|
throw InvalidInputException("Error in MAP creation: key list and value list do not align. i.e. different "
|
126
164
|
"size or incompatible structure");
|
127
165
|
}
|
166
|
+
|
167
|
+
map_value_vector.Reference(ListVector::GetEntry(value_vector));
|
168
|
+
map_key_vector.Reference(ListVector::GetEntry(key_vector));
|
128
169
|
}
|
129
170
|
|
130
|
-
|
171
|
+
idx_t list_size;
|
172
|
+
auto src_data = GetBiggestList(key_vector, value_vector, list_size);
|
173
|
+
ListVector::SetListSize(result, list_size);
|
131
174
|
|
132
175
|
result_data = ListVector::GetData(result);
|
133
|
-
for (idx_t i = 0; i <
|
176
|
+
for (idx_t i = 0; i < count; i++) {
|
134
177
|
result_data[i] = src_data[i];
|
135
178
|
}
|
136
179
|
|
137
|
-
|
138
|
-
|
139
|
-
if (!(keys_are_const && !values_are_const)) {
|
140
|
-
key_vector.Reference(ListVector::GetEntry(args.data[0]));
|
141
|
-
}
|
142
|
-
if (!(values_are_const && !keys_are_const)) {
|
143
|
-
value_vector.Reference(ListVector::GetEntry(args.data[1]));
|
144
|
-
}
|
145
|
-
|
146
|
-
MapVector::MapConversionVerify(result, args.size());
|
147
|
-
result.Verify(args.size());
|
180
|
+
MapVector::MapConversionVerify(result, count);
|
181
|
+
result.Verify(count);
|
148
182
|
}
|
149
183
|
|
150
184
|
static unique_ptr<FunctionData> MapBind(ClientContext &context, ScalarFunction &bound_function,
|
@@ -1,8 +1,8 @@
|
|
1
1
|
#ifndef DUCKDB_VERSION
|
2
|
-
#define DUCKDB_VERSION "v0.9.1-
|
2
|
+
#define DUCKDB_VERSION "v0.9.1-dev95"
|
3
3
|
#endif
|
4
4
|
#ifndef DUCKDB_SOURCE_ID
|
5
|
-
#define DUCKDB_SOURCE_ID "
|
5
|
+
#define DUCKDB_SOURCE_ID "e2b1788a25"
|
6
6
|
#endif
|
7
7
|
#include "duckdb/function/table/system_functions.hpp"
|
8
8
|
#include "duckdb/main/database.hpp"
|
@@ -317,7 +317,7 @@ typedef enum {
|
|
317
317
|
//===--------------------------------------------------------------------===//
|
318
318
|
|
319
319
|
/*!
|
320
|
-
Creates a new database or opens an existing database file stored at the
|
320
|
+
Creates a new database or opens an existing database file stored at the given path.
|
321
321
|
If no path is given a new in-memory database is created instead.
|
322
322
|
The instantiated database should be closed with 'duckdb_close'
|
323
323
|
|
@@ -328,7 +328,7 @@ The instantiated database should be closed with 'duckdb_close'
|
|
328
328
|
DUCKDB_API duckdb_state duckdb_open(const char *path, duckdb_database *out_database);
|
329
329
|
|
330
330
|
/*!
|
331
|
-
Extended version of duckdb_open. Creates a new database or opens an existing database file stored at the
|
331
|
+
Extended version of duckdb_open. Creates a new database or opens an existing database file stored at the given path.
|
332
332
|
|
333
333
|
* path: Path to the database file on disk, or `nullptr` or `:memory:` to open an in-memory database.
|
334
334
|
* out_database: The result database object.
|
@@ -1009,7 +1009,7 @@ Binds an int64_t value to the prepared statement at the specified index.
|
|
1009
1009
|
DUCKDB_API duckdb_state duckdb_bind_int64(duckdb_prepared_statement prepared_statement, idx_t param_idx, int64_t val);
|
1010
1010
|
|
1011
1011
|
/*!
|
1012
|
-
Binds
|
1012
|
+
Binds a duckdb_hugeint value to the prepared statement at the specified index.
|
1013
1013
|
*/
|
1014
1014
|
DUCKDB_API duckdb_state duckdb_bind_hugeint(duckdb_prepared_statement prepared_statement, idx_t param_idx,
|
1015
1015
|
duckdb_hugeint val);
|
@@ -1040,12 +1040,12 @@ Binds an uint64_t value to the prepared statement at the specified index.
|
|
1040
1040
|
DUCKDB_API duckdb_state duckdb_bind_uint64(duckdb_prepared_statement prepared_statement, idx_t param_idx, uint64_t val);
|
1041
1041
|
|
1042
1042
|
/*!
|
1043
|
-
Binds
|
1043
|
+
Binds a float value to the prepared statement at the specified index.
|
1044
1044
|
*/
|
1045
1045
|
DUCKDB_API duckdb_state duckdb_bind_float(duckdb_prepared_statement prepared_statement, idx_t param_idx, float val);
|
1046
1046
|
|
1047
1047
|
/*!
|
1048
|
-
Binds
|
1048
|
+
Binds a double value to the prepared statement at the specified index.
|
1049
1049
|
*/
|
1050
1050
|
DUCKDB_API duckdb_state duckdb_bind_double(duckdb_prepared_statement prepared_statement, idx_t param_idx, double val);
|
1051
1051
|
|
@@ -196,6 +196,9 @@ string ExtensionHelper::AddExtensionInstallHintToErrorMsg(ClientContext &context
|
|
196
196
|
}
|
197
197
|
|
198
198
|
bool ExtensionHelper::TryAutoLoadExtension(ClientContext &context, const string &extension_name) noexcept {
|
199
|
+
if (context.db->ExtensionIsLoaded(extension_name)) {
|
200
|
+
return true;
|
201
|
+
}
|
199
202
|
auto &dbconfig = DBConfig::GetConfig(context);
|
200
203
|
try {
|
201
204
|
if (dbconfig.options.autoinstall_known_extensions) {
|
@@ -211,6 +214,10 @@ bool ExtensionHelper::TryAutoLoadExtension(ClientContext &context, const string
|
|
211
214
|
}
|
212
215
|
|
213
216
|
void ExtensionHelper::AutoLoadExtension(ClientContext &context, const string &extension_name) {
|
217
|
+
if (context.db->ExtensionIsLoaded(extension_name)) {
|
218
|
+
// Avoid downloading again
|
219
|
+
return;
|
220
|
+
}
|
214
221
|
auto &dbconfig = DBConfig::GetConfig(context);
|
215
222
|
try {
|
216
223
|
#ifndef DUCKDB_WASM
|
@@ -135,6 +135,9 @@ unique_ptr<LogicalOperator> LogicalComparisonJoin::CreateJoin(ClientContext &con
|
|
135
135
|
bool need_to_consider_arbitrary_expressions = true;
|
136
136
|
switch (reftype) {
|
137
137
|
case JoinRefType::ASOF: {
|
138
|
+
if (!arbitrary_expressions.empty()) {
|
139
|
+
throw BinderException("Invalid ASOF JOIN condition");
|
140
|
+
}
|
138
141
|
need_to_consider_arbitrary_expressions = false;
|
139
142
|
auto asof_idx = conditions.size();
|
140
143
|
for (size_t c = 0; c < conditions.size(); ++c) {
|