duckdb 0.8.2-dev2320.0 → 0.8.2-dev2399.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.
Files changed (49) hide show
  1. package/binding.gyp +7 -7
  2. package/package.json +1 -1
  3. package/src/duckdb/extension/icu/icu-datefunc.cpp +9 -0
  4. package/src/duckdb/extension/icu/icu-datepart.cpp +7 -5
  5. package/src/duckdb/extension/icu/icu-strptime.cpp +1 -20
  6. package/src/duckdb/extension/parquet/parquet_writer.cpp +1 -0
  7. package/src/duckdb/src/common/adbc/adbc.cpp +8 -3
  8. package/src/duckdb/src/common/arrow/arrow_appender.cpp +4 -4
  9. package/src/duckdb/src/common/arrow/arrow_converter.cpp +27 -26
  10. package/src/duckdb/src/common/arrow/arrow_wrapper.cpp +5 -5
  11. package/src/duckdb/src/common/types/list_segment.cpp +42 -134
  12. package/src/duckdb/src/common/types/vector.cpp +21 -0
  13. package/src/duckdb/src/core_functions/aggregate/holistic/mode.cpp +5 -7
  14. package/src/duckdb/src/core_functions/aggregate/holistic/quantile.cpp +17 -19
  15. package/src/duckdb/src/core_functions/aggregate/nested/list.cpp +80 -61
  16. package/src/duckdb/src/execution/aggregate_hashtable.cpp +6 -0
  17. package/src/duckdb/src/execution/perfect_aggregate_hashtable.cpp +11 -5
  18. package/src/duckdb/src/execution/window_executor.cpp +18 -20
  19. package/src/duckdb/src/function/aggregate/distributive/count.cpp +2 -2
  20. package/src/duckdb/src/function/table/version/pragma_version.cpp +2 -2
  21. package/src/duckdb/src/include/duckdb/common/arrow/appender/append_data.hpp +3 -3
  22. package/src/duckdb/src/include/duckdb/common/arrow/appender/varchar_data.hpp +1 -1
  23. package/src/duckdb/src/include/duckdb/common/arrow/arrow_appender.hpp +4 -3
  24. package/src/duckdb/src/include/duckdb/common/arrow/arrow_converter.hpp +3 -3
  25. package/src/duckdb/src/include/duckdb/common/arrow/arrow_wrapper.hpp +3 -3
  26. package/src/duckdb/src/include/duckdb/common/types/list_segment.hpp +9 -11
  27. package/src/duckdb/src/include/duckdb/common/types/vector.hpp +7 -0
  28. package/src/duckdb/src/include/duckdb/common/vector_operations/aggregate_executor.hpp +7 -2
  29. package/src/duckdb/src/include/duckdb/execution/perfect_aggregate_hashtable.hpp +4 -2
  30. package/src/duckdb/src/include/duckdb/execution/window_segment_tree.hpp +0 -2
  31. package/src/duckdb/src/include/duckdb/function/aggregate_function.hpp +0 -1
  32. package/src/duckdb/src/include/duckdb/main/capi/capi_internal.hpp +1 -2
  33. package/src/duckdb/src/include/duckdb/main/client_config.hpp +0 -2
  34. package/src/duckdb/src/include/duckdb/main/client_context.hpp +1 -0
  35. package/src/duckdb/src/include/duckdb/main/client_properties.hpp +25 -0
  36. package/src/duckdb/src/include/duckdb/main/config.hpp +1 -1
  37. package/src/duckdb/src/include/duckdb/main/query_result.hpp +1 -13
  38. package/src/duckdb/src/include/duckdb/storage/object_cache.hpp +1 -1
  39. package/src/duckdb/src/main/capi/arrow-c.cpp +1 -7
  40. package/src/duckdb/src/main/client_context.cpp +15 -2
  41. package/src/duckdb/src/main/database.cpp +0 -9
  42. package/src/duckdb/src/main/query_result.cpp +0 -8
  43. package/src/duckdb/src/parser/transform/expression/transform_function.cpp +3 -0
  44. package/src/duckdb/src/storage/serialization/serialize_constraint.cpp +2 -2
  45. package/src/duckdb/src/storage/serialization/serialize_create_info.cpp +2 -2
  46. package/src/duckdb/src/storage/serialization/serialize_parse_info.cpp +2 -2
  47. package/src/duckdb/src/storage/serialization/serialize_tableref.cpp +2 -4
  48. package/src/duckdb/ub_extension_icu_third_party_icu_i18n.cpp +6 -6
  49. package/src/duckdb/src/include/duckdb/common/arrow/arrow_options.hpp +0 -25
@@ -115,8 +115,6 @@ public:
115
115
  static ClientConfig &GetConfig(ClientContext &context);
116
116
  static const ClientConfig &GetConfig(const ClientContext &context);
117
117
 
118
- string ExtractTimezone() const;
119
-
120
118
  bool AnyVerification() {
121
119
  return query_verification_enabled || verify_external || verify_serializer;
122
120
  }
@@ -24,6 +24,7 @@
24
24
  #include "duckdb/main/client_config.hpp"
25
25
  #include "duckdb/main/external_dependencies.hpp"
26
26
  #include "duckdb/common/preserved_error.hpp"
27
+ #include "duckdb/main/client_properties.hpp"
27
28
 
28
29
  namespace duckdb {
29
30
  class Appender;
@@ -0,0 +1,25 @@
1
+ //===----------------------------------------------------------------------===//
2
+ // DuckDB
3
+ //
4
+ // duckdb/main/client_properties.hpp
5
+ //
6
+ //
7
+ //===----------------------------------------------------------------------===//
8
+
9
+ #pragma once
10
+
11
+ #include <string>
12
+
13
+ namespace duckdb {
14
+ enum ArrowOffsetSize { REGULAR, LARGE };
15
+
16
+ //! A set of properties from the client context that can be used to interpret the query result
17
+ struct ClientProperties {
18
+ ClientProperties(string time_zone_p, ArrowOffsetSize arrow_offset_size_p)
19
+ : time_zone(std::move(time_zone_p)), arrow_offset_size(arrow_offset_size_p) {
20
+ }
21
+ ClientProperties() {};
22
+ string time_zone = "UTC";
23
+ ArrowOffsetSize arrow_offset_size = ArrowOffsetSize::REGULAR;
24
+ };
25
+ } // namespace duckdb
@@ -28,7 +28,7 @@
28
28
  #include "duckdb/optimizer/optimizer_extension.hpp"
29
29
  #include "duckdb/parser/parser_extension.hpp"
30
30
  #include "duckdb/planner/operator_extension.hpp"
31
- #include "duckdb/common/arrow/arrow_options.hpp"
31
+ #include "duckdb/main/client_properties.hpp"
32
32
 
33
33
  namespace duckdb {
34
34
  class BufferPool;
@@ -12,22 +12,13 @@
12
12
  #include "duckdb/common/types/data_chunk.hpp"
13
13
  #include "duckdb/common/winapi.hpp"
14
14
  #include "duckdb/common/preserved_error.hpp"
15
- #include "duckdb/common/arrow/arrow_options.hpp"
15
+ #include "duckdb/main/client_properties.hpp"
16
16
 
17
17
  namespace duckdb {
18
18
  struct BoxRendererConfig;
19
19
 
20
20
  enum class QueryResultType : uint8_t { MATERIALIZED_RESULT, STREAM_RESULT, PENDING_RESULT };
21
21
 
22
- //! A set of properties from the client context that can be used to interpret the query result
23
- struct ClientProperties {
24
- ClientProperties(string time_zone_p, ArrowOffsetSize arrow_offset_size_p)
25
- : time_zone(std::move(time_zone_p)), arrow_offset_size(arrow_offset_size_p) {
26
- }
27
- string time_zone;
28
- ArrowOffsetSize arrow_offset_size;
29
- };
30
-
31
22
  class BaseQueryResult {
32
23
  public:
33
24
  //! Creates a successful query result with the specified names and types
@@ -133,9 +124,6 @@ public:
133
124
  }
134
125
  }
135
126
 
136
- static ArrowOptions GetArrowOptions(QueryResult &query_result);
137
- static string GetConfigTimezone(QueryResult &query_result);
138
-
139
127
  private:
140
128
  class QueryResultIterator;
141
129
  class QueryResultRow {
@@ -48,7 +48,7 @@ public:
48
48
  }
49
49
 
50
50
  template <class T, class... Args>
51
- shared_ptr<T> GetOrCreate(const string &key, Args &&...args) {
51
+ shared_ptr<T> GetOrCreate(const string &key, Args &&... args) {
52
52
  lock_guard<mutex> glock(lock);
53
53
 
54
54
  auto entry = cache.find(key);
@@ -95,13 +95,7 @@ duckdb_state duckdb_execute_prepared_arrow(duckdb_prepared_statement prepared_st
95
95
  return DuckDBError;
96
96
  }
97
97
  auto arrow_wrapper = new ArrowResultWrapper();
98
- if (wrapper->statement->context->config.set_variables.find("TimeZone") ==
99
- wrapper->statement->context->config.set_variables.end()) {
100
- arrow_wrapper->options.time_zone = "UTC";
101
- } else {
102
- arrow_wrapper->options.time_zone =
103
- wrapper->statement->context->config.set_variables["TimeZone"].GetValue<std::string>();
104
- }
98
+ arrow_wrapper->options = wrapper->statement->context->GetClientProperties();
105
99
 
106
100
  auto result = wrapper->statement->Execute(wrapper->values, false);
107
101
  D_ASSERT(result->type == QueryResultType::MATERIALIZED_RESULT);
@@ -1155,8 +1155,21 @@ ParserOptions ClientContext::GetParserOptions() const {
1155
1155
  }
1156
1156
 
1157
1157
  ClientProperties ClientContext::GetClientProperties() const {
1158
- auto client_context = ClientConfig::GetConfig(*this);
1159
- return {client_context.ExtractTimezone(), db->config.options.arrow_offset_size};
1158
+ string timezone = "UTC";
1159
+ Value result;
1160
+ // 1) Check Set Variable
1161
+ auto &client_config = ClientConfig::GetConfig(*this);
1162
+ auto tz_config = client_config.set_variables.find("timezone");
1163
+ if (tz_config == client_config.set_variables.end()) {
1164
+ // 2) Check for Default Value
1165
+ auto default_value = db->config.extension_parameters.find("timezone");
1166
+ if (default_value != db->config.extension_parameters.end()) {
1167
+ timezone = default_value->second.default_value.GetValue<string>();
1168
+ }
1169
+ } else {
1170
+ timezone = tz_config->second.GetValue<string>();
1171
+ }
1172
+ return {timezone, db->config.options.arrow_offset_size};
1160
1173
  }
1161
1174
 
1162
1175
  bool ClientContext::ExecutionIsFinished() {
@@ -397,15 +397,6 @@ bool DatabaseInstance::TryGetCurrentSetting(const std::string &key, Value &resul
397
397
  return true;
398
398
  }
399
399
 
400
- string ClientConfig::ExtractTimezone() const {
401
- auto entry = set_variables.find("TimeZone");
402
- if (entry == set_variables.end()) {
403
- return "UTC";
404
- } else {
405
- return entry->second.GetValue<std::string>();
406
- }
407
- }
408
-
409
400
  ValidChecker &DatabaseInstance::GetValidChecker() {
410
401
  return db_validity;
411
402
  }
@@ -151,12 +151,4 @@ string QueryResult::HeaderToString() {
151
151
  return result;
152
152
  }
153
153
 
154
- ArrowOptions QueryResult::GetArrowOptions(QueryResult &query_result) {
155
- return {query_result.client_properties.arrow_offset_size, query_result.client_properties.time_zone};
156
- }
157
-
158
- string QueryResult::GetConfigTimezone(QueryResult &query_result) {
159
- return query_result.client_properties.time_zone;
160
- }
161
-
162
154
  } // namespace duckdb
@@ -209,6 +209,9 @@ unique_ptr<ParsedExpression> Transformer::TransformFuncCall(duckdb_libpgquery::P
209
209
  }
210
210
  window_ref = it->second;
211
211
  D_ASSERT(window_ref);
212
+ if (window_ref->startOffset || window_ref->endOffset || window_ref->frameOptions != FRAMEOPTION_DEFAULTS) {
213
+ throw ParserException("cannot copy window \"%s\" because it has a frame clause", window_spec->refname);
214
+ }
212
215
  }
213
216
  in_window_definition = true;
214
217
  TransformWindowDef(*window_ref, *expr);
@@ -50,7 +50,7 @@ void ForeignKeyConstraint::FormatSerialize(FormatSerializer &serializer) const {
50
50
  Constraint::FormatSerialize(serializer);
51
51
  serializer.WriteProperty("pk_columns", pk_columns);
52
52
  serializer.WriteProperty("fk_columns", fk_columns);
53
- serializer.WriteProperty("type", info.type);
53
+ serializer.WriteProperty("fk_type", info.type);
54
54
  serializer.WriteProperty("schema", info.schema);
55
55
  serializer.WriteProperty("table", info.table);
56
56
  serializer.WriteProperty("pk_keys", info.pk_keys);
@@ -61,7 +61,7 @@ unique_ptr<Constraint> ForeignKeyConstraint::FormatDeserialize(FormatDeserialize
61
61
  auto result = duckdb::unique_ptr<ForeignKeyConstraint>(new ForeignKeyConstraint());
62
62
  deserializer.ReadProperty("pk_columns", result->pk_columns);
63
63
  deserializer.ReadProperty("fk_columns", result->fk_columns);
64
- deserializer.ReadProperty("type", result->info.type);
64
+ deserializer.ReadProperty("fk_type", result->info.type);
65
65
  deserializer.ReadProperty("schema", result->info.schema);
66
66
  deserializer.ReadProperty("table", result->info.table);
67
67
  deserializer.ReadProperty("pk_keys", result->info.pk_keys);
@@ -160,13 +160,13 @@ unique_ptr<CreateInfo> CreateTableInfo::FormatDeserialize(FormatDeserializer &de
160
160
  void CreateTypeInfo::FormatSerialize(FormatSerializer &serializer) const {
161
161
  CreateInfo::FormatSerialize(serializer);
162
162
  serializer.WriteProperty("name", name);
163
- serializer.WriteProperty("type", type);
163
+ serializer.WriteProperty("logical_type", type);
164
164
  }
165
165
 
166
166
  unique_ptr<CreateInfo> CreateTypeInfo::FormatDeserialize(FormatDeserializer &deserializer) {
167
167
  auto result = duckdb::unique_ptr<CreateTypeInfo>(new CreateTypeInfo());
168
168
  deserializer.ReadProperty("name", result->name);
169
- deserializer.ReadProperty("type", result->type);
169
+ deserializer.ReadProperty("logical_type", result->type);
170
170
  return std::move(result);
171
171
  }
172
172
 
@@ -176,7 +176,7 @@ void AlterForeignKeyInfo::FormatSerialize(FormatSerializer &serializer) const {
176
176
  serializer.WriteProperty("fk_columns", fk_columns);
177
177
  serializer.WriteProperty("pk_keys", pk_keys);
178
178
  serializer.WriteProperty("fk_keys", fk_keys);
179
- serializer.WriteProperty("type", type);
179
+ serializer.WriteProperty("alter_fk_type", type);
180
180
  }
181
181
 
182
182
  unique_ptr<AlterTableInfo> AlterForeignKeyInfo::FormatDeserialize(FormatDeserializer &deserializer) {
@@ -186,7 +186,7 @@ unique_ptr<AlterTableInfo> AlterForeignKeyInfo::FormatDeserialize(FormatDeserial
186
186
  deserializer.ReadProperty("fk_columns", result->fk_columns);
187
187
  deserializer.ReadProperty("pk_keys", result->pk_keys);
188
188
  deserializer.ReadProperty("fk_keys", result->fk_keys);
189
- deserializer.ReadProperty("type", result->type);
189
+ deserializer.ReadProperty("alter_fk_type", result->type);
190
190
  return std::move(result);
191
191
  }
192
192
 
@@ -96,7 +96,7 @@ void JoinRef::FormatSerialize(FormatSerializer &serializer) const {
96
96
  serializer.WriteProperty("left", *left);
97
97
  serializer.WriteProperty("right", *right);
98
98
  serializer.WriteOptionalProperty("condition", condition);
99
- serializer.WriteProperty("type", type);
99
+ serializer.WriteProperty("join_type", type);
100
100
  serializer.WriteProperty("ref_type", ref_type);
101
101
  serializer.WriteProperty("using_columns", using_columns);
102
102
  }
@@ -106,7 +106,7 @@ unique_ptr<TableRef> JoinRef::FormatDeserialize(FormatDeserializer &deserializer
106
106
  deserializer.ReadProperty("left", result->left);
107
107
  deserializer.ReadProperty("right", result->right);
108
108
  deserializer.ReadOptionalProperty("condition", result->condition);
109
- deserializer.ReadProperty("type", result->type);
109
+ deserializer.ReadProperty("join_type", result->type);
110
110
  deserializer.ReadProperty("ref_type", result->ref_type);
111
111
  deserializer.ReadProperty("using_columns", result->using_columns);
112
112
  return std::move(result);
@@ -151,14 +151,12 @@ unique_ptr<TableRef> SubqueryRef::FormatDeserialize(FormatDeserializer &deserial
151
151
  void TableFunctionRef::FormatSerialize(FormatSerializer &serializer) const {
152
152
  TableRef::FormatSerialize(serializer);
153
153
  serializer.WriteProperty("function", *function);
154
- serializer.WriteProperty("alias", alias);
155
154
  serializer.WriteProperty("column_name_alias", column_name_alias);
156
155
  }
157
156
 
158
157
  unique_ptr<TableRef> TableFunctionRef::FormatDeserialize(FormatDeserializer &deserializer) {
159
158
  auto result = duckdb::unique_ptr<TableFunctionRef>(new TableFunctionRef());
160
159
  deserializer.ReadProperty("function", result->function);
161
- deserializer.ReadProperty("alias", result->alias);
162
160
  deserializer.ReadProperty("column_name_alias", result->column_name_alias);
163
161
  return std::move(result);
164
162
  }
@@ -348,17 +348,17 @@
348
348
 
349
349
  #include "extension/icu/third_party/icu/i18n/wintzimpl.cpp"
350
350
 
351
- #include "extension/icu/third_party/icu/i18n/double-conversion-bignum.cpp"
351
+ #include "extension/icu/third_party/icu/i18n/double-conversion-fast-dtoa.cpp"
352
352
 
353
353
  #include "extension/icu/third_party/icu/i18n/double-conversion-cached-powers.cpp"
354
354
 
355
- #include "extension/icu/third_party/icu/i18n/double-conversion-strtod.cpp"
356
-
357
- #include "extension/icu/third_party/icu/i18n/double-conversion-double-to-string.cpp"
358
-
359
355
  #include "extension/icu/third_party/icu/i18n/double-conversion-string-to-double.cpp"
360
356
 
361
357
  #include "extension/icu/third_party/icu/i18n/double-conversion-bignum-dtoa.cpp"
362
358
 
363
- #include "extension/icu/third_party/icu/i18n/double-conversion-fast-dtoa.cpp"
359
+ #include "extension/icu/third_party/icu/i18n/double-conversion-bignum.cpp"
360
+
361
+ #include "extension/icu/third_party/icu/i18n/double-conversion-strtod.cpp"
362
+
363
+ #include "extension/icu/third_party/icu/i18n/double-conversion-double-to-string.cpp"
364
364
 
@@ -1,25 +0,0 @@
1
- //===----------------------------------------------------------------------===//
2
- // DuckDB
3
- //
4
- // duckdb/common/arrow/arrow_options.hpp
5
- //
6
- //
7
- //===----------------------------------------------------------------------===//
8
-
9
- #pragma once
10
-
11
- namespace duckdb {
12
-
13
- enum ArrowOffsetSize { REGULAR, LARGE };
14
-
15
- struct ArrowOptions {
16
- explicit ArrowOptions(ArrowOffsetSize offset_size_p) : offset_size(offset_size_p) {
17
- }
18
- ArrowOptions(ArrowOffsetSize offset_size_p, string timezone_p) : offset_size(offset_size_p), time_zone(timezone_p) {
19
- }
20
- ArrowOptions() {
21
- }
22
- ArrowOffsetSize offset_size = ArrowOffsetSize::REGULAR;
23
- string time_zone = "UTC";
24
- };
25
- } // namespace duckdb