duckdb 0.7.2-dev3546.0 → 0.7.2-dev3710.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/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 +11 -9
- package/src/duckdb/extension/json/json_functions/json_valid.cpp +1 -1
- package/src/duckdb/extension/json/json_functions/read_json.cpp +166 -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/common/exception.cpp +17 -0
- package/src/duckdb/src/common/exception_format_value.cpp +14 -0
- package/src/duckdb/src/common/file_system.cpp +78 -36
- package/src/duckdb/src/common/local_file_system.cpp +5 -16
- package/src/duckdb/src/common/types.cpp +1 -1
- package/src/duckdb/src/core_functions/scalar/list/list_lambdas.cpp +1 -1
- 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/persistent/physical_export.cpp +2 -2
- package/src/duckdb/src/function/pragma/pragma_queries.cpp +6 -4
- package/src/duckdb/src/function/table/copy_csv.cpp +66 -12
- package/src/duckdb/src/function/table/read_csv.cpp +16 -3
- package/src/duckdb/src/function/table/version/pragma_version.cpp +8 -2
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/column_dependency_manager.hpp +1 -1
- 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/exception.hpp +3 -3
- package/src/duckdb/src/include/duckdb/common/exception_format_value.hpp +26 -0
- package/src/duckdb/src/include/duckdb/common/file_system.hpp +11 -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 +25 -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.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 +8 -3
- package/src/duckdb/src/include/duckdb/function/aggregate_function.hpp +10 -14
- package/src/duckdb/src/include/duckdb/function/table_function.hpp +1 -1
- 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/expression/function_expression.hpp +1 -1
- package/src/duckdb/src/include/duckdb/parser/expression/operator_expression.hpp +2 -2
- package/src/duckdb/src/include/duckdb/parser/keyword_helper.hpp +5 -0
- 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/main/db_instance_cache.cpp +5 -3
- package/src/duckdb/src/main/extension/extension_install.cpp +22 -18
- package/src/duckdb/src/parser/expression/collate_expression.cpp +1 -1
- package/src/duckdb/src/parser/keyword_helper.cpp +11 -1
- package/src/duckdb/src/parser/query_node/select_node.cpp +1 -1
- package/src/duckdb/src/parser/statement/copy_statement.cpp +2 -2
- package/src/duckdb/src/parser/tableref.cpp +1 -1
- package/src/duckdb/src/planner/binder/statement/bind_copy.cpp +9 -4
- package/src/duckdb/src/planner/binder/tableref/bind_basetableref.cpp +1 -1
- package/src/duckdb/src/storage/single_file_block_manager.cpp +0 -4
- package/src/duckdb/src/storage/storage_manager.cpp +3 -0
- package/src/duckdb/third_party/libpg_query/src_backend_parser_gram.cpp +5735 -5773
@@ -33,8 +33,12 @@ void ReadCSVData::FinalizeRead(ClientContext &context) {
|
|
33
33
|
bool complex_options = options.delimiter.size() > 1 || options.escape.size() > 1 || options.quote.size() > 1;
|
34
34
|
bool not_supported_options = options.null_padding;
|
35
35
|
|
36
|
-
|
37
|
-
|
36
|
+
auto number_of_threads = TaskScheduler::GetScheduler(context).NumberOfThreads();
|
37
|
+
if (options.parallel_mode != ParallelMode::PARALLEL && int64_t(files.size() * 2) >= number_of_threads) {
|
38
|
+
single_threaded = true;
|
39
|
+
}
|
40
|
+
if (options.parallel_mode == ParallelMode::SINGLE_THREADED || null_or_empty || not_supported_options ||
|
41
|
+
complex_options || options.new_line == NewLineIdentifier::MIX) {
|
38
42
|
// not supported for parallel CSV reading
|
39
43
|
single_threaded = true;
|
40
44
|
}
|
@@ -173,7 +177,8 @@ static unique_ptr<FunctionData> ReadCSVBind(ClientContext &context, TableFunctio
|
|
173
177
|
} else if (loption == "normalize_names") {
|
174
178
|
options.normalize_names = BooleanValue::Get(kv.second);
|
175
179
|
} else if (loption == "parallel") {
|
176
|
-
options.
|
180
|
+
options.parallel_mode =
|
181
|
+
BooleanValue::Get(kv.second) ? ParallelMode::PARALLEL : ParallelMode::SINGLE_THREADED;
|
177
182
|
} else {
|
178
183
|
options.SetReadOption(loption, kv.second, names);
|
179
184
|
}
|
@@ -581,6 +586,9 @@ bool LineInfo::CanItGetLine(idx_t file_idx, idx_t batch_idx) {
|
|
581
586
|
if (current_batches.empty() || done) {
|
582
587
|
return true;
|
583
588
|
}
|
589
|
+
if (file_idx >= current_batches.size() || current_batches[file_idx].empty()) {
|
590
|
+
return true;
|
591
|
+
}
|
584
592
|
auto min_value = *current_batches[file_idx].begin();
|
585
593
|
if (min_value >= batch_idx) {
|
586
594
|
return true;
|
@@ -1190,6 +1198,11 @@ unique_ptr<TableRef> ReadCSVReplacement(ClientContext &context, const string &ta
|
|
1190
1198
|
vector<unique_ptr<ParsedExpression>> children;
|
1191
1199
|
children.push_back(make_uniq<ConstantExpression>(Value(table_name)));
|
1192
1200
|
table_function->function = make_uniq<FunctionExpression>("read_csv_auto", std::move(children));
|
1201
|
+
|
1202
|
+
if (!FileSystem::HasGlob(table_name)) {
|
1203
|
+
table_function->alias = FileSystem::ExtractBaseName(table_name);
|
1204
|
+
}
|
1205
|
+
|
1193
1206
|
return std::move(table_function);
|
1194
1207
|
}
|
1195
1208
|
|
@@ -1,14 +1,16 @@
|
|
1
1
|
#ifndef DUCKDB_VERSION
|
2
|
-
#define DUCKDB_VERSION "0.7.2-
|
2
|
+
#define DUCKDB_VERSION "0.7.2-dev3710"
|
3
3
|
#endif
|
4
4
|
#ifndef DUCKDB_SOURCE_ID
|
5
|
-
#define DUCKDB_SOURCE_ID "
|
5
|
+
#define DUCKDB_SOURCE_ID "59a4ec3adc"
|
6
6
|
#endif
|
7
7
|
#include "duckdb/function/table/system_functions.hpp"
|
8
8
|
#include "duckdb/main/database.hpp"
|
9
9
|
|
10
10
|
#include <cstdint>
|
11
11
|
|
12
|
+
#define DUCKDB_STRINGIFY(x) #x
|
13
|
+
|
12
14
|
namespace duckdb {
|
13
15
|
|
14
16
|
struct PragmaVersionData : public GlobalTableFunctionState {
|
@@ -89,6 +91,10 @@ string DuckDB::Platform() {
|
|
89
91
|
#endif
|
90
92
|
#ifdef __MINGW32__
|
91
93
|
postfix = "_mingw";
|
94
|
+
#endif
|
95
|
+
// this is used for the windows R builds which use a separate build environment
|
96
|
+
#ifdef DUCKDB_OVERRIDE_PLATFORM_POSTFIX
|
97
|
+
postfix = DUCKDB_STRINGIFY(DUCKDB_OVERRIDE_PLATFORM_POSTFIX);
|
92
98
|
#endif
|
93
99
|
return os + "_" + arch + postfix;
|
94
100
|
}
|
@@ -23,7 +23,7 @@ class ColumnDependencyManager {
|
|
23
23
|
public:
|
24
24
|
DUCKDB_API ColumnDependencyManager();
|
25
25
|
DUCKDB_API ~ColumnDependencyManager();
|
26
|
-
|
26
|
+
ColumnDependencyManager(ColumnDependencyManager &&other) = default;
|
27
27
|
ColumnDependencyManager(const ColumnDependencyManager &other) = delete;
|
28
28
|
|
29
29
|
public:
|
@@ -46,7 +46,7 @@ public:
|
|
46
46
|
DUCKDB_API void Reset();
|
47
47
|
|
48
48
|
DUCKDB_API const vector<CatalogSearchEntry> &Get();
|
49
|
-
|
49
|
+
const vector<CatalogSearchEntry> &GetSetPaths() {
|
50
50
|
return set_paths;
|
51
51
|
}
|
52
52
|
DUCKDB_API const CatalogSearchEntry &GetDefault();
|
@@ -121,7 +121,7 @@ public:
|
|
121
121
|
DUCKDB_API static bool UncaughtException();
|
122
122
|
|
123
123
|
DUCKDB_API static string GetStackTrace(int max_depth = 120);
|
124
|
-
|
124
|
+
static string FormatStackTrace(string message = "") {
|
125
125
|
return (message + "\n" + GetStackTrace());
|
126
126
|
}
|
127
127
|
|
@@ -269,7 +269,7 @@ public:
|
|
269
269
|
class IOException : public Exception {
|
270
270
|
public:
|
271
271
|
DUCKDB_API explicit IOException(const string &msg);
|
272
|
-
|
272
|
+
explicit IOException(ExceptionType exception_type, const string &msg) : Exception(exception_type, msg) {
|
273
273
|
}
|
274
274
|
|
275
275
|
template <typename... Args>
|
@@ -371,7 +371,7 @@ public:
|
|
371
371
|
|
372
372
|
class FatalException : public Exception {
|
373
373
|
public:
|
374
|
-
|
374
|
+
explicit FatalException(const string &msg) : FatalException(ExceptionType::FATAL, msg) {
|
375
375
|
}
|
376
376
|
template <typename... Args>
|
377
377
|
explicit FatalException(const string &msg, Args... params) : FatalException(ConstructMessage(msg, params...)) {
|
@@ -15,6 +15,28 @@
|
|
15
15
|
|
16
16
|
namespace duckdb {
|
17
17
|
|
18
|
+
// Helper class to support custom overloading
|
19
|
+
// Escaping " and quoting the value with "
|
20
|
+
class SQLIdentifier {
|
21
|
+
public:
|
22
|
+
SQLIdentifier(const string &raw_string) : raw_string(raw_string) {
|
23
|
+
}
|
24
|
+
|
25
|
+
public:
|
26
|
+
string raw_string;
|
27
|
+
};
|
28
|
+
|
29
|
+
// Helper class to support custom overloading
|
30
|
+
// Escaping ' and quoting the value with '
|
31
|
+
class SQLString {
|
32
|
+
public:
|
33
|
+
SQLString(const string &raw_string) : raw_string(raw_string) {
|
34
|
+
}
|
35
|
+
|
36
|
+
public:
|
37
|
+
string raw_string;
|
38
|
+
};
|
39
|
+
|
18
40
|
enum class PhysicalType : uint8_t;
|
19
41
|
struct LogicalType;
|
20
42
|
|
@@ -47,6 +69,10 @@ public:
|
|
47
69
|
template <>
|
48
70
|
DUCKDB_API ExceptionFormatValue ExceptionFormatValue::CreateFormatValue(PhysicalType value);
|
49
71
|
template <>
|
72
|
+
DUCKDB_API ExceptionFormatValue ExceptionFormatValue::CreateFormatValue(SQLString value);
|
73
|
+
template <>
|
74
|
+
DUCKDB_API ExceptionFormatValue ExceptionFormatValue::CreateFormatValue(SQLIdentifier value);
|
75
|
+
template <>
|
50
76
|
DUCKDB_API ExceptionFormatValue ExceptionFormatValue::CreateFormatValue(LogicalType value);
|
51
77
|
template <>
|
52
78
|
DUCKDB_API ExceptionFormatValue ExceptionFormatValue::CreateFormatValue(float value);
|
@@ -178,6 +178,9 @@ public:
|
|
178
178
|
DUCKDB_API static string PathSeparator();
|
179
179
|
//! Checks if path is starts with separator (i.e., '/' on UNIX '\\' on Windows)
|
180
180
|
DUCKDB_API static bool IsPathAbsolute(const string &path);
|
181
|
+
//! Normalize an absolute path - the goal of normalizing is converting "\test.db" and "C:/test.db" into "C:\test.db"
|
182
|
+
//! so that the database system cache can correctly
|
183
|
+
DUCKDB_API static string NormalizeAbsolutePath(const string &path);
|
181
184
|
//! Join two paths together
|
182
185
|
DUCKDB_API static string JoinPath(const string &a, const string &path);
|
183
186
|
//! Convert separators in a path to the local separators (e.g. convert "/" into \\ on windows)
|
@@ -187,6 +190,11 @@ public:
|
|
187
190
|
//! Extract the name of a file (e.g if the input is lib/example.dll the name is 'example.dll')
|
188
191
|
DUCKDB_API static string ExtractName(const string &path);
|
189
192
|
|
193
|
+
//! Returns the value of an environment variable - or the empty string if it is not set
|
194
|
+
DUCKDB_API static string GetEnvVariable(const string &name);
|
195
|
+
|
196
|
+
//! Whether there is a glob in the string
|
197
|
+
DUCKDB_API static bool HasGlob(const string &str);
|
190
198
|
//! Runs a glob on the file system, returning a list of matching files
|
191
199
|
DUCKDB_API virtual vector<string> Glob(const string &path, FileOpener *opener = nullptr);
|
192
200
|
DUCKDB_API vector<string> GlobFiles(const string &path, ClientContext &context,
|
@@ -224,6 +232,9 @@ public:
|
|
224
232
|
|
225
233
|
//! Return the name of the filesytem. Used for forming diagnosis messages.
|
226
234
|
DUCKDB_API virtual std::string GetName() const = 0;
|
235
|
+
|
236
|
+
//! Whether or not a file is remote or local, based only on file path
|
237
|
+
DUCKDB_API static bool IsRemoteFile(const string &path);
|
227
238
|
};
|
228
239
|
|
229
240
|
} // namespace duckdb
|
@@ -12,6 +12,7 @@
|
|
12
12
|
#include "duckdb/main/client_context.hpp"
|
13
13
|
#include "duckdb/main/client_data.hpp"
|
14
14
|
#include "duckdb/common/atomic.hpp"
|
15
|
+
#include "duckdb/common/optional_ptr.hpp"
|
15
16
|
|
16
17
|
namespace duckdb {
|
17
18
|
|
@@ -48,7 +49,7 @@ public:
|
|
48
49
|
}
|
49
50
|
|
50
51
|
//! helper function to get the HTTP
|
51
|
-
static HTTPState
|
52
|
+
static optional_ptr<HTTPState> TryGetState(FileOpener *opener) {
|
52
53
|
auto client_context = FileOpener::TryGetClientContext(opener);
|
53
54
|
if (client_context) {
|
54
55
|
return client_context->client_data->http_state.get();
|
@@ -12,14 +12,14 @@ public:
|
|
12
12
|
int64_t upper;
|
13
13
|
|
14
14
|
public:
|
15
|
-
|
15
|
+
hugeint_t() = default;
|
16
16
|
DUCKDB_API hugeint_t(int64_t value); // NOLINT: Allow implicit conversion from `int64_t`
|
17
|
-
|
17
|
+
constexpr hugeint_t(int64_t upper, uint64_t lower) : lower(lower), upper(upper) {
|
18
18
|
}
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
19
|
+
constexpr hugeint_t(const hugeint_t &rhs) = default;
|
20
|
+
constexpr hugeint_t(hugeint_t &&rhs) = default;
|
21
|
+
hugeint_t &operator=(const hugeint_t &rhs) = default;
|
22
|
+
hugeint_t &operator=(hugeint_t &&rhs) = default;
|
23
23
|
|
24
24
|
DUCKDB_API string ToString() const;
|
25
25
|
|
@@ -19,10 +19,10 @@ namespace duckdb {
|
|
19
19
|
|
20
20
|
template <class T>
|
21
21
|
struct NumericLimits {
|
22
|
-
|
22
|
+
static constexpr T Minimum() {
|
23
23
|
return std::numeric_limits<T>::lowest();
|
24
24
|
};
|
25
|
-
|
25
|
+
static constexpr T Maximum() {
|
26
26
|
return std::numeric_limits<T>::max();
|
27
27
|
};
|
28
28
|
DUCKDB_API static bool IsSigned();
|
@@ -31,169 +31,169 @@ struct NumericLimits {
|
|
31
31
|
|
32
32
|
template <>
|
33
33
|
struct NumericLimits<int8_t> {
|
34
|
-
|
34
|
+
static constexpr int8_t Minimum() {
|
35
35
|
return std::numeric_limits<int8_t>::lowest();
|
36
36
|
};
|
37
|
-
|
37
|
+
static constexpr int8_t Maximum() {
|
38
38
|
return std::numeric_limits<int8_t>::max();
|
39
39
|
};
|
40
|
-
|
40
|
+
static bool IsSigned() {
|
41
41
|
return true;
|
42
42
|
}
|
43
|
-
|
43
|
+
static idx_t Digits() {
|
44
44
|
return 3;
|
45
45
|
}
|
46
46
|
};
|
47
47
|
template <>
|
48
48
|
struct NumericLimits<int16_t> {
|
49
|
-
|
49
|
+
static constexpr int16_t Minimum() {
|
50
50
|
return std::numeric_limits<int16_t>::lowest();
|
51
51
|
};
|
52
|
-
|
52
|
+
static constexpr int16_t Maximum() {
|
53
53
|
return std::numeric_limits<int16_t>::max();
|
54
54
|
};
|
55
|
-
|
55
|
+
static bool IsSigned() {
|
56
56
|
return true;
|
57
57
|
}
|
58
|
-
|
58
|
+
static idx_t Digits() {
|
59
59
|
return 5;
|
60
60
|
}
|
61
61
|
};
|
62
62
|
template <>
|
63
63
|
struct NumericLimits<int32_t> {
|
64
|
-
|
64
|
+
static constexpr int32_t Minimum() {
|
65
65
|
return std::numeric_limits<int32_t>::lowest();
|
66
66
|
};
|
67
|
-
|
67
|
+
static constexpr int32_t Maximum() {
|
68
68
|
return std::numeric_limits<int32_t>::max();
|
69
69
|
};
|
70
|
-
|
70
|
+
static bool IsSigned() {
|
71
71
|
return true;
|
72
72
|
}
|
73
|
-
|
73
|
+
static idx_t Digits() {
|
74
74
|
return 10;
|
75
75
|
}
|
76
76
|
};
|
77
77
|
|
78
78
|
template <>
|
79
79
|
struct NumericLimits<int64_t> {
|
80
|
-
|
80
|
+
static constexpr int64_t Minimum() {
|
81
81
|
return std::numeric_limits<int64_t>::lowest();
|
82
82
|
};
|
83
|
-
|
83
|
+
static constexpr int64_t Maximum() {
|
84
84
|
return std::numeric_limits<int64_t>::max();
|
85
85
|
};
|
86
|
-
|
86
|
+
static bool IsSigned() {
|
87
87
|
return true;
|
88
88
|
}
|
89
|
-
|
89
|
+
static idx_t Digits() {
|
90
90
|
return 19;
|
91
91
|
}
|
92
92
|
};
|
93
93
|
template <>
|
94
94
|
struct NumericLimits<hugeint_t> {
|
95
|
-
|
95
|
+
static constexpr hugeint_t Minimum() {
|
96
96
|
return {std::numeric_limits<int64_t>::lowest(), 1};
|
97
97
|
};
|
98
|
-
|
98
|
+
static constexpr hugeint_t Maximum() {
|
99
99
|
return {std::numeric_limits<int64_t>::max(), std::numeric_limits<uint64_t>::max()};
|
100
100
|
};
|
101
|
-
|
101
|
+
static bool IsSigned() {
|
102
102
|
return true;
|
103
103
|
}
|
104
|
-
|
104
|
+
static idx_t Digits() {
|
105
105
|
return 39;
|
106
106
|
}
|
107
107
|
};
|
108
108
|
|
109
109
|
template <>
|
110
110
|
struct NumericLimits<uint8_t> {
|
111
|
-
|
111
|
+
static constexpr uint8_t Minimum() {
|
112
112
|
return std::numeric_limits<uint8_t>::lowest();
|
113
113
|
};
|
114
|
-
|
114
|
+
static constexpr uint8_t Maximum() {
|
115
115
|
return std::numeric_limits<uint8_t>::max();
|
116
116
|
};
|
117
|
-
|
117
|
+
static bool IsSigned() {
|
118
118
|
return false;
|
119
119
|
}
|
120
|
-
|
120
|
+
static idx_t Digits() {
|
121
121
|
return 3;
|
122
122
|
}
|
123
123
|
};
|
124
124
|
|
125
125
|
template <>
|
126
126
|
struct NumericLimits<uint16_t> {
|
127
|
-
|
127
|
+
static constexpr uint16_t Minimum() {
|
128
128
|
return std::numeric_limits<uint16_t>::lowest();
|
129
129
|
};
|
130
|
-
|
130
|
+
static constexpr uint16_t Maximum() {
|
131
131
|
return std::numeric_limits<uint16_t>::max();
|
132
132
|
};
|
133
|
-
|
133
|
+
static bool IsSigned() {
|
134
134
|
return false;
|
135
135
|
}
|
136
|
-
|
136
|
+
static idx_t Digits() {
|
137
137
|
return 5;
|
138
138
|
}
|
139
139
|
};
|
140
140
|
template <>
|
141
141
|
struct NumericLimits<uint32_t> {
|
142
|
-
|
142
|
+
static constexpr uint32_t Minimum() {
|
143
143
|
return std::numeric_limits<uint32_t>::lowest();
|
144
144
|
};
|
145
|
-
|
145
|
+
static constexpr uint32_t Maximum() {
|
146
146
|
return std::numeric_limits<uint32_t>::max();
|
147
147
|
};
|
148
|
-
|
148
|
+
static bool IsSigned() {
|
149
149
|
return false;
|
150
150
|
}
|
151
|
-
|
151
|
+
static idx_t Digits() {
|
152
152
|
return 10;
|
153
153
|
}
|
154
154
|
};
|
155
155
|
template <>
|
156
156
|
struct NumericLimits<uint64_t> {
|
157
|
-
|
157
|
+
static constexpr uint64_t Minimum() {
|
158
158
|
return std::numeric_limits<uint64_t>::lowest();
|
159
159
|
};
|
160
|
-
|
160
|
+
static constexpr uint64_t Maximum() {
|
161
161
|
return std::numeric_limits<uint64_t>::max();
|
162
162
|
};
|
163
|
-
|
163
|
+
static bool IsSigned() {
|
164
164
|
return false;
|
165
165
|
}
|
166
|
-
|
166
|
+
static idx_t Digits() {
|
167
167
|
return 20;
|
168
168
|
}
|
169
169
|
};
|
170
170
|
template <>
|
171
171
|
struct NumericLimits<float> {
|
172
|
-
|
172
|
+
static constexpr float Minimum() {
|
173
173
|
return std::numeric_limits<float>::lowest();
|
174
174
|
};
|
175
|
-
|
175
|
+
static constexpr float Maximum() {
|
176
176
|
return std::numeric_limits<float>::max();
|
177
177
|
};
|
178
|
-
|
178
|
+
static bool IsSigned() {
|
179
179
|
return true;
|
180
180
|
}
|
181
|
-
|
181
|
+
static idx_t Digits() {
|
182
182
|
return 127;
|
183
183
|
}
|
184
184
|
};
|
185
185
|
template <>
|
186
186
|
struct NumericLimits<double> {
|
187
|
-
|
187
|
+
static constexpr double Minimum() {
|
188
188
|
return std::numeric_limits<double>::lowest();
|
189
189
|
};
|
190
|
-
|
190
|
+
static constexpr double Maximum() {
|
191
191
|
return std::numeric_limits<double>::max();
|
192
192
|
};
|
193
|
-
|
193
|
+
static bool IsSigned() {
|
194
194
|
return true;
|
195
195
|
}
|
196
|
-
|
196
|
+
static idx_t Digits() {
|
197
197
|
return 250;
|
198
198
|
}
|
199
199
|
};
|
@@ -22,21 +22,21 @@ class Vector;
|
|
22
22
|
|
23
23
|
struct TryCast {
|
24
24
|
template <class SRC, class DST>
|
25
|
-
|
25
|
+
static inline bool Operation(SRC input, DST &result, bool strict = false) {
|
26
26
|
throw NotImplementedException("Unimplemented type for cast (%s -> %s)", GetTypeId<SRC>(), GetTypeId<DST>());
|
27
27
|
}
|
28
28
|
};
|
29
29
|
|
30
30
|
struct TryCastErrorMessage {
|
31
31
|
template <class SRC, class DST>
|
32
|
-
|
32
|
+
static inline bool Operation(SRC input, DST &result, string *error_message, bool strict = false) {
|
33
33
|
throw NotImplementedException("Unimplemented type for cast (%s -> %s)", GetTypeId<SRC>(), GetTypeId<DST>());
|
34
34
|
}
|
35
35
|
};
|
36
36
|
|
37
37
|
struct TryCastErrorMessageCommaSeparated {
|
38
38
|
template <class SRC, class DST>
|
39
|
-
|
39
|
+
static inline bool Operation(SRC input, DST &result, string *error_message, bool strict = false) {
|
40
40
|
throw NotImplementedException("Unimplemented type for cast (%s -> %s)", GetTypeId<SRC>(), GetTypeId<DST>());
|
41
41
|
}
|
42
42
|
};
|
@@ -520,21 +520,21 @@ DUCKDB_API bool TryCastErrorMessage::Operation(string_t input, interval_t &resul
|
|
520
520
|
//===--------------------------------------------------------------------===//
|
521
521
|
struct TryCastToTimestampNS {
|
522
522
|
template <class SRC, class DST>
|
523
|
-
|
523
|
+
static inline bool Operation(SRC input, DST &result, bool strict = false) {
|
524
524
|
throw InternalException("Unsupported type for try cast to timestamp (ns)");
|
525
525
|
}
|
526
526
|
};
|
527
527
|
|
528
528
|
struct TryCastToTimestampMS {
|
529
529
|
template <class SRC, class DST>
|
530
|
-
|
530
|
+
static inline bool Operation(SRC input, DST &result, bool strict = false) {
|
531
531
|
throw InternalException("Unsupported type for try cast to timestamp (ms)");
|
532
532
|
}
|
533
533
|
};
|
534
534
|
|
535
535
|
struct TryCastToTimestampSec {
|
536
536
|
template <class SRC, class DST>
|
537
|
-
|
537
|
+
static inline bool Operation(SRC input, DST &result, bool strict = false) {
|
538
538
|
throw InternalException("Unsupported type for try cast to timestamp (s)");
|
539
539
|
}
|
540
540
|
};
|
@@ -702,8 +702,8 @@ duckdb::string_t CastFromUUID::Operation(duckdb::hugeint_t input, Vector &vector
|
|
702
702
|
|
703
703
|
struct TryCastToUUID {
|
704
704
|
template <class SRC, class DST>
|
705
|
-
|
706
|
-
|
705
|
+
static inline bool Operation(SRC input, DST &result, Vector &result_vector, string *error_message,
|
706
|
+
bool strict = false) {
|
707
707
|
throw InternalException("Unsupported type for try cast to uuid");
|
708
708
|
}
|
709
709
|
};
|
@@ -23,41 +23,41 @@ namespace duckdb {
|
|
23
23
|
//===--------------------------------------------------------------------===//
|
24
24
|
struct Equals {
|
25
25
|
template <class T>
|
26
|
-
|
26
|
+
static inline bool Operation(const T &left, const T &right) {
|
27
27
|
return left == right;
|
28
28
|
}
|
29
29
|
};
|
30
30
|
struct NotEquals {
|
31
31
|
template <class T>
|
32
|
-
|
32
|
+
static inline bool Operation(const T &left, const T &right) {
|
33
33
|
return !Equals::Operation(left, right);
|
34
34
|
}
|
35
35
|
};
|
36
36
|
|
37
37
|
struct GreaterThan {
|
38
38
|
template <class T>
|
39
|
-
|
39
|
+
static inline bool Operation(const T &left, const T &right) {
|
40
40
|
return left > right;
|
41
41
|
}
|
42
42
|
};
|
43
43
|
|
44
44
|
struct GreaterThanEquals {
|
45
45
|
template <class T>
|
46
|
-
|
46
|
+
static inline bool Operation(const T &left, const T &right) {
|
47
47
|
return !GreaterThan::Operation(right, left);
|
48
48
|
}
|
49
49
|
};
|
50
50
|
|
51
51
|
struct LessThan {
|
52
52
|
template <class T>
|
53
|
-
|
53
|
+
static inline bool Operation(const T &left, const T &right) {
|
54
54
|
return GreaterThan::Operation(right, left);
|
55
55
|
}
|
56
56
|
};
|
57
57
|
|
58
58
|
struct LessThanEquals {
|
59
59
|
template <class T>
|
60
|
-
|
60
|
+
static inline bool Operation(const T &left, const T &right) {
|
61
61
|
return !GreaterThan::Operation(left, right);
|
62
62
|
}
|
63
63
|
};
|
@@ -17,7 +17,7 @@ namespace duckdb {
|
|
17
17
|
|
18
18
|
struct ConvertToString {
|
19
19
|
template <class SRC>
|
20
|
-
|
20
|
+
static inline string Operation(SRC input) {
|
21
21
|
throw InternalException("Unrecognized type for ConvertToString %s", GetTypeId<SRC>());
|
22
22
|
}
|
23
23
|
};
|
@@ -17,16 +17,14 @@ namespace duckdb {
|
|
17
17
|
//===--------------------------------------------------------------------===//
|
18
18
|
struct TryCastToDecimal {
|
19
19
|
template <class SRC, class DST>
|
20
|
-
|
21
|
-
uint8_t scale) {
|
20
|
+
static inline bool Operation(SRC input, DST &result, string *error_message, uint8_t width, uint8_t scale) {
|
22
21
|
throw NotImplementedException("Unimplemented type for TryCastToDecimal!");
|
23
22
|
}
|
24
23
|
};
|
25
24
|
|
26
25
|
struct TryCastToDecimalCommaSeparated {
|
27
26
|
template <class SRC, class DST>
|
28
|
-
|
29
|
-
uint8_t scale) {
|
27
|
+
static inline bool Operation(SRC input, DST &result, string *error_message, uint8_t width, uint8_t scale) {
|
30
28
|
throw NotImplementedException("Unimplemented type for TryCastToDecimal!");
|
31
29
|
}
|
32
30
|
};
|
@@ -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;
|