duckdb 0.8.2-dev1212.0 → 0.8.2-dev1435.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/duckdb/extension/parquet/parquet_extension.cpp +1 -1
- package/src/duckdb/src/common/file_system.cpp +4 -0
- package/src/duckdb/src/common/hive_partitioning.cpp +10 -6
- package/src/duckdb/src/common/multi_file_reader.cpp +3 -2
- package/src/duckdb/src/common/operator/cast_operators.cpp +35 -1
- package/src/duckdb/src/common/types/bit.cpp +51 -0
- package/src/duckdb/src/common/virtual_file_system.cpp +138 -1
- package/src/duckdb/src/core_functions/function_list.cpp +2 -2
- package/src/duckdb/src/core_functions/scalar/date/date_part.cpp +2 -2
- package/src/duckdb/src/core_functions/scalar/date/epoch.cpp +10 -7
- package/src/duckdb/src/execution/operator/scan/physical_table_scan.cpp +7 -2
- package/src/duckdb/src/execution/physical_plan/plan_get.cpp +2 -2
- package/src/duckdb/src/function/cast/bit_cast.cpp +34 -2
- package/src/duckdb/src/function/cast/blob_cast.cpp +3 -0
- package/src/duckdb/src/function/cast/numeric_casts.cpp +2 -0
- package/src/duckdb/src/function/table/version/pragma_version.cpp +2 -2
- package/src/duckdb/src/include/duckdb/common/extra_operator_info.hpp +27 -0
- package/src/duckdb/src/include/duckdb/common/file_system.hpp +2 -0
- package/src/duckdb/src/include/duckdb/common/hive_partitioning.hpp +1 -1
- package/src/duckdb/src/include/duckdb/common/operator/cast_operators.hpp +43 -3
- package/src/duckdb/src/include/duckdb/common/operator/numeric_cast.hpp +10 -0
- package/src/duckdb/src/include/duckdb/common/types/bit.hpp +81 -0
- package/src/duckdb/src/include/duckdb/common/virtual_file_system.hpp +38 -97
- package/src/duckdb/src/include/duckdb/core_functions/scalar/date_functions.hpp +11 -11
- package/src/duckdb/src/include/duckdb/execution/operator/scan/physical_table_scan.hpp +5 -1
- package/src/duckdb/src/include/duckdb/main/relation/cross_product_relation.hpp +4 -1
- package/src/duckdb/src/include/duckdb/main/relation/join_relation.hpp +5 -2
- package/src/duckdb/src/include/duckdb/main/relation.hpp +4 -2
- package/src/duckdb/src/include/duckdb/main/settings.hpp +9 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_get.hpp +4 -0
- package/src/duckdb/src/main/config.cpp +1 -0
- package/src/duckdb/src/main/extension/extension_install.cpp +6 -0
- package/src/duckdb/src/main/extension/extension_load.cpp +10 -1
- package/src/duckdb/src/main/relation/cross_product_relation.cpp +4 -3
- package/src/duckdb/src/main/relation/join_relation.cpp +5 -5
- package/src/duckdb/src/main/relation.cpp +6 -5
- package/src/duckdb/src/main/settings/settings.cpp +24 -0
- package/src/duckdb/src/parser/parser.cpp +8 -2
- package/src/duckdb/src/planner/binder/statement/bind_create_table.cpp +5 -4
- package/src/duckdb/src/planner/operator/logical_get.cpp +9 -4
@@ -8,13 +8,18 @@
|
|
8
8
|
|
9
9
|
#pragma once
|
10
10
|
|
11
|
+
#include "duckdb/common/assert.hpp"
|
11
12
|
#include "duckdb/common/constants.hpp"
|
13
|
+
#include "duckdb/common/hugeint.hpp"
|
12
14
|
#include "duckdb/common/limits.hpp"
|
13
15
|
#include "duckdb/common/exception.hpp"
|
16
|
+
#include "duckdb/common/typedefs.hpp"
|
14
17
|
#include "duckdb/common/types/string_type.hpp"
|
15
18
|
#include "duckdb/common/types.hpp"
|
16
19
|
#include "duckdb/common/operator/convert_to_string.hpp"
|
17
20
|
#include "duckdb/common/types/null_value.hpp"
|
21
|
+
#include "duckdb/common/types/bit.hpp"
|
22
|
+
#include "duckdb/common/types/vector.hpp"
|
18
23
|
|
19
24
|
namespace duckdb {
|
20
25
|
struct ValidityMask;
|
@@ -652,6 +657,15 @@ struct CastFromBlob {
|
|
652
657
|
template <>
|
653
658
|
duckdb::string_t CastFromBlob::Operation(duckdb::string_t input, Vector &vector);
|
654
659
|
|
660
|
+
struct CastFromBlobToBit {
|
661
|
+
template <class SRC>
|
662
|
+
static inline string_t Operation(SRC input, Vector &result) {
|
663
|
+
throw NotImplementedException("Cast from blob could not be performed!");
|
664
|
+
}
|
665
|
+
};
|
666
|
+
template <>
|
667
|
+
string_t CastFromBlobToBit::Operation(string_t input, Vector &result);
|
668
|
+
|
655
669
|
struct TryCastToBlob {
|
656
670
|
template <class SRC, class DST>
|
657
671
|
static inline bool Operation(SRC input, DST &result, Vector &result_vector, string *error_message,
|
@@ -659,7 +673,6 @@ struct TryCastToBlob {
|
|
659
673
|
throw InternalException("Unsupported type for try cast to blob");
|
660
674
|
}
|
661
675
|
};
|
662
|
-
|
663
676
|
template <>
|
664
677
|
bool TryCastToBlob::Operation(string_t input, string_t &result, Vector &result_vector, string *error_message,
|
665
678
|
bool strict);
|
@@ -667,14 +680,41 @@ bool TryCastToBlob::Operation(string_t input, string_t &result, Vector &result_v
|
|
667
680
|
//===--------------------------------------------------------------------===//
|
668
681
|
// Bits
|
669
682
|
//===--------------------------------------------------------------------===//
|
670
|
-
struct
|
683
|
+
struct CastFromBitToString {
|
671
684
|
template <class SRC>
|
672
685
|
static inline string_t Operation(SRC input, Vector &result) {
|
673
686
|
throw duckdb::NotImplementedException("Cast from bit could not be performed!");
|
674
687
|
}
|
675
688
|
};
|
676
689
|
template <>
|
677
|
-
duckdb::string_t
|
690
|
+
duckdb::string_t CastFromBitToString::Operation(duckdb::string_t input, Vector &vector);
|
691
|
+
|
692
|
+
struct CastFromBitToNumeric {
|
693
|
+
template <class SRC = string_t, class DST>
|
694
|
+
static inline bool Operation(SRC input, DST &result, bool strict = false) {
|
695
|
+
D_ASSERT(input.GetSize() > 1);
|
696
|
+
|
697
|
+
// TODO: Allow conversion if the significant bytes of the bitstring can be cast to the target type
|
698
|
+
// Currently only allows bitstring -> numeric if the full bitstring fits inside the numeric type
|
699
|
+
if (input.GetSize() - 1 > sizeof(DST)) {
|
700
|
+
throw ConversionException("Bitstring doesn't fit inside of %s", GetTypeId<DST>());
|
701
|
+
}
|
702
|
+
Bit::BitToNumeric(input, result);
|
703
|
+
return (true);
|
704
|
+
}
|
705
|
+
};
|
706
|
+
template <>
|
707
|
+
bool CastFromBitToNumeric::Operation(string_t input, bool &result, bool strict);
|
708
|
+
template <>
|
709
|
+
bool CastFromBitToNumeric::Operation(string_t input, hugeint_t &result, bool strict);
|
710
|
+
|
711
|
+
struct CastFromBitToBlob {
|
712
|
+
template <class SRC>
|
713
|
+
static inline string_t Operation(SRC input, Vector &result) {
|
714
|
+
D_ASSERT(input.GetSize() > 1);
|
715
|
+
return StringVector::AddStringOrBlob(result, Bit::BitToBlob(input));
|
716
|
+
}
|
717
|
+
};
|
678
718
|
|
679
719
|
struct TryCastToBit {
|
680
720
|
template <class SRC, class DST>
|
@@ -9,8 +9,11 @@
|
|
9
9
|
#pragma once
|
10
10
|
|
11
11
|
#include "duckdb/common/operator/cast_operators.hpp"
|
12
|
+
#include "duckdb/common/types/bit.hpp"
|
12
13
|
#include "duckdb/common/types/hugeint.hpp"
|
14
|
+
#include "duckdb/common/types/string_type.hpp"
|
13
15
|
#include "duckdb/common/types/value.hpp"
|
16
|
+
#include "duckdb/common/types/vector.hpp"
|
14
17
|
#include <cmath>
|
15
18
|
|
16
19
|
namespace duckdb {
|
@@ -442,6 +445,13 @@ bool TryCastWithOverflowCheck(hugeint_t value, double &result) {
|
|
442
445
|
return Hugeint::TryCast(value, result);
|
443
446
|
}
|
444
447
|
|
448
|
+
struct NumericTryCastToBit {
|
449
|
+
template <class SRC>
|
450
|
+
static inline string_t Operation(SRC input, Vector &result) {
|
451
|
+
return StringVector::AddStringOrBlob(result, Bit::NumericToBit(input));
|
452
|
+
}
|
453
|
+
};
|
454
|
+
|
445
455
|
struct NumericTryCast {
|
446
456
|
template <class SRC, class DST>
|
447
457
|
static inline bool Operation(SRC input, DST &result, bool strict = false) {
|
@@ -8,8 +8,12 @@
|
|
8
8
|
|
9
9
|
#pragma once
|
10
10
|
|
11
|
+
#include "duckdb/common/assert.hpp"
|
11
12
|
#include "duckdb/common/common.hpp"
|
13
|
+
#include "duckdb/common/hugeint.hpp"
|
14
|
+
#include "duckdb/common/limits.hpp"
|
12
15
|
#include "duckdb/common/types.hpp"
|
16
|
+
#include "duckdb/common/types/string_type.hpp"
|
13
17
|
|
14
18
|
namespace duckdb {
|
15
19
|
|
@@ -37,7 +41,33 @@ public:
|
|
37
41
|
//! Convert a string to a bit. This function should ONLY be called after calling GetBitSize, since it does NOT
|
38
42
|
//! perform data validation.
|
39
43
|
DUCKDB_API static void ToBit(string_t str, string_t &output);
|
44
|
+
|
40
45
|
DUCKDB_API static string ToBit(string_t str);
|
46
|
+
|
47
|
+
//! output needs to have enough space allocated before calling this function (blob size + 1)
|
48
|
+
DUCKDB_API static void BlobToBit(string_t blob, string_t &output);
|
49
|
+
|
50
|
+
DUCKDB_API static string BlobToBit(string_t blob);
|
51
|
+
|
52
|
+
//! output_str needs to have enough space allocated before calling this function (sizeof(T) + 1)
|
53
|
+
template <class T>
|
54
|
+
static void NumericToBit(T numeric, string_t &output_str);
|
55
|
+
|
56
|
+
template <class T>
|
57
|
+
static string NumericToBit(T numeric);
|
58
|
+
|
59
|
+
//! bit is expected to fit inside of output num (bit size <= sizeof(T) + 1)
|
60
|
+
template <class T>
|
61
|
+
static void BitToNumeric(string_t bit, T &output_num);
|
62
|
+
|
63
|
+
template <class T>
|
64
|
+
static T BitToNumeric(string_t bit);
|
65
|
+
|
66
|
+
//! bit is expected to fit inside of output_blob (bit size = output_blob + 1)
|
67
|
+
static void BitToBlob(string_t bit, string_t &output_blob);
|
68
|
+
|
69
|
+
static string BitToBlob(string_t bit);
|
70
|
+
|
41
71
|
//! Creates a new bitstring of determined length
|
42
72
|
DUCKDB_API static void BitString(const string_t &input, const idx_t &len, string_t &result);
|
43
73
|
DUCKDB_API static void SetEmptyBitString(string_t &target, string_t &input);
|
@@ -58,5 +88,56 @@ private:
|
|
58
88
|
static idx_t GetBitInternal(string_t bit_string, idx_t n);
|
59
89
|
static void SetBitInternal(string_t &bit_string, idx_t n, idx_t new_value);
|
60
90
|
static idx_t GetBitIndex(idx_t n);
|
91
|
+
static uint8_t GetFirstByte(const string_t &str);
|
61
92
|
};
|
93
|
+
|
94
|
+
//===--------------------------------------------------------------------===//
|
95
|
+
// Bit Template definitions
|
96
|
+
//===--------------------------------------------------------------------===//
|
97
|
+
template <class T>
|
98
|
+
void Bit::NumericToBit(T numeric, string_t &output_str) {
|
99
|
+
D_ASSERT(output_str.GetSize() >= sizeof(T) + 1);
|
100
|
+
|
101
|
+
auto output = output_str.GetDataWriteable();
|
102
|
+
auto data = const_data_ptr_cast(&numeric);
|
103
|
+
|
104
|
+
*output = 0; // set padding to 0
|
105
|
+
++output;
|
106
|
+
for (idx_t idx = 0; idx < sizeof(T); ++idx) {
|
107
|
+
output[idx] = data[sizeof(T) - idx - 1];
|
108
|
+
}
|
109
|
+
Bit::Finalize(output_str);
|
110
|
+
}
|
111
|
+
|
112
|
+
template <class T>
|
113
|
+
string Bit::NumericToBit(T numeric) {
|
114
|
+
auto bit_len = sizeof(T) + 1;
|
115
|
+
auto buffer = make_unsafe_uniq_array<char>(bit_len);
|
116
|
+
string_t output_str(buffer.get(), bit_len);
|
117
|
+
Bit::NumericToBit(numeric, output_str);
|
118
|
+
return output_str.GetString();
|
119
|
+
}
|
120
|
+
|
121
|
+
template <class T>
|
122
|
+
T Bit::BitToNumeric(string_t bit) {
|
123
|
+
T output;
|
124
|
+
Bit::BitToNumeric(bit, output);
|
125
|
+
return (output);
|
126
|
+
}
|
127
|
+
|
128
|
+
template <class T>
|
129
|
+
void Bit::BitToNumeric(string_t bit, T &output_num) {
|
130
|
+
D_ASSERT(bit.GetSize() <= sizeof(T) + 1);
|
131
|
+
|
132
|
+
output_num = 0;
|
133
|
+
auto data = const_data_ptr_cast(bit.GetData());
|
134
|
+
auto output = data_ptr_cast(&output_num);
|
135
|
+
|
136
|
+
idx_t padded_byte_idx = sizeof(T) - bit.GetSize() + 1;
|
137
|
+
output[sizeof(T) - 1 - padded_byte_idx] = GetFirstByte(bit);
|
138
|
+
for (idx_t idx = padded_byte_idx + 1; idx < sizeof(T); ++idx) {
|
139
|
+
output[sizeof(T) - 1 - idx] = data[1 + idx - padded_byte_idx];
|
140
|
+
}
|
141
|
+
}
|
142
|
+
|
62
143
|
} // namespace duckdb
|
@@ -10,6 +10,7 @@
|
|
10
10
|
|
11
11
|
#include "duckdb/common/file_system.hpp"
|
12
12
|
#include "duckdb/common/map.hpp"
|
13
|
+
#include "duckdb/common/unordered_set.hpp"
|
13
14
|
|
14
15
|
namespace duckdb {
|
15
16
|
|
@@ -22,120 +23,60 @@ public:
|
|
22
23
|
FileCompressionType compression = FileCompressionType::UNCOMPRESSED,
|
23
24
|
FileOpener *opener = nullptr) override;
|
24
25
|
|
25
|
-
void Read(FileHandle &handle, void *buffer, int64_t nr_bytes, idx_t location) override
|
26
|
-
|
27
|
-
};
|
26
|
+
void Read(FileHandle &handle, void *buffer, int64_t nr_bytes, idx_t location) override;
|
27
|
+
void Write(FileHandle &handle, void *buffer, int64_t nr_bytes, idx_t location) override;
|
28
28
|
|
29
|
-
|
30
|
-
handle.file_system.Write(handle, buffer, nr_bytes, location);
|
31
|
-
}
|
29
|
+
int64_t Read(FileHandle &handle, void *buffer, int64_t nr_bytes) override;
|
32
30
|
|
33
|
-
int64_t
|
34
|
-
return handle.file_system.Read(handle, buffer, nr_bytes);
|
35
|
-
}
|
31
|
+
int64_t Write(FileHandle &handle, void *buffer, int64_t nr_bytes) override;
|
36
32
|
|
37
|
-
int64_t
|
38
|
-
|
39
|
-
|
33
|
+
int64_t GetFileSize(FileHandle &handle) override;
|
34
|
+
time_t GetLastModifiedTime(FileHandle &handle) override;
|
35
|
+
FileType GetFileType(FileHandle &handle) override;
|
40
36
|
|
41
|
-
|
42
|
-
return handle.file_system.GetFileSize(handle);
|
43
|
-
}
|
44
|
-
time_t GetLastModifiedTime(FileHandle &handle) override {
|
45
|
-
return handle.file_system.GetLastModifiedTime(handle);
|
46
|
-
}
|
47
|
-
FileType GetFileType(FileHandle &handle) override {
|
48
|
-
return handle.file_system.GetFileType(handle);
|
49
|
-
}
|
37
|
+
void Truncate(FileHandle &handle, int64_t new_size) override;
|
50
38
|
|
51
|
-
void
|
52
|
-
handle.file_system.Truncate(handle, new_size);
|
53
|
-
}
|
54
|
-
|
55
|
-
void FileSync(FileHandle &handle) override {
|
56
|
-
handle.file_system.FileSync(handle);
|
57
|
-
}
|
39
|
+
void FileSync(FileHandle &handle) override;
|
58
40
|
|
59
41
|
// need to look up correct fs for this
|
60
|
-
bool DirectoryExists(const string &directory) override
|
61
|
-
|
62
|
-
}
|
63
|
-
void CreateDirectory(const string &directory) override {
|
64
|
-
FindFileSystem(directory)->CreateDirectory(directory);
|
65
|
-
}
|
42
|
+
bool DirectoryExists(const string &directory) override;
|
43
|
+
void CreateDirectory(const string &directory) override;
|
66
44
|
|
67
|
-
void RemoveDirectory(const string &directory) override
|
68
|
-
FindFileSystem(directory)->RemoveDirectory(directory);
|
69
|
-
}
|
45
|
+
void RemoveDirectory(const string &directory) override;
|
70
46
|
|
71
47
|
bool ListFiles(const string &directory, const std::function<void(const string &, bool)> &callback,
|
72
|
-
FileOpener *opener = nullptr) override
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
void RegisterSubSystem(unique_ptr<FileSystem> fs) override {
|
96
|
-
sub_systems.push_back(std::move(fs));
|
97
|
-
}
|
98
|
-
|
99
|
-
void UnregisterSubSystem(const string &name) override {
|
100
|
-
for (auto sub_system = sub_systems.begin(); sub_system != sub_systems.end(); sub_system++) {
|
101
|
-
if (sub_system->get()->GetName() == name) {
|
102
|
-
sub_systems.erase(sub_system);
|
103
|
-
return;
|
104
|
-
}
|
105
|
-
}
|
106
|
-
throw InvalidInputException("Could not find filesystem with name %s", name);
|
107
|
-
}
|
108
|
-
|
109
|
-
void RegisterSubSystem(FileCompressionType compression_type, unique_ptr<FileSystem> fs) override {
|
110
|
-
compressed_fs[compression_type] = std::move(fs);
|
111
|
-
}
|
112
|
-
|
113
|
-
vector<string> ListSubSystems() override {
|
114
|
-
vector<string> names(sub_systems.size());
|
115
|
-
for (idx_t i = 0; i < sub_systems.size(); i++) {
|
116
|
-
names[i] = sub_systems[i]->GetName();
|
117
|
-
}
|
118
|
-
return names;
|
119
|
-
}
|
120
|
-
|
121
|
-
std::string GetName() const override {
|
122
|
-
return "VirtualFileSystem";
|
123
|
-
}
|
48
|
+
FileOpener *opener = nullptr) override;
|
49
|
+
|
50
|
+
void MoveFile(const string &source, const string &target) override;
|
51
|
+
|
52
|
+
bool FileExists(const string &filename) override;
|
53
|
+
|
54
|
+
bool IsPipe(const string &filename) override;
|
55
|
+
virtual void RemoveFile(const string &filename) override;
|
56
|
+
|
57
|
+
virtual vector<string> Glob(const string &path, FileOpener *opener = nullptr) override;
|
58
|
+
|
59
|
+
void RegisterSubSystem(unique_ptr<FileSystem> fs) override;
|
60
|
+
|
61
|
+
void UnregisterSubSystem(const string &name) override;
|
62
|
+
|
63
|
+
void RegisterSubSystem(FileCompressionType compression_type, unique_ptr<FileSystem> fs) override;
|
64
|
+
|
65
|
+
vector<string> ListSubSystems() override;
|
66
|
+
|
67
|
+
std::string GetName() const override;
|
68
|
+
|
69
|
+
void SetDisabledFileSystems(const vector<string> &names) override;
|
124
70
|
|
125
71
|
private:
|
126
|
-
FileSystem
|
127
|
-
|
128
|
-
if (sub_system->CanHandleFile(path)) {
|
129
|
-
return sub_system.get();
|
130
|
-
}
|
131
|
-
}
|
132
|
-
return default_fs.get();
|
133
|
-
}
|
72
|
+
FileSystem &FindFileSystem(const string &path);
|
73
|
+
FileSystem &FindFileSystemInternal(const string &path);
|
134
74
|
|
135
75
|
private:
|
136
76
|
vector<unique_ptr<FileSystem>> sub_systems;
|
137
77
|
map<FileCompressionType, unique_ptr<FileSystem>> compressed_fs;
|
138
78
|
const unique_ptr<FileSystem> default_fs;
|
79
|
+
unordered_set<string> disabled_file_systems;
|
139
80
|
};
|
140
81
|
|
141
82
|
} // namespace duckdb
|
@@ -162,8 +162,8 @@ struct DecadeFun {
|
|
162
162
|
|
163
163
|
struct EpochFun {
|
164
164
|
static constexpr const char *Name = "epoch";
|
165
|
-
static constexpr const char *Parameters = "
|
166
|
-
static constexpr const char *Description = "Extract the epoch component from a
|
165
|
+
static constexpr const char *Parameters = "temporal";
|
166
|
+
static constexpr const char *Description = "Extract the epoch component from a temporal type";
|
167
167
|
static constexpr const char *Example = "epoch(timestamp '2021-08-03 11:59:44.123456')";
|
168
168
|
|
169
169
|
static ScalarFunctionSet GetFunctions();
|
@@ -172,25 +172,25 @@ struct EpochFun {
|
|
172
172
|
struct EpochMsFun {
|
173
173
|
static constexpr const char *Name = "epoch_ms";
|
174
174
|
static constexpr const char *Parameters = "temporal";
|
175
|
-
static constexpr const char *Description = "
|
175
|
+
static constexpr const char *Description = "Extract the epoch component in milliseconds from a temporal type";
|
176
176
|
static constexpr const char *Example = "epoch_ms(timestamp '2021-08-03 11:59:44.123456')";
|
177
177
|
|
178
178
|
static ScalarFunctionSet GetFunctions();
|
179
179
|
};
|
180
180
|
|
181
|
-
struct
|
181
|
+
struct EpochUsFun {
|
182
182
|
static constexpr const char *Name = "epoch_us";
|
183
183
|
static constexpr const char *Parameters = "temporal";
|
184
|
-
static constexpr const char *Description = "
|
184
|
+
static constexpr const char *Description = "Extract the epoch component in microseconds from a temporal type";
|
185
185
|
static constexpr const char *Example = "epoch_us(timestamp '2021-08-03 11:59:44.123456')";
|
186
186
|
|
187
187
|
static ScalarFunctionSet GetFunctions();
|
188
188
|
};
|
189
189
|
|
190
|
-
struct
|
190
|
+
struct EpochNsFun {
|
191
191
|
static constexpr const char *Name = "epoch_ns";
|
192
192
|
static constexpr const char *Parameters = "temporal";
|
193
|
-
static constexpr const char *Description = "
|
193
|
+
static constexpr const char *Description = "Extract the epoch component in nanoseconds from a temporal type";
|
194
194
|
static constexpr const char *Example = "epoch_ns(timestamp '2021-08-03 11:59:44.123456')";
|
195
195
|
|
196
196
|
static ScalarFunctionSet GetFunctions();
|
@@ -291,7 +291,7 @@ struct MakeTimeFun {
|
|
291
291
|
|
292
292
|
struct MakeTimestampFun {
|
293
293
|
static constexpr const char *Name = "make_timestamp";
|
294
|
-
static constexpr const char *Parameters = "year,month,day,hour,minute,seconds
|
294
|
+
static constexpr const char *Parameters = "year,month,day,hour,minute,seconds";
|
295
295
|
static constexpr const char *Description = "The timestamp for the given parts";
|
296
296
|
static constexpr const char *Example = "make_timestamp(1992, 9, 20, 13, 34, 27.123456)";
|
297
297
|
|
@@ -490,8 +490,8 @@ struct ToSecondsFun {
|
|
490
490
|
struct ToTimestampFun {
|
491
491
|
static constexpr const char *Name = "to_timestamp";
|
492
492
|
static constexpr const char *Parameters = "sec";
|
493
|
-
static constexpr const char *Description = "Converts
|
494
|
-
static constexpr const char *Example = "to_timestamp(
|
493
|
+
static constexpr const char *Description = "Converts secs since epoch to a timestamp with time zone";
|
494
|
+
static constexpr const char *Example = "to_timestamp(1284352323.5)";
|
495
495
|
|
496
496
|
static ScalarFunction GetFunction();
|
497
497
|
};
|
@@ -508,7 +508,7 @@ struct ToYearsFun {
|
|
508
508
|
struct TryStrpTimeFun {
|
509
509
|
static constexpr const char *Name = "try_strptime";
|
510
510
|
static constexpr const char *Parameters = "text,format";
|
511
|
-
static constexpr const char *Description = "Converts string to timestamp
|
511
|
+
static constexpr const char *Description = "Converts string to timestamp using the format string (timestamp with time zone if %Z is specified). Returns NULL on failure.";
|
512
512
|
static constexpr const char *Example = "try_strptime('Wed, 1 January 1992 - 08:38:40 PM', '%a, %-d %B %Y - %I:%M:%S %p')";
|
513
513
|
|
514
514
|
static ScalarFunctionSet GetFunctions();
|
@@ -12,6 +12,7 @@
|
|
12
12
|
#include "duckdb/function/table_function.hpp"
|
13
13
|
#include "duckdb/planner/table_filter.hpp"
|
14
14
|
#include "duckdb/storage/data_table.hpp"
|
15
|
+
#include "duckdb/common/extra_operator_info.hpp"
|
15
16
|
|
16
17
|
namespace duckdb {
|
17
18
|
|
@@ -28,7 +29,8 @@ public:
|
|
28
29
|
//! Table scan that immediately projects out filter columns that are unused in the remainder of the query plan
|
29
30
|
PhysicalTableScan(vector<LogicalType> types, TableFunction function, unique_ptr<FunctionData> bind_data,
|
30
31
|
vector<LogicalType> returned_types, vector<column_t> column_ids, vector<idx_t> projection_ids,
|
31
|
-
vector<string> names, unique_ptr<TableFilterSet> table_filters, idx_t estimated_cardinality
|
32
|
+
vector<string> names, unique_ptr<TableFilterSet> table_filters, idx_t estimated_cardinality,
|
33
|
+
ExtraOperatorInfo extra_info);
|
32
34
|
|
33
35
|
//! The table function
|
34
36
|
TableFunction function;
|
@@ -44,6 +46,8 @@ public:
|
|
44
46
|
vector<string> names;
|
45
47
|
//! The table filters
|
46
48
|
unique_ptr<TableFilterSet> table_filters;
|
49
|
+
//! Currently stores any filters applied to file names (as strings)
|
50
|
+
ExtraOperatorInfo extra_info;
|
47
51
|
|
48
52
|
public:
|
49
53
|
string GetName() const override;
|
@@ -9,15 +9,18 @@
|
|
9
9
|
#pragma once
|
10
10
|
|
11
11
|
#include "duckdb/main/relation.hpp"
|
12
|
+
#include "duckdb/common/enums/joinref_type.hpp"
|
12
13
|
|
13
14
|
namespace duckdb {
|
14
15
|
|
15
16
|
class CrossProductRelation : public Relation {
|
16
17
|
public:
|
17
|
-
DUCKDB_API CrossProductRelation(shared_ptr<Relation> left, shared_ptr<Relation> right
|
18
|
+
DUCKDB_API CrossProductRelation(shared_ptr<Relation> left, shared_ptr<Relation> right,
|
19
|
+
JoinRefType join_ref_type = JoinRefType::CROSS);
|
18
20
|
|
19
21
|
shared_ptr<Relation> left;
|
20
22
|
shared_ptr<Relation> right;
|
23
|
+
JoinRefType ref_type;
|
21
24
|
vector<ColumnDefinition> columns;
|
22
25
|
|
23
26
|
public:
|
@@ -9,21 +9,24 @@
|
|
9
9
|
#pragma once
|
10
10
|
|
11
11
|
#include "duckdb/main/relation.hpp"
|
12
|
+
#include "duckdb/common/enums/joinref_type.hpp"
|
12
13
|
|
13
14
|
namespace duckdb {
|
14
15
|
|
15
16
|
class JoinRelation : public Relation {
|
16
17
|
public:
|
17
18
|
DUCKDB_API JoinRelation(shared_ptr<Relation> left, shared_ptr<Relation> right,
|
18
|
-
unique_ptr<ParsedExpression> condition, JoinType type
|
19
|
+
unique_ptr<ParsedExpression> condition, JoinType type,
|
20
|
+
JoinRefType join_ref_type = JoinRefType::REGULAR);
|
19
21
|
DUCKDB_API JoinRelation(shared_ptr<Relation> left, shared_ptr<Relation> right, vector<string> using_columns,
|
20
|
-
JoinType type);
|
22
|
+
JoinType type, JoinRefType join_ref_type = JoinRefType::REGULAR);
|
21
23
|
|
22
24
|
shared_ptr<Relation> left;
|
23
25
|
shared_ptr<Relation> right;
|
24
26
|
unique_ptr<ParsedExpression> condition;
|
25
27
|
vector<string> using_columns;
|
26
28
|
JoinType join_type;
|
29
|
+
JoinRefType join_ref_type;
|
27
30
|
vector<ColumnDefinition> columns;
|
28
31
|
|
29
32
|
public:
|
@@ -12,6 +12,7 @@
|
|
12
12
|
#include "duckdb/common/enums/join_type.hpp"
|
13
13
|
#include "duckdb/common/enums/relation_type.hpp"
|
14
14
|
#include "duckdb/common/winapi.hpp"
|
15
|
+
#include "duckdb/common/enums/joinref_type.hpp"
|
15
16
|
#include "duckdb/main/query_result.hpp"
|
16
17
|
#include "duckdb/parser/column_definition.hpp"
|
17
18
|
#include "duckdb/common/named_parameter_map.hpp"
|
@@ -94,10 +95,11 @@ public:
|
|
94
95
|
|
95
96
|
// JOIN operation
|
96
97
|
DUCKDB_API shared_ptr<Relation> Join(const shared_ptr<Relation> &other, const string &condition,
|
97
|
-
JoinType type = JoinType::INNER);
|
98
|
+
JoinType type = JoinType::INNER, JoinRefType ref_type = JoinRefType::REGULAR);
|
98
99
|
|
99
100
|
// CROSS PRODUCT operation
|
100
|
-
DUCKDB_API shared_ptr<Relation> CrossProduct(const shared_ptr<Relation> &other
|
101
|
+
DUCKDB_API shared_ptr<Relation> CrossProduct(const shared_ptr<Relation> &other,
|
102
|
+
JoinRefType join_ref_type = JoinRefType::CROSS);
|
101
103
|
|
102
104
|
// SET operations
|
103
105
|
DUCKDB_API shared_ptr<Relation> Union(const shared_ptr<Relation> &other);
|
@@ -122,6 +122,15 @@ struct DefaultNullOrderSetting {
|
|
122
122
|
static Value GetSetting(ClientContext &context);
|
123
123
|
};
|
124
124
|
|
125
|
+
struct DisabledFileSystemsSetting {
|
126
|
+
static constexpr const char *Name = "disabled_filesystems";
|
127
|
+
static constexpr const char *Description = "Disable specific file systems preventing access (e.g. LocalFileSystem)";
|
128
|
+
static constexpr const LogicalTypeId InputType = LogicalTypeId::VARCHAR;
|
129
|
+
static void SetGlobal(DatabaseInstance *db, DBConfig &config, const Value ¶meter);
|
130
|
+
static void ResetGlobal(DatabaseInstance *db, DBConfig &config);
|
131
|
+
static Value GetSetting(ClientContext &context);
|
132
|
+
};
|
133
|
+
|
125
134
|
struct DisabledOptimizersSetting {
|
126
135
|
static constexpr const char *Name = "disabled_optimizers";
|
127
136
|
static constexpr const char *Description = "DEBUG SETTING: disable a specific set of optimizers (comma separated)";
|
@@ -11,6 +11,7 @@
|
|
11
11
|
#include "duckdb/function/table_function.hpp"
|
12
12
|
#include "duckdb/planner/logical_operator.hpp"
|
13
13
|
#include "duckdb/planner/table_filter.hpp"
|
14
|
+
#include "duckdb/common/extra_operator_info.hpp"
|
14
15
|
|
15
16
|
namespace duckdb {
|
16
17
|
|
@@ -49,6 +50,9 @@ public:
|
|
49
50
|
vector<string> input_table_names;
|
50
51
|
//! For a table-in-out function, the set of projected input columns
|
51
52
|
vector<column_t> projected_input;
|
53
|
+
//! Currently stores File Filters (as strings) applied by hive partitioning/complex filter pushdown
|
54
|
+
//! Stored so the can be included in explain output
|
55
|
+
ExtraOperatorInfo extra_info;
|
52
56
|
|
53
57
|
string GetName() const override;
|
54
58
|
string ParamsToString() const override;
|
@@ -63,6 +63,7 @@ static ConfigurationOption internal_options[] = {DUCKDB_GLOBAL(AccessModeSetting
|
|
63
63
|
DUCKDB_GLOBAL_LOCAL(DefaultCollationSetting),
|
64
64
|
DUCKDB_GLOBAL(DefaultOrderSetting),
|
65
65
|
DUCKDB_GLOBAL(DefaultNullOrderSetting),
|
66
|
+
DUCKDB_GLOBAL(DisabledFileSystemsSetting),
|
66
67
|
DUCKDB_GLOBAL(DisabledOptimizersSetting),
|
67
68
|
DUCKDB_GLOBAL(EnableExternalAccessSetting),
|
68
69
|
DUCKDB_GLOBAL(EnableFSSTVectors),
|
@@ -4,8 +4,10 @@
|
|
4
4
|
#include "duckdb/common/string_util.hpp"
|
5
5
|
|
6
6
|
#ifndef DISABLE_DUCKDB_REMOTE_INSTALL
|
7
|
+
#ifndef DUCKDB_DISABLE_EXTENSION_LOAD
|
7
8
|
#include "httplib.hpp"
|
8
9
|
#endif
|
10
|
+
#endif
|
9
11
|
#include "duckdb/common/windows_undefs.hpp"
|
10
12
|
|
11
13
|
#include <fstream>
|
@@ -152,6 +154,9 @@ void WriteExtensionFileToDisk(FileSystem &fs, const string &path, void *data, id
|
|
152
154
|
|
153
155
|
void ExtensionHelper::InstallExtensionInternal(DBConfig &config, ClientConfig *client_config, FileSystem &fs,
|
154
156
|
const string &local_path, const string &extension, bool force_install) {
|
157
|
+
#ifdef DUCKDB_DISABLE_EXTENSION_LOAD
|
158
|
+
throw PermissionException("Installing external extensions is disabled through a compile time flag");
|
159
|
+
#else
|
155
160
|
if (!config.options.enable_external_access) {
|
156
161
|
throw PermissionException("Installing extensions is disabled through configuration");
|
157
162
|
}
|
@@ -237,6 +242,7 @@ void ExtensionHelper::InstallExtensionInternal(DBConfig &config, ClientConfig *c
|
|
237
242
|
WriteExtensionFileToDisk(fs, temp_path, (void *)decompressed_body.data(), decompressed_body.size());
|
238
243
|
fs.MoveFile(temp_path, local_extension_path);
|
239
244
|
#endif
|
245
|
+
#endif
|
240
246
|
}
|
241
247
|
|
242
248
|
} // namespace duckdb
|