duckdb 0.7.2-dev3515.0 → 0.7.2-dev3666.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/configure.py +2 -0
- package/package.json +1 -1
- package/src/database.cpp +1 -0
- package/src/duckdb/extension/json/buffered_json_reader.cpp +56 -17
- package/src/duckdb/extension/json/include/buffered_json_reader.hpp +56 -31
- package/src/duckdb/extension/json/include/json_common.hpp +5 -4
- package/src/duckdb/extension/json/include/json_executors.hpp +13 -18
- package/src/duckdb/extension/json/include/json_functions.hpp +3 -0
- package/src/duckdb/extension/json/include/json_scan.hpp +106 -153
- package/src/duckdb/extension/json/include/json_transform.hpp +2 -2
- package/src/duckdb/extension/json/json_common.cpp +1 -1
- package/src/duckdb/extension/json/json_functions/copy_json.cpp +94 -38
- package/src/duckdb/extension/json/json_functions/json_contains.cpp +7 -8
- package/src/duckdb/extension/json/json_functions/json_create.cpp +7 -7
- package/src/duckdb/extension/json/json_functions/json_merge_patch.cpp +4 -4
- package/src/duckdb/extension/json/json_functions/json_serialize_sql.cpp +4 -4
- package/src/duckdb/extension/json/json_functions/json_structure.cpp +7 -5
- package/src/duckdb/extension/json/json_functions/json_transform.cpp +10 -8
- package/src/duckdb/extension/json/json_functions/json_valid.cpp +1 -1
- package/src/duckdb/extension/json/json_functions/read_json.cpp +167 -169
- package/src/duckdb/extension/json/json_functions/read_json_objects.cpp +37 -16
- package/src/duckdb/extension/json/json_functions.cpp +11 -4
- package/src/duckdb/extension/json/json_scan.cpp +593 -374
- package/src/duckdb/extension/parquet/parquet-extension.cpp +5 -0
- package/src/duckdb/src/catalog/catalog_entry/macro_catalog_entry.cpp +42 -0
- package/src/duckdb/src/catalog/catalog_search_path.cpp +5 -0
- package/src/duckdb/src/catalog/catalog_set.cpp +1 -1
- package/src/duckdb/src/common/constants.cpp +1 -0
- package/src/duckdb/src/common/file_system.cpp +26 -6
- package/src/duckdb/src/common/local_file_system.cpp +0 -13
- package/src/duckdb/src/common/types/vector.cpp +3 -3
- package/src/duckdb/src/common/types/vector_buffer.cpp +11 -3
- package/src/duckdb/src/common/types/vector_cache.cpp +5 -5
- package/src/duckdb/src/execution/operator/persistent/buffered_csv_reader.cpp +12 -6
- package/src/duckdb/src/execution/operator/persistent/csv_reader_options.cpp +10 -0
- package/src/duckdb/src/execution/operator/schema/physical_create_type.cpp +2 -2
- package/src/duckdb/src/function/macro_function.cpp +43 -0
- package/src/duckdb/src/function/pragma/pragma_queries.cpp +5 -3
- package/src/duckdb/src/function/scalar/strftime_format.cpp +1 -0
- package/src/duckdb/src/function/scalar_macro_function.cpp +10 -0
- package/src/duckdb/src/function/table/copy_csv.cpp +68 -18
- package/src/duckdb/src/function/table/read_csv.cpp +30 -3
- package/src/duckdb/src/function/table/version/pragma_version.cpp +8 -2
- package/src/duckdb/src/function/table_macro_function.cpp +10 -0
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/column_dependency_manager.hpp +1 -1
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/macro_catalog_entry.hpp +3 -1
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/scalar_macro_catalog_entry.hpp +0 -6
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/table_macro_catalog_entry.hpp +0 -6
- package/src/duckdb/src/include/duckdb/catalog/catalog_search_path.hpp +1 -1
- package/src/duckdb/src/include/duckdb/catalog/similar_catalog_entry.hpp +1 -1
- package/src/duckdb/src/include/duckdb/common/constants.hpp +2 -0
- package/src/duckdb/src/include/duckdb/common/exception.hpp +3 -3
- package/src/duckdb/src/include/duckdb/common/field_writer.hpp +3 -3
- package/src/duckdb/src/include/duckdb/common/file_system.hpp +5 -0
- package/src/duckdb/src/include/duckdb/common/http_state.hpp +2 -1
- package/src/duckdb/src/include/duckdb/common/hugeint.hpp +6 -6
- package/src/duckdb/src/include/duckdb/common/limits.hpp +46 -46
- package/src/duckdb/src/include/duckdb/common/operator/cast_operators.hpp +8 -8
- package/src/duckdb/src/include/duckdb/common/operator/comparison_operators.hpp +6 -6
- package/src/duckdb/src/include/duckdb/common/operator/convert_to_string.hpp +1 -1
- package/src/duckdb/src/include/duckdb/common/operator/decimal_cast_operators.hpp +2 -4
- package/src/duckdb/src/include/duckdb/common/operator/string_cast.hpp +1 -1
- package/src/duckdb/src/include/duckdb/common/operator/subtract.hpp +1 -1
- package/src/duckdb/src/include/duckdb/common/preserved_error.hpp +1 -1
- package/src/duckdb/src/include/duckdb/common/re2_regex.hpp +1 -1
- package/src/duckdb/src/include/duckdb/common/string_util.hpp +7 -7
- package/src/duckdb/src/include/duckdb/common/types/chunk_collection.hpp +10 -10
- package/src/duckdb/src/include/duckdb/common/types/column/column_data_collection.hpp +12 -12
- package/src/duckdb/src/include/duckdb/common/types/column/column_data_collection_iterators.hpp +2 -2
- package/src/duckdb/src/include/duckdb/common/types/value.hpp +1 -1
- package/src/duckdb/src/include/duckdb/common/types/vector_buffer.hpp +12 -2
- package/src/duckdb/src/include/duckdb/common/types.hpp +2 -2
- package/src/duckdb/src/include/duckdb/common/winapi.hpp +1 -1
- package/src/duckdb/src/include/duckdb/execution/expression_executor_state.hpp +1 -1
- package/src/duckdb/src/include/duckdb/execution/operator/persistent/csv_reader_options.hpp +9 -5
- package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_create_type.hpp +1 -1
- package/src/duckdb/src/include/duckdb/function/aggregate_function.hpp +10 -14
- package/src/duckdb/src/include/duckdb/function/macro_function.hpp +7 -1
- package/src/duckdb/src/include/duckdb/function/scalar/strftime_format.hpp +3 -4
- package/src/duckdb/src/include/duckdb/function/scalar_macro_function.hpp +7 -2
- package/src/duckdb/src/include/duckdb/function/table_function.hpp +1 -1
- package/src/duckdb/src/include/duckdb/function/table_macro_function.hpp +5 -0
- package/src/duckdb/src/include/duckdb/function/udf_function.hpp +56 -50
- package/src/duckdb/src/include/duckdb/main/appender.hpp +2 -2
- package/src/duckdb/src/include/duckdb/main/client_context.hpp +2 -2
- package/src/duckdb/src/include/duckdb/main/client_data.hpp +3 -1
- package/src/duckdb/src/include/duckdb/main/connection.hpp +8 -9
- package/src/duckdb/src/include/duckdb/main/extension_entries.hpp +1 -0
- package/src/duckdb/src/include/duckdb/main/query_result.hpp +3 -3
- package/src/duckdb/src/include/duckdb/main/relation.hpp +6 -7
- package/src/duckdb/src/include/duckdb/optimizer/optimizer_extension.hpp +1 -1
- package/src/duckdb/src/include/duckdb/parser/column_list.hpp +7 -7
- package/src/duckdb/src/include/duckdb/parser/parsed_data/attach_info.hpp +4 -7
- package/src/duckdb/src/include/duckdb/parser/parsed_data/create_macro_info.hpp +8 -12
- package/src/duckdb/src/include/duckdb/parser/parsed_data/create_sequence_info.hpp +6 -20
- package/src/duckdb/src/include/duckdb/parser/parsed_data/create_type_info.hpp +6 -18
- package/src/duckdb/src/include/duckdb/parser/parsed_data/detach_info.hpp +4 -8
- package/src/duckdb/src/include/duckdb/parser/parsed_data/drop_info.hpp +4 -38
- package/src/duckdb/src/include/duckdb/parser/parsed_data/transaction_info.hpp +5 -2
- package/src/duckdb/src/include/duckdb/parser/parsed_data/vacuum_info.hpp +10 -10
- package/src/duckdb/src/include/duckdb/parser/parser_extension.hpp +2 -2
- package/src/duckdb/src/include/duckdb/parser/sql_statement.hpp +1 -1
- package/src/duckdb/src/include/duckdb/parser/statement/select_statement.hpp +1 -1
- package/src/duckdb/src/include/duckdb/planner/operator_extension.hpp +2 -2
- package/src/duckdb/src/include/duckdb/storage/storage_extension.hpp +2 -2
- package/src/duckdb/src/parser/parsed_data/attach_info.cpp +42 -0
- package/src/duckdb/src/parser/parsed_data/create_index_info.cpp +0 -7
- package/src/duckdb/src/parser/parsed_data/create_info.cpp +19 -8
- package/src/duckdb/src/parser/parsed_data/create_macro_info.cpp +46 -0
- package/src/duckdb/src/parser/parsed_data/create_sequence_info.cpp +56 -0
- package/src/duckdb/src/parser/parsed_data/create_type_info.cpp +47 -0
- package/src/duckdb/src/parser/parsed_data/detach_info.cpp +34 -0
- package/src/duckdb/src/parser/parsed_data/drop_info.cpp +46 -0
- package/src/duckdb/src/parser/parsed_data/transaction_info.cpp +24 -0
- package/src/duckdb/src/parser/parsed_data/vacuum_info.cpp +37 -0
- package/src/duckdb/src/planner/binder/expression/bind_star_expression.cpp +27 -9
- package/src/duckdb/src/planner/binder/statement/bind_copy.cpp +9 -4
- package/src/duckdb/src/planner/binder/statement/bind_create.cpp +2 -1
- package/src/duckdb/src/planner/binder/statement/bind_create_table.cpp +1 -0
- package/src/duckdb/src/planner/binder/tableref/bind_basetableref.cpp +1 -1
- package/src/duckdb/src/planner/logical_operator.cpp +1 -2
- package/src/duckdb/src/planner/operator/logical_create_index.cpp +16 -25
- package/src/duckdb/src/planner/operator/logical_insert.cpp +30 -0
- package/src/duckdb/src/planner/operator/logical_simple.cpp +33 -5
- package/src/duckdb/src/planner/parsed_data/bound_create_table_info.cpp +6 -16
- package/src/duckdb/src/planner/planner.cpp +4 -13
- package/src/duckdb/src/storage/checkpoint_manager.cpp +12 -6
- package/src/duckdb/src/storage/single_file_block_manager.cpp +0 -4
- package/src/duckdb/src/storage/storage_info.cpp +1 -1
- package/src/duckdb/third_party/libpg_query/src_backend_parser_gram.cpp +5735 -5773
- package/src/duckdb/ub_src_catalog_catalog_entry.cpp +1 -1
- package/src/duckdb/ub_src_parser_parsed_data.cpp +16 -0
- package/src/duckdb/src/catalog/catalog_entry/scalar_macro_catalog_entry.cpp +0 -104
@@ -20,7 +20,7 @@ class Vector;
|
|
20
20
|
|
21
21
|
struct StringCast {
|
22
22
|
template <class SRC>
|
23
|
-
|
23
|
+
static inline string_t Operation(SRC input, Vector &result) {
|
24
24
|
throw NotImplementedException("Unimplemented type for string cast!");
|
25
25
|
}
|
26
26
|
};
|
@@ -72,7 +72,7 @@ bool TrySubtractOperator::Operation(hugeint_t left, hugeint_t right, hugeint_t &
|
|
72
72
|
|
73
73
|
struct SubtractOperatorOverflowCheck {
|
74
74
|
template <class TA, class TB, class TR>
|
75
|
-
|
75
|
+
static inline TR Operation(TA left, TB right) {
|
76
76
|
TR result;
|
77
77
|
if (!TrySubtractOperator::Operation(left, right, result)) {
|
78
78
|
throw OutOfRangeException("Overflow in subtraction of %s (%d - %d)!", TypeIdToString(GetTypeId<TA>()), left,
|
@@ -39,7 +39,7 @@ public:
|
|
39
39
|
//! Let's us do things like 'if (error)'
|
40
40
|
DUCKDB_API operator bool() const;
|
41
41
|
DUCKDB_API bool operator==(const PreservedError &other) const;
|
42
|
-
|
42
|
+
const shared_ptr<Exception> &GetError() {
|
43
43
|
return exception_instance;
|
44
44
|
}
|
45
45
|
|
@@ -15,7 +15,7 @@ enum class RegexOptions : uint8_t { NONE, CASE_INSENSITIVE };
|
|
15
15
|
class Regex {
|
16
16
|
public:
|
17
17
|
DUCKDB_API Regex(const std::string &pattern, RegexOptions options = RegexOptions::NONE);
|
18
|
-
|
18
|
+
Regex(const char *pattern, RegexOptions options = RegexOptions::NONE) : Regex(std::string(pattern)) {
|
19
19
|
}
|
20
20
|
const duckdb_re2::RE2 &GetRegex() const {
|
21
21
|
return *regex;
|
@@ -45,25 +45,25 @@ public:
|
|
45
45
|
throw InvalidInputException("Invalid input for binary digit: %s", string(c, 1));
|
46
46
|
}
|
47
47
|
|
48
|
-
|
48
|
+
static bool CharacterIsSpace(char c) {
|
49
49
|
return c == ' ' || c == '\t' || c == '\n' || c == '\v' || c == '\f' || c == '\r';
|
50
50
|
}
|
51
|
-
|
51
|
+
static bool CharacterIsNewline(char c) {
|
52
52
|
return c == '\n' || c == '\r';
|
53
53
|
}
|
54
|
-
|
54
|
+
static bool CharacterIsDigit(char c) {
|
55
55
|
return c >= '0' && c <= '9';
|
56
56
|
}
|
57
|
-
|
57
|
+
static bool CharacterIsHex(char c) {
|
58
58
|
return (c >= '0' && c <= '9') || (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F');
|
59
59
|
}
|
60
|
-
|
60
|
+
static char CharacterToLower(char c) {
|
61
61
|
if (c >= 'A' && c <= 'Z') {
|
62
62
|
return c - ('A' - 'a');
|
63
63
|
}
|
64
64
|
return c;
|
65
65
|
}
|
66
|
-
|
66
|
+
static char CharacterIsAlpha(char c) {
|
67
67
|
return (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z');
|
68
68
|
}
|
69
69
|
static bool CharacterIsOperator(char c) {
|
@@ -200,7 +200,7 @@ public:
|
|
200
200
|
|
201
201
|
//! Returns true if two null-terminated strings are equal or point to the same address.
|
202
202
|
//! Returns false if only one of the strings is nullptr
|
203
|
-
|
203
|
+
static bool Equals(const char *s1, const char *s2) {
|
204
204
|
if (s1 == s2) {
|
205
205
|
return true;
|
206
206
|
}
|
@@ -30,7 +30,7 @@ public:
|
|
30
30
|
explicit ChunkCollection(ClientContext &context);
|
31
31
|
|
32
32
|
//! The types of columns in the ChunkCollection
|
33
|
-
|
33
|
+
vector<LogicalType> &Types() {
|
34
34
|
return types;
|
35
35
|
}
|
36
36
|
const vector<LogicalType> &Types() const {
|
@@ -38,12 +38,12 @@ public:
|
|
38
38
|
}
|
39
39
|
|
40
40
|
//! The amount of rows in the ChunkCollection
|
41
|
-
|
41
|
+
const idx_t &Count() const {
|
42
42
|
return count;
|
43
43
|
}
|
44
44
|
|
45
45
|
//! The amount of columns in the ChunkCollection
|
46
|
-
|
46
|
+
idx_t ColumnCount() const {
|
47
47
|
return types.size();
|
48
48
|
}
|
49
49
|
|
@@ -76,12 +76,12 @@ public:
|
|
76
76
|
DUCKDB_API void Print() const;
|
77
77
|
|
78
78
|
//! Gets a reference to the chunk at the given index
|
79
|
-
|
79
|
+
DataChunk &GetChunkForRow(idx_t row_index) {
|
80
80
|
return *chunks[LocateChunk(row_index)];
|
81
81
|
}
|
82
82
|
|
83
83
|
//! Gets a reference to the chunk at the given index
|
84
|
-
|
84
|
+
DataChunk &GetChunk(idx_t chunk_index) {
|
85
85
|
D_ASSERT(chunk_index < chunks.size());
|
86
86
|
return *chunks[chunk_index];
|
87
87
|
}
|
@@ -90,21 +90,21 @@ public:
|
|
90
90
|
return *chunks[chunk_index];
|
91
91
|
}
|
92
92
|
|
93
|
-
|
93
|
+
const vector<unique_ptr<DataChunk>> &Chunks() {
|
94
94
|
return chunks;
|
95
95
|
}
|
96
96
|
|
97
|
-
|
97
|
+
idx_t ChunkCount() const {
|
98
98
|
return chunks.size();
|
99
99
|
}
|
100
100
|
|
101
|
-
|
101
|
+
void Reset() {
|
102
102
|
count = 0;
|
103
103
|
chunks.clear();
|
104
104
|
types.clear();
|
105
105
|
}
|
106
106
|
|
107
|
-
|
107
|
+
unique_ptr<DataChunk> Fetch() {
|
108
108
|
if (ChunkCount() == 0) {
|
109
109
|
return nullptr;
|
110
110
|
}
|
@@ -115,7 +115,7 @@ public:
|
|
115
115
|
}
|
116
116
|
|
117
117
|
//! Locates the chunk that belongs to the specific index
|
118
|
-
|
118
|
+
idx_t LocateChunk(idx_t index) {
|
119
119
|
idx_t result = index / STANDARD_VECTOR_SIZE;
|
120
120
|
D_ASSERT(result < chunks.size());
|
121
121
|
return result;
|
@@ -44,20 +44,20 @@ public:
|
|
44
44
|
|
45
45
|
public:
|
46
46
|
//! The types of columns in the ColumnDataCollection
|
47
|
-
|
47
|
+
vector<LogicalType> &Types() {
|
48
48
|
return types;
|
49
49
|
}
|
50
|
-
|
50
|
+
const vector<LogicalType> &Types() const {
|
51
51
|
return types;
|
52
52
|
}
|
53
53
|
|
54
54
|
//! The amount of rows in the ColumnDataCollection
|
55
|
-
|
55
|
+
const idx_t &Count() const {
|
56
56
|
return count;
|
57
57
|
}
|
58
58
|
|
59
59
|
//! The amount of columns in the ColumnDataCollection
|
60
|
-
|
60
|
+
idx_t ColumnCount() const {
|
61
61
|
return types.size();
|
62
62
|
}
|
63
63
|
|
@@ -177,32 +177,32 @@ public:
|
|
177
177
|
|
178
178
|
public:
|
179
179
|
// container API
|
180
|
-
|
180
|
+
bool empty() const {
|
181
181
|
return rows.empty();
|
182
182
|
}
|
183
|
-
|
183
|
+
idx_t size() const {
|
184
184
|
return rows.size();
|
185
185
|
}
|
186
186
|
|
187
187
|
DUCKDB_API ColumnDataRow &operator[](idx_t i);
|
188
188
|
DUCKDB_API const ColumnDataRow &operator[](idx_t i) const;
|
189
189
|
|
190
|
-
|
190
|
+
vector<ColumnDataRow>::iterator begin() {
|
191
191
|
return rows.begin();
|
192
192
|
}
|
193
|
-
|
193
|
+
vector<ColumnDataRow>::iterator end() {
|
194
194
|
return rows.end();
|
195
195
|
}
|
196
|
-
|
196
|
+
vector<ColumnDataRow>::const_iterator cbegin() const {
|
197
197
|
return rows.cbegin();
|
198
198
|
}
|
199
|
-
|
199
|
+
vector<ColumnDataRow>::const_iterator cend() const {
|
200
200
|
return rows.cend();
|
201
201
|
}
|
202
|
-
|
202
|
+
vector<ColumnDataRow>::const_iterator begin() const {
|
203
203
|
return rows.begin();
|
204
204
|
}
|
205
|
-
|
205
|
+
vector<ColumnDataRow>::const_iterator end() const {
|
206
206
|
return rows.end();
|
207
207
|
}
|
208
208
|
|
package/src/duckdb/src/include/duckdb/common/types/column/column_data_collection_iterators.hpp
CHANGED
@@ -43,10 +43,10 @@ private:
|
|
43
43
|
};
|
44
44
|
|
45
45
|
public:
|
46
|
-
|
46
|
+
ColumnDataChunkIterator begin() {
|
47
47
|
return ColumnDataChunkIterator(&collection, column_ids);
|
48
48
|
}
|
49
|
-
|
49
|
+
ColumnDataChunkIterator end() {
|
50
50
|
return ColumnDataChunkIterator(nullptr, vector<column_t>());
|
51
51
|
}
|
52
52
|
};
|
@@ -165,7 +165,7 @@ public:
|
|
165
165
|
|
166
166
|
//! Create a blob Value from a data pointer and a length: no bytes are interpreted
|
167
167
|
DUCKDB_API static Value BLOB(const_data_ptr_t data, idx_t len);
|
168
|
-
|
168
|
+
static Value BLOB_RAW(const string &data) { // NOLINT
|
169
169
|
return Value::BLOB((const_data_ptr_t)data.c_str(), data.size());
|
170
170
|
}
|
171
171
|
//! Creates a blob by casting a specified string to a blob (i.e. interpreting \x characters)
|
@@ -241,12 +241,22 @@ public:
|
|
241
241
|
|
242
242
|
void PushBack(const Value &insert);
|
243
243
|
|
244
|
-
idx_t
|
245
|
-
|
244
|
+
idx_t GetSize() {
|
245
|
+
return size;
|
246
|
+
}
|
247
|
+
|
248
|
+
idx_t GetCapacity() {
|
249
|
+
return capacity;
|
250
|
+
}
|
251
|
+
|
252
|
+
void SetCapacity(idx_t new_capacity);
|
253
|
+
void SetSize(idx_t new_size);
|
246
254
|
|
247
255
|
private:
|
248
256
|
//! child vectors used for nested data
|
249
257
|
unique_ptr<Vector> child;
|
258
|
+
idx_t capacity = 0;
|
259
|
+
idx_t size = 0;
|
250
260
|
};
|
251
261
|
|
252
262
|
//! The ManagedVectorBuffer holds a buffer handle
|
@@ -308,14 +308,14 @@ struct LogicalType {
|
|
308
308
|
DUCKDB_API static LogicalType FormatDeserialize(FormatDeserializer &deserializer);
|
309
309
|
|
310
310
|
|
311
|
-
|
311
|
+
static bool TypeIsTimestamp(LogicalTypeId id) {
|
312
312
|
return (id == LogicalTypeId::TIMESTAMP ||
|
313
313
|
id == LogicalTypeId::TIMESTAMP_MS ||
|
314
314
|
id == LogicalTypeId::TIMESTAMP_NS ||
|
315
315
|
id == LogicalTypeId::TIMESTAMP_SEC ||
|
316
316
|
id == LogicalTypeId::TIMESTAMP_TZ);
|
317
317
|
}
|
318
|
-
|
318
|
+
static bool TypeIsTimestamp(const LogicalType& type) {
|
319
319
|
return TypeIsTimestamp(type.id());
|
320
320
|
}
|
321
321
|
DUCKDB_API string ToString() const;
|
@@ -48,7 +48,7 @@ struct ExecuteFunctionState : public ExpressionState {
|
|
48
48
|
unique_ptr<FunctionLocalState> local_state;
|
49
49
|
|
50
50
|
public:
|
51
|
-
|
51
|
+
static FunctionLocalState *GetFunctionState(ExpressionState &state) {
|
52
52
|
return ((ExecuteFunctionState &)state).local_state.get();
|
53
53
|
}
|
54
54
|
};
|
@@ -19,13 +19,15 @@
|
|
19
19
|
|
20
20
|
namespace duckdb {
|
21
21
|
|
22
|
-
enum NewLineIdentifier {
|
22
|
+
enum class NewLineIdentifier : uint8_t {
|
23
23
|
SINGLE = 1, // Either \r or \n
|
24
24
|
CARRY_ON = 2, // \r\n
|
25
25
|
MIX = 3, // Hippie-Land, can't run it multithreaded
|
26
26
|
NOT_SET = 4
|
27
27
|
};
|
28
28
|
|
29
|
+
enum class ParallelMode { AUTOMATIC = 0, PARALLEL = 1, SINGLE_THREADED = 2 };
|
30
|
+
|
29
31
|
struct BufferedCSVReaderOptions {
|
30
32
|
//===--------------------------------------------------------------------===//
|
31
33
|
// CommonCSVOptions
|
@@ -116,13 +118,16 @@ struct BufferedCSVReaderOptions {
|
|
116
118
|
//! If we are running the parallel version of the CSV Reader. In general, the system should always auto-detect
|
117
119
|
//! When it can't execute a parallel run before execution. However, there are (rather specific) situations where
|
118
120
|
//! setting up this manually might be important
|
119
|
-
|
121
|
+
ParallelMode parallel_mode;
|
120
122
|
//===--------------------------------------------------------------------===//
|
121
123
|
// WriteCSVOptions
|
122
124
|
//===--------------------------------------------------------------------===//
|
123
|
-
|
124
125
|
//! True, if column with that index must be quoted
|
125
126
|
vector<bool> force_quote;
|
127
|
+
//! Prefix/suffix/custom newline the entire file once (enables writing of files as JSON arrays)
|
128
|
+
string prefix;
|
129
|
+
string suffix;
|
130
|
+
string write_newline;
|
126
131
|
|
127
132
|
//! The date format to use (if any is specified)
|
128
133
|
std::map<LogicalTypeId, StrpTimeFormat> date_format = {{LogicalTypeId::DATE, {}}, {LogicalTypeId::TIMESTAMP, {}}};
|
@@ -130,8 +135,7 @@ struct BufferedCSVReaderOptions {
|
|
130
135
|
std::map<LogicalTypeId, StrfTimeFormat> write_date_format = {{LogicalTypeId::DATE, {}},
|
131
136
|
{LogicalTypeId::TIMESTAMP, {}}};
|
132
137
|
//! Whether or not a type format is specified
|
133
|
-
std::map<LogicalTypeId, bool> has_format = {
|
134
|
-
{LogicalTypeId::DATE, false}, {LogicalTypeId::TIMESTAMP, false}, {LogicalTypeId::TIMESTAMP_TZ, false}};
|
138
|
+
std::map<LogicalTypeId, bool> has_format = {{LogicalTypeId::DATE, false}, {LogicalTypeId::TIMESTAMP, false}};
|
135
139
|
|
136
140
|
void Serialize(FieldWriter &writer) const;
|
137
141
|
void Deserialize(FieldReader &reader);
|
@@ -38,7 +38,7 @@ public:
|
|
38
38
|
SinkResultType Sink(ExecutionContext &context, DataChunk &chunk, OperatorSinkInput &input) const override;
|
39
39
|
|
40
40
|
bool IsSink() const override {
|
41
|
-
return
|
41
|
+
return !children.empty();
|
42
42
|
}
|
43
43
|
|
44
44
|
bool ParallelSink() const override {
|
@@ -81,7 +81,6 @@ typedef unique_ptr<FunctionData> (*aggregate_deserialize_t)(ClientContext &conte
|
|
81
81
|
|
82
82
|
class AggregateFunction : public BaseScalarFunction {
|
83
83
|
public:
|
84
|
-
DUCKDB_API
|
85
84
|
AggregateFunction(const string &name, const vector<LogicalType> &arguments, const LogicalType &return_type,
|
86
85
|
aggregate_size_t state_size, aggregate_initialize_t initialize, aggregate_update_t update,
|
87
86
|
aggregate_combine_t combine, aggregate_finalize_t finalize,
|
@@ -97,7 +96,6 @@ public:
|
|
97
96
|
serialize(serialize), deserialize(deserialize), order_dependent(AggregateOrderDependent::ORDER_DEPENDENT) {
|
98
97
|
}
|
99
98
|
|
100
|
-
DUCKDB_API
|
101
99
|
AggregateFunction(const string &name, const vector<LogicalType> &arguments, const LogicalType &return_type,
|
102
100
|
aggregate_size_t state_size, aggregate_initialize_t initialize, aggregate_update_t update,
|
103
101
|
aggregate_combine_t combine, aggregate_finalize_t finalize,
|
@@ -112,21 +110,19 @@ public:
|
|
112
110
|
serialize(serialize), deserialize(deserialize), order_dependent(AggregateOrderDependent::ORDER_DEPENDENT) {
|
113
111
|
}
|
114
112
|
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
aggregate_deserialize_t deserialize = nullptr)
|
113
|
+
AggregateFunction(const vector<LogicalType> &arguments, const LogicalType &return_type, aggregate_size_t state_size,
|
114
|
+
aggregate_initialize_t initialize, aggregate_update_t update, aggregate_combine_t combine,
|
115
|
+
aggregate_finalize_t finalize,
|
116
|
+
FunctionNullHandling null_handling = FunctionNullHandling::DEFAULT_NULL_HANDLING,
|
117
|
+
aggregate_simple_update_t simple_update = nullptr, bind_aggregate_function_t bind = nullptr,
|
118
|
+
aggregate_destructor_t destructor = nullptr, aggregate_statistics_t statistics = nullptr,
|
119
|
+
aggregate_window_t window = nullptr, aggregate_serialize_t serialize = nullptr,
|
120
|
+
aggregate_deserialize_t deserialize = nullptr)
|
124
121
|
: AggregateFunction(string(), arguments, return_type, state_size, initialize, update, combine, finalize,
|
125
122
|
null_handling, simple_update, bind, destructor, statistics, window, serialize,
|
126
123
|
deserialize) {
|
127
124
|
}
|
128
125
|
|
129
|
-
DUCKDB_API
|
130
126
|
AggregateFunction(const vector<LogicalType> &arguments, const LogicalType &return_type, aggregate_size_t state_size,
|
131
127
|
aggregate_initialize_t initialize, aggregate_update_t update, aggregate_combine_t combine,
|
132
128
|
aggregate_finalize_t finalize, aggregate_simple_update_t simple_update = nullptr,
|
@@ -165,11 +161,11 @@ public:
|
|
165
161
|
//! Whether or not the aggregate is order dependent
|
166
162
|
AggregateOrderDependent order_dependent;
|
167
163
|
|
168
|
-
|
164
|
+
bool operator==(const AggregateFunction &rhs) const {
|
169
165
|
return state_size == rhs.state_size && initialize == rhs.initialize && update == rhs.update &&
|
170
166
|
combine == rhs.combine && finalize == rhs.finalize && window == rhs.window;
|
171
167
|
}
|
172
|
-
|
168
|
+
bool operator!=(const AggregateFunction &rhs) const {
|
173
169
|
return !(*this == rhs);
|
174
170
|
}
|
175
171
|
|
@@ -21,7 +21,7 @@ enum class MacroType : uint8_t { VOID_MACRO = 0, TABLE_MACRO = 1, SCALAR_MACRO =
|
|
21
21
|
|
22
22
|
class MacroFunction {
|
23
23
|
public:
|
24
|
-
MacroFunction(MacroType type);
|
24
|
+
explicit MacroFunction(MacroType type);
|
25
25
|
|
26
26
|
//! The type
|
27
27
|
MacroType type;
|
@@ -45,6 +45,12 @@ public:
|
|
45
45
|
|
46
46
|
virtual string ToSQL(const string &schema, const string &name) const;
|
47
47
|
|
48
|
+
void Serialize(Serializer &serializer) const;
|
49
|
+
static unique_ptr<MacroFunction> Deserialize(Deserializer &deserializer);
|
50
|
+
|
51
|
+
protected:
|
52
|
+
virtual void SerializeInternal(FieldWriter &writer) const = 0;
|
53
|
+
|
48
54
|
public:
|
49
55
|
template <class TARGET>
|
50
56
|
TARGET &Cast() {
|
@@ -66,6 +66,9 @@ public:
|
|
66
66
|
return std::find(specifiers.begin(), specifiers.end(), s) != specifiers.end();
|
67
67
|
}
|
68
68
|
|
69
|
+
//! The full format specifier, for error messages
|
70
|
+
string format_specifier;
|
71
|
+
|
69
72
|
protected:
|
70
73
|
//! The format specifiers
|
71
74
|
vector<StrTimeSpecifier> specifiers;
|
@@ -134,10 +137,6 @@ public:
|
|
134
137
|
DUCKDB_API string FormatError(string_t input, const string &format_specifier);
|
135
138
|
};
|
136
139
|
|
137
|
-
public:
|
138
|
-
//! The full format specifier, for error messages
|
139
|
-
string format_specifier;
|
140
|
-
|
141
140
|
public:
|
142
141
|
DUCKDB_API static ParseResult Parse(const string &format, const string &text);
|
143
142
|
|
@@ -23,9 +23,9 @@ public:
|
|
23
23
|
static constexpr const MacroType TYPE = MacroType::SCALAR_MACRO;
|
24
24
|
|
25
25
|
public:
|
26
|
-
ScalarMacroFunction(unique_ptr<ParsedExpression> expression);
|
27
|
-
|
26
|
+
explicit ScalarMacroFunction(unique_ptr<ParsedExpression> expression);
|
28
27
|
ScalarMacroFunction(void);
|
28
|
+
|
29
29
|
//! The macro expression
|
30
30
|
unique_ptr<ParsedExpression> expression;
|
31
31
|
|
@@ -33,6 +33,11 @@ public:
|
|
33
33
|
unique_ptr<MacroFunction> Copy() const override;
|
34
34
|
|
35
35
|
string ToSQL(const string &schema, const string &name) const override;
|
36
|
+
|
37
|
+
static unique_ptr<MacroFunction> Deserialize(FieldReader &reader);
|
38
|
+
|
39
|
+
protected:
|
40
|
+
void SerializeInternal(FieldWriter &writer) const override;
|
36
41
|
};
|
37
42
|
|
38
43
|
} // namespace duckdb
|
@@ -33,6 +33,11 @@ public:
|
|
33
33
|
unique_ptr<MacroFunction> Copy() const override;
|
34
34
|
|
35
35
|
string ToSQL(const string &schema, const string &name) const override;
|
36
|
+
|
37
|
+
static unique_ptr<MacroFunction> Deserialize(FieldReader &reader);
|
38
|
+
|
39
|
+
protected:
|
40
|
+
void SerializeInternal(FieldWriter &writer) const override;
|
36
41
|
};
|
37
42
|
|
38
43
|
} // namespace duckdb
|