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
@@ -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
|
}
|
@@ -1055,6 +1060,12 @@ void BufferedCSVReaderOptions::Serialize(FieldWriter &writer) const {
|
|
1055
1060
|
writer.WriteSerializable(file_options);
|
1056
1061
|
// write options
|
1057
1062
|
writer.WriteListNoReference<bool>(force_quote);
|
1063
|
+
// FIXME: serialize date_format / has_format
|
1064
|
+
vector<string> csv_formats;
|
1065
|
+
for (auto &format : date_format) {
|
1066
|
+
csv_formats.push_back(format.second.format_specifier);
|
1067
|
+
}
|
1068
|
+
writer.WriteList<string>(csv_formats);
|
1058
1069
|
}
|
1059
1070
|
|
1060
1071
|
void BufferedCSVReaderOptions::Deserialize(FieldReader &reader) {
|
@@ -1091,6 +1102,17 @@ void BufferedCSVReaderOptions::Deserialize(FieldReader &reader) {
|
|
1091
1102
|
file_options = reader.ReadRequiredSerializable<MultiFileReaderOptions, MultiFileReaderOptions>();
|
1092
1103
|
// write options
|
1093
1104
|
force_quote = reader.ReadRequiredList<bool>();
|
1105
|
+
auto formats = reader.ReadRequiredList<string>();
|
1106
|
+
vector<LogicalTypeId> format_types {LogicalTypeId::DATE, LogicalTypeId::TIMESTAMP};
|
1107
|
+
for (idx_t f_idx = 0; f_idx < formats.size(); f_idx++) {
|
1108
|
+
auto &format = formats[f_idx];
|
1109
|
+
auto &type = format_types[f_idx];
|
1110
|
+
if (format.empty()) {
|
1111
|
+
continue;
|
1112
|
+
}
|
1113
|
+
has_format[type] = true;
|
1114
|
+
StrTimeFormat::ParseFormatSpecifier(format, date_format[type]);
|
1115
|
+
}
|
1094
1116
|
}
|
1095
1117
|
|
1096
1118
|
static void CSVReaderSerialize(FieldWriter &writer, const FunctionData *bind_data_p, const TableFunction &function) {
|
@@ -1173,6 +1195,11 @@ unique_ptr<TableRef> ReadCSVReplacement(ClientContext &context, const string &ta
|
|
1173
1195
|
vector<unique_ptr<ParsedExpression>> children;
|
1174
1196
|
children.push_back(make_uniq<ConstantExpression>(Value(table_name)));
|
1175
1197
|
table_function->function = make_uniq<FunctionExpression>("read_csv_auto", std::move(children));
|
1198
|
+
|
1199
|
+
if (!FileSystem::HasGlob(table_name)) {
|
1200
|
+
table_function->alias = FileSystem::ExtractBaseName(table_name);
|
1201
|
+
}
|
1202
|
+
|
1176
1203
|
return std::move(table_function);
|
1177
1204
|
}
|
1178
1205
|
|
@@ -1,14 +1,16 @@
|
|
1
1
|
#ifndef DUCKDB_VERSION
|
2
|
-
#define DUCKDB_VERSION "0.7.2-
|
2
|
+
#define DUCKDB_VERSION "0.7.2-dev3666"
|
3
3
|
#endif
|
4
4
|
#ifndef DUCKDB_SOURCE_ID
|
5
|
-
#define DUCKDB_SOURCE_ID "
|
5
|
+
#define DUCKDB_SOURCE_ID "eae707d54c"
|
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
|
}
|
@@ -31,4 +31,14 @@ string TableMacroFunction::ToSQL(const string &schema, const string &name) const
|
|
31
31
|
return MacroFunction::ToSQL(schema, name) + StringUtil::Format("TABLE (%s);", query_node->ToString());
|
32
32
|
}
|
33
33
|
|
34
|
+
void TableMacroFunction::SerializeInternal(FieldWriter &writer) const {
|
35
|
+
writer.WriteSerializable(*query_node);
|
36
|
+
}
|
37
|
+
|
38
|
+
unique_ptr<MacroFunction> TableMacroFunction::Deserialize(FieldReader &reader) {
|
39
|
+
auto result = make_uniq<TableMacroFunction>();
|
40
|
+
result->query_node = reader.ReadRequiredSerializable<QueryNode>();
|
41
|
+
return std::move(result);
|
42
|
+
}
|
43
|
+
|
34
44
|
} // namespace duckdb
|
@@ -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:
|
@@ -24,8 +24,10 @@ public:
|
|
24
24
|
unique_ptr<MacroFunction> function;
|
25
25
|
|
26
26
|
public:
|
27
|
+
virtual unique_ptr<CreateMacroInfo> GetInfoForSerialization() const;
|
27
28
|
//! Serialize the meta information
|
28
|
-
virtual void Serialize(Serializer &serializer) const
|
29
|
+
virtual void Serialize(Serializer &serializer) const;
|
30
|
+
static unique_ptr<CreateMacroInfo> Deserialize(Deserializer &main_source, ClientContext &context);
|
29
31
|
|
30
32
|
string ToSQL() const override {
|
31
33
|
return function->ToSQL(schema.name, name);
|
@@ -23,11 +23,5 @@ public:
|
|
23
23
|
|
24
24
|
public:
|
25
25
|
ScalarMacroCatalogEntry(Catalog &catalog, SchemaCatalogEntry &schema, CreateMacroInfo &info);
|
26
|
-
|
27
|
-
public:
|
28
|
-
//! Serialize the meta information of the ScalarMacroCatalogEntry
|
29
|
-
void Serialize(Serializer &serializer) const override;
|
30
|
-
//! Deserializes to a CreateMacroInfo
|
31
|
-
static unique_ptr<CreateMacroInfo> Deserialize(Deserializer &source, ClientContext &context);
|
32
26
|
};
|
33
27
|
} // namespace duckdb
|
@@ -22,12 +22,6 @@ public:
|
|
22
22
|
|
23
23
|
public:
|
24
24
|
TableMacroCatalogEntry(Catalog &catalog, SchemaCatalogEntry &schema, CreateMacroInfo &info);
|
25
|
-
|
26
|
-
public:
|
27
|
-
//! Serialize the meta information of the ScalarMacroCatalogEntry
|
28
|
-
void Serialize(Serializer &serializer) const override;
|
29
|
-
//! Deserializes to a CreateMacroInfo
|
30
|
-
static unique_ptr<CreateMacroInfo> Deserialize(Deserializer &source, ClientContext &context);
|
31
25
|
};
|
32
26
|
|
33
27
|
} // namespace duckdb
|
@@ -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...)) {
|
@@ -263,15 +263,15 @@ public:
|
|
263
263
|
return ReadRequiredGenericList<T, idx_t, IndexReadOperation>();
|
264
264
|
}
|
265
265
|
|
266
|
-
template <class T
|
267
|
-
|
266
|
+
template <class T, class CONTAINER_TYPE = set<T>>
|
267
|
+
CONTAINER_TYPE ReadRequiredSet() {
|
268
268
|
if (field_count >= max_field_count) {
|
269
269
|
// field is not there, throw an exception
|
270
270
|
throw SerializationException("Attempting to read a required field, but field is missing");
|
271
271
|
}
|
272
272
|
AddField();
|
273
273
|
auto result_count = source.Read<uint32_t>();
|
274
|
-
|
274
|
+
CONTAINER_TYPE result;
|
275
275
|
for (idx_t i = 0; i < result_count; i++) {
|
276
276
|
result.insert(source.Read<T>());
|
277
277
|
}
|
@@ -187,6 +187,8 @@ public:
|
|
187
187
|
//! Extract the name of a file (e.g if the input is lib/example.dll the name is 'example.dll')
|
188
188
|
DUCKDB_API static string ExtractName(const string &path);
|
189
189
|
|
190
|
+
//! Whether there is a glob in the string
|
191
|
+
DUCKDB_API static bool HasGlob(const string &str);
|
190
192
|
//! Runs a glob on the file system, returning a list of matching files
|
191
193
|
DUCKDB_API virtual vector<string> Glob(const string &path, FileOpener *opener = nullptr);
|
192
194
|
DUCKDB_API vector<string> GlobFiles(const string &path, ClientContext &context,
|
@@ -224,6 +226,9 @@ public:
|
|
224
226
|
|
225
227
|
//! Return the name of the filesytem. Used for forming diagnosis messages.
|
226
228
|
DUCKDB_API virtual std::string GetName() const = 0;
|
229
|
+
|
230
|
+
//! Whether or not a file is remote or local, based only on file path
|
231
|
+
DUCKDB_API static bool IsRemoteFile(const string &path);
|
227
232
|
};
|
228
233
|
|
229
234
|
} // 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
|
};
|