duckdb 0.3.2-dev3.0 → 0.3.2-dev312.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.cpp +36837 -25802
- package/src/duckdb.hpp +711 -641
package/src/duckdb.hpp
CHANGED
|
@@ -10,8 +10,8 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
|
|
10
10
|
|
|
11
11
|
#pragma once
|
|
12
12
|
#define DUCKDB_AMALGAMATION 1
|
|
13
|
-
#define DUCKDB_SOURCE_ID "
|
|
14
|
-
#define DUCKDB_VERSION "0.3.2-
|
|
13
|
+
#define DUCKDB_SOURCE_ID "3dfdc2fd0"
|
|
14
|
+
#define DUCKDB_VERSION "0.3.2-dev312"
|
|
15
15
|
//===----------------------------------------------------------------------===//
|
|
16
16
|
// DuckDB
|
|
17
17
|
//
|
|
@@ -72,6 +72,32 @@ using std::string;
|
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
|
|
75
|
+
|
|
76
|
+
#ifndef DUCKDB_API
|
|
77
|
+
#ifdef _WIN32
|
|
78
|
+
#if defined(DUCKDB_BUILD_LIBRARY) && !defined(DUCKDB_BUILD_LOADABLE_EXTENSION)
|
|
79
|
+
#define DUCKDB_API __declspec(dllexport)
|
|
80
|
+
#else
|
|
81
|
+
#define DUCKDB_API __declspec(dllimport)
|
|
82
|
+
#endif
|
|
83
|
+
#else
|
|
84
|
+
#define DUCKDB_API
|
|
85
|
+
#endif
|
|
86
|
+
#endif
|
|
87
|
+
|
|
88
|
+
#ifndef DUCKDB_EXTENSION_API
|
|
89
|
+
#ifdef _WIN32
|
|
90
|
+
#ifdef DUCKDB_BUILD_LOADABLE_EXTENSION
|
|
91
|
+
#define DUCKDB_EXTENSION_API __declspec(dllexport)
|
|
92
|
+
#else
|
|
93
|
+
#define DUCKDB_EXTENSION_API
|
|
94
|
+
#endif
|
|
95
|
+
#else
|
|
96
|
+
#define DUCKDB_EXTENSION_API
|
|
97
|
+
#endif
|
|
98
|
+
#endif
|
|
99
|
+
|
|
100
|
+
|
|
75
101
|
namespace duckdb {
|
|
76
102
|
|
|
77
103
|
//! inline std directives that we use frequently
|
|
@@ -96,9 +122,6 @@ typedef int64_t row_t;
|
|
|
96
122
|
//! The type used for hashes
|
|
97
123
|
typedef uint64_t hash_t;
|
|
98
124
|
|
|
99
|
-
//! The value used to signify an invalid index entry
|
|
100
|
-
extern const idx_t INVALID_INDEX;
|
|
101
|
-
|
|
102
125
|
//! data pointers
|
|
103
126
|
typedef uint8_t data_t;
|
|
104
127
|
typedef data_t *data_ptr_t;
|
|
@@ -124,6 +147,11 @@ extern const transaction_t NOT_DELETED_ID;
|
|
|
124
147
|
|
|
125
148
|
extern const double PI;
|
|
126
149
|
|
|
150
|
+
struct DConstants {
|
|
151
|
+
//! The value used to signify an invalid index entry
|
|
152
|
+
static constexpr const idx_t INVALID_INDEX = idx_t(-1);
|
|
153
|
+
};
|
|
154
|
+
|
|
127
155
|
struct Storage {
|
|
128
156
|
//! The size of a hard disk sector, only really needed for Direct IO
|
|
129
157
|
constexpr static int SECTOR_SIZE = 4096;
|
|
@@ -198,6 +226,12 @@ enum class ProfilerPrintFormat : uint8_t { NONE, QUERY_TREE, JSON, QUERY_TREE_OP
|
|
|
198
226
|
#define suint64_t int64_t
|
|
199
227
|
#endif
|
|
200
228
|
|
|
229
|
+
#if defined(_WIN32) || defined(_WIN64)
|
|
230
|
+
#define DUCKDB_WINDOWS
|
|
231
|
+
#elif defined(__unix__) || defined(__unix) || (defined(__APPLE__) && defined(__MACH__))
|
|
232
|
+
#define DUCKDB_POSIX
|
|
233
|
+
#endif
|
|
234
|
+
|
|
201
235
|
namespace duckdb {
|
|
202
236
|
#if !defined(_MSC_VER) && (__cplusplus < 201402L)
|
|
203
237
|
template <typename T, typename... Args>
|
|
@@ -546,28 +580,6 @@ using std::vector;
|
|
|
546
580
|
|
|
547
581
|
|
|
548
582
|
|
|
549
|
-
#ifndef DUCKDB_API
|
|
550
|
-
#ifdef _WIN32
|
|
551
|
-
#if defined(DUCKDB_BUILD_LIBRARY) && !defined(DUCKDB_BUILD_LOADABLE_EXTENSION)
|
|
552
|
-
#define DUCKDB_API __declspec(dllexport)
|
|
553
|
-
#else
|
|
554
|
-
#define DUCKDB_API __declspec(dllimport)
|
|
555
|
-
#endif
|
|
556
|
-
#else
|
|
557
|
-
#define DUCKDB_API
|
|
558
|
-
#endif
|
|
559
|
-
#endif
|
|
560
|
-
|
|
561
|
-
#ifdef DUCKDB_BUILD_LOADABLE_EXTENSION
|
|
562
|
-
#ifdef _WIN32
|
|
563
|
-
#define DUCKDB_EXTENSION_API __declspec(dllexport)
|
|
564
|
-
#else
|
|
565
|
-
#define DUCKDB_EXTENSION_API
|
|
566
|
-
#endif
|
|
567
|
-
#endif
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
583
|
namespace duckdb {
|
|
572
584
|
|
|
573
585
|
class Serializer;
|
|
@@ -925,42 +937,38 @@ struct LogicalType {
|
|
|
925
937
|
DUCKDB_API LogicalType();
|
|
926
938
|
DUCKDB_API LogicalType(LogicalTypeId id); // NOLINT: Allow implicit conversion from `LogicalTypeId`
|
|
927
939
|
DUCKDB_API LogicalType(LogicalTypeId id, shared_ptr<ExtraTypeInfo> type_info);
|
|
928
|
-
|
|
929
|
-
DUCKDB_API LogicalType(
|
|
930
|
-
id_(other.id_), physical_type_(other.physical_type_), type_info_(other.type_info_) {}
|
|
931
|
-
|
|
932
|
-
DUCKDB_API LogicalType(LogicalType &&other) :
|
|
933
|
-
id_(other.id_), physical_type_(other.physical_type_), type_info_(move(other.type_info_)) {}
|
|
940
|
+
DUCKDB_API LogicalType(const LogicalType &other);
|
|
941
|
+
DUCKDB_API LogicalType(LogicalType &&other) noexcept;
|
|
934
942
|
|
|
935
943
|
DUCKDB_API ~LogicalType();
|
|
936
944
|
|
|
937
|
-
LogicalTypeId id() const {
|
|
945
|
+
inline LogicalTypeId id() const {
|
|
938
946
|
return id_;
|
|
939
947
|
}
|
|
940
|
-
PhysicalType InternalType() const {
|
|
948
|
+
inline PhysicalType InternalType() const {
|
|
941
949
|
return physical_type_;
|
|
942
950
|
}
|
|
943
|
-
const ExtraTypeInfo *AuxInfo() const {
|
|
951
|
+
inline const ExtraTypeInfo *AuxInfo() const {
|
|
944
952
|
return type_info_.get();
|
|
945
953
|
}
|
|
946
954
|
|
|
947
955
|
// copy assignment
|
|
948
|
-
LogicalType& operator=(const LogicalType &other) {
|
|
956
|
+
inline LogicalType& operator=(const LogicalType &other) {
|
|
949
957
|
id_ = other.id_;
|
|
950
958
|
physical_type_ = other.physical_type_;
|
|
951
959
|
type_info_ = other.type_info_;
|
|
952
960
|
return *this;
|
|
953
961
|
}
|
|
954
962
|
// move assignment
|
|
955
|
-
LogicalType& operator=(LogicalType&& other) {
|
|
963
|
+
inline LogicalType& operator=(LogicalType&& other) {
|
|
956
964
|
id_ = other.id_;
|
|
957
965
|
physical_type_ = other.physical_type_;
|
|
958
966
|
type_info_ = move(other.type_info_);
|
|
959
967
|
return *this;
|
|
960
968
|
}
|
|
961
969
|
|
|
962
|
-
bool operator==(const LogicalType &rhs) const;
|
|
963
|
-
bool operator!=(const LogicalType &rhs) const {
|
|
970
|
+
DUCKDB_API bool operator==(const LogicalType &rhs) const;
|
|
971
|
+
inline bool operator!=(const LogicalType &rhs) const {
|
|
964
972
|
return !(*this == rhs);
|
|
965
973
|
}
|
|
966
974
|
|
|
@@ -990,34 +998,34 @@ private:
|
|
|
990
998
|
PhysicalType GetInternalType();
|
|
991
999
|
|
|
992
1000
|
public:
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1001
|
+
static constexpr const LogicalTypeId SQLNULL = LogicalTypeId::SQLNULL;
|
|
1002
|
+
static constexpr const LogicalTypeId BOOLEAN = LogicalTypeId::BOOLEAN;
|
|
1003
|
+
static constexpr const LogicalTypeId TINYINT = LogicalTypeId::TINYINT;
|
|
1004
|
+
static constexpr const LogicalTypeId UTINYINT = LogicalTypeId::UTINYINT;
|
|
1005
|
+
static constexpr const LogicalTypeId SMALLINT = LogicalTypeId::SMALLINT;
|
|
1006
|
+
static constexpr const LogicalTypeId USMALLINT = LogicalTypeId::USMALLINT;
|
|
1007
|
+
static constexpr const LogicalTypeId INTEGER = LogicalTypeId::INTEGER;
|
|
1008
|
+
static constexpr const LogicalTypeId UINTEGER = LogicalTypeId::UINTEGER;
|
|
1009
|
+
static constexpr const LogicalTypeId BIGINT = LogicalTypeId::BIGINT;
|
|
1010
|
+
static constexpr const LogicalTypeId UBIGINT = LogicalTypeId::UBIGINT;
|
|
1011
|
+
static constexpr const LogicalTypeId FLOAT = LogicalTypeId::FLOAT;
|
|
1012
|
+
static constexpr const LogicalTypeId DOUBLE = LogicalTypeId::DOUBLE;
|
|
1013
|
+
static constexpr const LogicalTypeId DATE = LogicalTypeId::DATE;
|
|
1014
|
+
static constexpr const LogicalTypeId TIMESTAMP = LogicalTypeId::TIMESTAMP;
|
|
1015
|
+
static constexpr const LogicalTypeId TIMESTAMP_S = LogicalTypeId::TIMESTAMP_SEC;
|
|
1016
|
+
static constexpr const LogicalTypeId TIMESTAMP_MS = LogicalTypeId::TIMESTAMP_MS;
|
|
1017
|
+
static constexpr const LogicalTypeId TIMESTAMP_NS = LogicalTypeId::TIMESTAMP_NS;
|
|
1018
|
+
static constexpr const LogicalTypeId TIME = LogicalTypeId::TIME;
|
|
1019
|
+
static constexpr const LogicalTypeId VARCHAR = LogicalTypeId::VARCHAR;
|
|
1020
|
+
static constexpr const LogicalTypeId ANY = LogicalTypeId::ANY;
|
|
1021
|
+
static constexpr const LogicalTypeId BLOB = LogicalTypeId::BLOB;
|
|
1022
|
+
static constexpr const LogicalTypeId INTERVAL = LogicalTypeId::INTERVAL;
|
|
1023
|
+
static constexpr const LogicalTypeId HUGEINT = LogicalTypeId::HUGEINT;
|
|
1024
|
+
static constexpr const LogicalTypeId UUID = LogicalTypeId::UUID;
|
|
1025
|
+
static constexpr const LogicalTypeId HASH = LogicalTypeId::HASH;
|
|
1026
|
+
static constexpr const LogicalTypeId POINTER = LogicalTypeId::POINTER;
|
|
1027
|
+
static constexpr const LogicalTypeId TABLE = LogicalTypeId::TABLE;
|
|
1028
|
+
static constexpr const LogicalTypeId INVALID = LogicalTypeId::INVALID;
|
|
1021
1029
|
|
|
1022
1030
|
// explicitly allowing these functions to be capitalized to be in-line with the remaining functions
|
|
1023
1031
|
DUCKDB_API static LogicalType DECIMAL(int width, int scale); // NOLINT
|
|
@@ -1158,15 +1166,9 @@ enum class ExceptionFormatValueType : uint8_t {
|
|
|
1158
1166
|
};
|
|
1159
1167
|
|
|
1160
1168
|
struct ExceptionFormatValue {
|
|
1161
|
-
ExceptionFormatValue(double dbl_val)
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
ExceptionFormatValue(int64_t int_val) // NOLINT
|
|
1165
|
-
: type(ExceptionFormatValueType::FORMAT_VALUE_TYPE_INTEGER), int_val(int_val) {
|
|
1166
|
-
}
|
|
1167
|
-
ExceptionFormatValue(string str_val) // NOLINT
|
|
1168
|
-
: type(ExceptionFormatValueType::FORMAT_VALUE_TYPE_STRING), str_val(move(str_val)) {
|
|
1169
|
-
}
|
|
1169
|
+
DUCKDB_API ExceptionFormatValue(double dbl_val); // NOLINT
|
|
1170
|
+
DUCKDB_API ExceptionFormatValue(int64_t int_val); // NOLINT
|
|
1171
|
+
DUCKDB_API ExceptionFormatValue(string str_val); // NOLINT
|
|
1170
1172
|
|
|
1171
1173
|
ExceptionFormatValueType type;
|
|
1172
1174
|
|
|
@@ -1183,19 +1185,19 @@ public:
|
|
|
1183
1185
|
};
|
|
1184
1186
|
|
|
1185
1187
|
template <>
|
|
1186
|
-
ExceptionFormatValue ExceptionFormatValue::CreateFormatValue(PhysicalType value);
|
|
1188
|
+
DUCKDB_API ExceptionFormatValue ExceptionFormatValue::CreateFormatValue(PhysicalType value);
|
|
1187
1189
|
template <>
|
|
1188
|
-
ExceptionFormatValue ExceptionFormatValue::CreateFormatValue(LogicalType value);
|
|
1190
|
+
DUCKDB_API ExceptionFormatValue ExceptionFormatValue::CreateFormatValue(LogicalType value);
|
|
1189
1191
|
template <>
|
|
1190
|
-
ExceptionFormatValue ExceptionFormatValue::CreateFormatValue(float value);
|
|
1192
|
+
DUCKDB_API ExceptionFormatValue ExceptionFormatValue::CreateFormatValue(float value);
|
|
1191
1193
|
template <>
|
|
1192
|
-
ExceptionFormatValue ExceptionFormatValue::CreateFormatValue(double value);
|
|
1194
|
+
DUCKDB_API ExceptionFormatValue ExceptionFormatValue::CreateFormatValue(double value);
|
|
1193
1195
|
template <>
|
|
1194
|
-
ExceptionFormatValue ExceptionFormatValue::CreateFormatValue(string value);
|
|
1196
|
+
DUCKDB_API ExceptionFormatValue ExceptionFormatValue::CreateFormatValue(string value);
|
|
1195
1197
|
template <>
|
|
1196
|
-
ExceptionFormatValue ExceptionFormatValue::CreateFormatValue(const char *value);
|
|
1198
|
+
DUCKDB_API ExceptionFormatValue ExceptionFormatValue::CreateFormatValue(const char *value);
|
|
1197
1199
|
template <>
|
|
1198
|
-
ExceptionFormatValue ExceptionFormatValue::CreateFormatValue(char *value);
|
|
1200
|
+
DUCKDB_API ExceptionFormatValue ExceptionFormatValue::CreateFormatValue(char *value);
|
|
1199
1201
|
|
|
1200
1202
|
} // namespace duckdb
|
|
1201
1203
|
|
|
@@ -1266,15 +1268,15 @@ enum class ExceptionType {
|
|
|
1266
1268
|
|
|
1267
1269
|
class Exception : public std::exception {
|
|
1268
1270
|
public:
|
|
1269
|
-
explicit Exception(const string &msg);
|
|
1270
|
-
Exception(ExceptionType exception_type, const string &message);
|
|
1271
|
+
DUCKDB_API explicit Exception(const string &msg);
|
|
1272
|
+
DUCKDB_API Exception(ExceptionType exception_type, const string &message);
|
|
1271
1273
|
|
|
1272
1274
|
ExceptionType type;
|
|
1273
1275
|
|
|
1274
1276
|
public:
|
|
1275
|
-
const char *what() const noexcept override;
|
|
1277
|
+
DUCKDB_API const char *what() const noexcept override;
|
|
1276
1278
|
|
|
1277
|
-
string ExceptionTypeToString(ExceptionType type);
|
|
1279
|
+
DUCKDB_API string ExceptionTypeToString(ExceptionType type);
|
|
1278
1280
|
|
|
1279
1281
|
template <typename... Args>
|
|
1280
1282
|
static string ConstructMessage(const string &msg, Args... params) {
|
|
@@ -1282,7 +1284,7 @@ public:
|
|
|
1282
1284
|
return ConstructMessageRecursive(msg, values, params...);
|
|
1283
1285
|
}
|
|
1284
1286
|
|
|
1285
|
-
static string ConstructMessageRecursive(const string &msg, vector<ExceptionFormatValue> &values);
|
|
1287
|
+
DUCKDB_API static string ConstructMessageRecursive(const string &msg, vector<ExceptionFormatValue> &values);
|
|
1286
1288
|
|
|
1287
1289
|
template <class T, typename... Args>
|
|
1288
1290
|
static string ConstructMessageRecursive(const string &msg, vector<ExceptionFormatValue> &values, T param,
|
|
@@ -1302,13 +1304,12 @@ private:
|
|
|
1302
1304
|
//! Exceptions that are StandardExceptions do NOT invalidate the current transaction when thrown
|
|
1303
1305
|
class StandardException : public Exception {
|
|
1304
1306
|
public:
|
|
1305
|
-
StandardException(ExceptionType exception_type, string message)
|
|
1306
|
-
}
|
|
1307
|
+
DUCKDB_API StandardException(ExceptionType exception_type, const string &message);
|
|
1307
1308
|
};
|
|
1308
1309
|
|
|
1309
1310
|
class CatalogException : public StandardException {
|
|
1310
1311
|
public:
|
|
1311
|
-
explicit CatalogException(const string &msg);
|
|
1312
|
+
DUCKDB_API explicit CatalogException(const string &msg);
|
|
1312
1313
|
|
|
1313
1314
|
template <typename... Args>
|
|
1314
1315
|
explicit CatalogException(const string &msg, Args... params) : CatalogException(ConstructMessage(msg, params...)) {
|
|
@@ -1317,7 +1318,7 @@ public:
|
|
|
1317
1318
|
|
|
1318
1319
|
class ParserException : public StandardException {
|
|
1319
1320
|
public:
|
|
1320
|
-
explicit ParserException(const string &msg);
|
|
1321
|
+
DUCKDB_API explicit ParserException(const string &msg);
|
|
1321
1322
|
|
|
1322
1323
|
template <typename... Args>
|
|
1323
1324
|
explicit ParserException(const string &msg, Args... params) : ParserException(ConstructMessage(msg, params...)) {
|
|
@@ -1326,7 +1327,7 @@ public:
|
|
|
1326
1327
|
|
|
1327
1328
|
class BinderException : public StandardException {
|
|
1328
1329
|
public:
|
|
1329
|
-
explicit BinderException(const string &msg);
|
|
1330
|
+
DUCKDB_API explicit BinderException(const string &msg);
|
|
1330
1331
|
|
|
1331
1332
|
template <typename... Args>
|
|
1332
1333
|
explicit BinderException(const string &msg, Args... params) : BinderException(ConstructMessage(msg, params...)) {
|
|
@@ -1335,7 +1336,7 @@ public:
|
|
|
1335
1336
|
|
|
1336
1337
|
class ConversionException : public Exception {
|
|
1337
1338
|
public:
|
|
1338
|
-
explicit ConversionException(const string &msg);
|
|
1339
|
+
DUCKDB_API explicit ConversionException(const string &msg);
|
|
1339
1340
|
|
|
1340
1341
|
template <typename... Args>
|
|
1341
1342
|
explicit ConversionException(const string &msg, Args... params)
|
|
@@ -1345,7 +1346,7 @@ public:
|
|
|
1345
1346
|
|
|
1346
1347
|
class TransactionException : public Exception {
|
|
1347
1348
|
public:
|
|
1348
|
-
explicit TransactionException(const string &msg);
|
|
1349
|
+
DUCKDB_API explicit TransactionException(const string &msg);
|
|
1349
1350
|
|
|
1350
1351
|
template <typename... Args>
|
|
1351
1352
|
explicit TransactionException(const string &msg, Args... params)
|
|
@@ -1355,7 +1356,7 @@ public:
|
|
|
1355
1356
|
|
|
1356
1357
|
class NotImplementedException : public Exception {
|
|
1357
1358
|
public:
|
|
1358
|
-
explicit NotImplementedException(const string &msg);
|
|
1359
|
+
DUCKDB_API explicit NotImplementedException(const string &msg);
|
|
1359
1360
|
|
|
1360
1361
|
template <typename... Args>
|
|
1361
1362
|
explicit NotImplementedException(const string &msg, Args... params)
|
|
@@ -1365,7 +1366,7 @@ public:
|
|
|
1365
1366
|
|
|
1366
1367
|
class OutOfRangeException : public Exception {
|
|
1367
1368
|
public:
|
|
1368
|
-
explicit OutOfRangeException(const string &msg);
|
|
1369
|
+
DUCKDB_API explicit OutOfRangeException(const string &msg);
|
|
1369
1370
|
|
|
1370
1371
|
template <typename... Args>
|
|
1371
1372
|
explicit OutOfRangeException(const string &msg, Args... params)
|
|
@@ -1375,7 +1376,7 @@ public:
|
|
|
1375
1376
|
|
|
1376
1377
|
class OutOfMemoryException : public Exception {
|
|
1377
1378
|
public:
|
|
1378
|
-
explicit OutOfMemoryException(const string &msg);
|
|
1379
|
+
DUCKDB_API explicit OutOfMemoryException(const string &msg);
|
|
1379
1380
|
|
|
1380
1381
|
template <typename... Args>
|
|
1381
1382
|
explicit OutOfMemoryException(const string &msg, Args... params)
|
|
@@ -1385,7 +1386,7 @@ public:
|
|
|
1385
1386
|
|
|
1386
1387
|
class SyntaxException : public Exception {
|
|
1387
1388
|
public:
|
|
1388
|
-
explicit SyntaxException(const string &msg);
|
|
1389
|
+
DUCKDB_API explicit SyntaxException(const string &msg);
|
|
1389
1390
|
|
|
1390
1391
|
template <typename... Args>
|
|
1391
1392
|
explicit SyntaxException(const string &msg, Args... params) : SyntaxException(ConstructMessage(msg, params...)) {
|
|
@@ -1394,7 +1395,7 @@ public:
|
|
|
1394
1395
|
|
|
1395
1396
|
class ConstraintException : public Exception {
|
|
1396
1397
|
public:
|
|
1397
|
-
explicit ConstraintException(const string &msg);
|
|
1398
|
+
DUCKDB_API explicit ConstraintException(const string &msg);
|
|
1398
1399
|
|
|
1399
1400
|
template <typename... Args>
|
|
1400
1401
|
explicit ConstraintException(const string &msg, Args... params)
|
|
@@ -1404,7 +1405,7 @@ public:
|
|
|
1404
1405
|
|
|
1405
1406
|
class IOException : public Exception {
|
|
1406
1407
|
public:
|
|
1407
|
-
explicit IOException(const string &msg);
|
|
1408
|
+
DUCKDB_API explicit IOException(const string &msg);
|
|
1408
1409
|
|
|
1409
1410
|
template <typename... Args>
|
|
1410
1411
|
explicit IOException(const string &msg, Args... params) : IOException(ConstructMessage(msg, params...)) {
|
|
@@ -1413,7 +1414,7 @@ public:
|
|
|
1413
1414
|
|
|
1414
1415
|
class SerializationException : public Exception {
|
|
1415
1416
|
public:
|
|
1416
|
-
explicit SerializationException(const string &msg);
|
|
1417
|
+
DUCKDB_API explicit SerializationException(const string &msg);
|
|
1417
1418
|
|
|
1418
1419
|
template <typename... Args>
|
|
1419
1420
|
explicit SerializationException(const string &msg, Args... params)
|
|
@@ -1423,7 +1424,7 @@ public:
|
|
|
1423
1424
|
|
|
1424
1425
|
class SequenceException : public Exception {
|
|
1425
1426
|
public:
|
|
1426
|
-
explicit SequenceException(const string &msg);
|
|
1427
|
+
DUCKDB_API explicit SequenceException(const string &msg);
|
|
1427
1428
|
|
|
1428
1429
|
template <typename... Args>
|
|
1429
1430
|
explicit SequenceException(const string &msg, Args... params)
|
|
@@ -1433,12 +1434,12 @@ public:
|
|
|
1433
1434
|
|
|
1434
1435
|
class InterruptException : public Exception {
|
|
1435
1436
|
public:
|
|
1436
|
-
InterruptException();
|
|
1437
|
+
DUCKDB_API InterruptException();
|
|
1437
1438
|
};
|
|
1438
1439
|
|
|
1439
1440
|
class FatalException : public Exception {
|
|
1440
1441
|
public:
|
|
1441
|
-
explicit FatalException(const string &msg);
|
|
1442
|
+
DUCKDB_API explicit FatalException(const string &msg);
|
|
1442
1443
|
|
|
1443
1444
|
template <typename... Args>
|
|
1444
1445
|
explicit FatalException(const string &msg, Args... params) : FatalException(ConstructMessage(msg, params...)) {
|
|
@@ -1447,7 +1448,7 @@ public:
|
|
|
1447
1448
|
|
|
1448
1449
|
class InternalException : public Exception {
|
|
1449
1450
|
public:
|
|
1450
|
-
explicit InternalException(const string &msg);
|
|
1451
|
+
DUCKDB_API explicit InternalException(const string &msg);
|
|
1451
1452
|
|
|
1452
1453
|
template <typename... Args>
|
|
1453
1454
|
explicit InternalException(const string &msg, Args... params)
|
|
@@ -1457,7 +1458,7 @@ public:
|
|
|
1457
1458
|
|
|
1458
1459
|
class InvalidInputException : public Exception {
|
|
1459
1460
|
public:
|
|
1460
|
-
explicit InvalidInputException(const string &msg);
|
|
1461
|
+
DUCKDB_API explicit InvalidInputException(const string &msg);
|
|
1461
1462
|
|
|
1462
1463
|
template <typename... Args>
|
|
1463
1464
|
explicit InvalidInputException(const string &msg, Args... params)
|
|
@@ -1467,28 +1468,28 @@ public:
|
|
|
1467
1468
|
|
|
1468
1469
|
class CastException : public Exception {
|
|
1469
1470
|
public:
|
|
1470
|
-
CastException(const PhysicalType origType, const PhysicalType newType);
|
|
1471
|
-
CastException(const LogicalType &origType, const LogicalType &newType);
|
|
1471
|
+
DUCKDB_API CastException(const PhysicalType origType, const PhysicalType newType);
|
|
1472
|
+
DUCKDB_API CastException(const LogicalType &origType, const LogicalType &newType);
|
|
1472
1473
|
};
|
|
1473
1474
|
|
|
1474
1475
|
class InvalidTypeException : public Exception {
|
|
1475
1476
|
public:
|
|
1476
|
-
InvalidTypeException(PhysicalType type, const string &msg);
|
|
1477
|
-
InvalidTypeException(const LogicalType &type, const string &msg);
|
|
1477
|
+
DUCKDB_API InvalidTypeException(PhysicalType type, const string &msg);
|
|
1478
|
+
DUCKDB_API InvalidTypeException(const LogicalType &type, const string &msg);
|
|
1478
1479
|
};
|
|
1479
1480
|
|
|
1480
1481
|
class TypeMismatchException : public Exception {
|
|
1481
1482
|
public:
|
|
1482
|
-
TypeMismatchException(const PhysicalType type_1, const PhysicalType type_2, const string &msg);
|
|
1483
|
-
TypeMismatchException(const LogicalType &type_1, const LogicalType &type_2, const string &msg);
|
|
1483
|
+
DUCKDB_API TypeMismatchException(const PhysicalType type_1, const PhysicalType type_2, const string &msg);
|
|
1484
|
+
DUCKDB_API TypeMismatchException(const LogicalType &type_1, const LogicalType &type_2, const string &msg);
|
|
1484
1485
|
};
|
|
1485
1486
|
|
|
1486
1487
|
class ValueOutOfRangeException : public Exception {
|
|
1487
1488
|
public:
|
|
1488
|
-
ValueOutOfRangeException(const int64_t value, const PhysicalType origType, const PhysicalType newType);
|
|
1489
|
-
ValueOutOfRangeException(const hugeint_t value, const PhysicalType origType, const PhysicalType newType);
|
|
1490
|
-
ValueOutOfRangeException(const double value, const PhysicalType origType, const PhysicalType newType);
|
|
1491
|
-
ValueOutOfRangeException(const PhysicalType varType, const idx_t length);
|
|
1489
|
+
DUCKDB_API ValueOutOfRangeException(const int64_t value, const PhysicalType origType, const PhysicalType newType);
|
|
1490
|
+
DUCKDB_API ValueOutOfRangeException(const hugeint_t value, const PhysicalType origType, const PhysicalType newType);
|
|
1491
|
+
DUCKDB_API ValueOutOfRangeException(const double value, const PhysicalType origType, const PhysicalType newType);
|
|
1492
|
+
DUCKDB_API ValueOutOfRangeException(const PhysicalType varType, const idx_t length);
|
|
1492
1493
|
};
|
|
1493
1494
|
|
|
1494
1495
|
} // namespace duckdb
|
|
@@ -1718,7 +1719,9 @@ using std::unordered_map;
|
|
|
1718
1719
|
|
|
1719
1720
|
namespace duckdb {
|
|
1720
1721
|
|
|
1721
|
-
enum class FileCompressionType : uint8_t { AUTO_DETECT = 0, UNCOMPRESSED = 1, GZIP = 2 };
|
|
1722
|
+
enum class FileCompressionType : uint8_t { AUTO_DETECT = 0, UNCOMPRESSED = 1, GZIP = 2, ZSTD = 3 };
|
|
1723
|
+
|
|
1724
|
+
FileCompressionType FileCompressionTypeFromString(const string &input);
|
|
1722
1725
|
|
|
1723
1726
|
} // namespace duckdb
|
|
1724
1727
|
|
|
@@ -1778,7 +1781,7 @@ public:
|
|
|
1778
1781
|
idx_t GetFileSize();
|
|
1779
1782
|
FileType GetType();
|
|
1780
1783
|
|
|
1781
|
-
|
|
1784
|
+
//! Closes the file handle.
|
|
1782
1785
|
virtual void Close() = 0;
|
|
1783
1786
|
|
|
1784
1787
|
public:
|
|
@@ -1882,6 +1885,7 @@ public:
|
|
|
1882
1885
|
|
|
1883
1886
|
//! registers a sub-file system to handle certain file name prefixes, e.g. http:// etc.
|
|
1884
1887
|
virtual void RegisterSubSystem(unique_ptr<FileSystem> sub_fs);
|
|
1888
|
+
virtual void RegisterSubSystem(FileCompressionType compression_type, unique_ptr<FileSystem> fs);
|
|
1885
1889
|
|
|
1886
1890
|
//! Whether or not a sub-system can handle a specific file path
|
|
1887
1891
|
virtual bool CanHandleFile(const string &fpath);
|
|
@@ -1898,6 +1902,8 @@ public:
|
|
|
1898
1902
|
//! in a file on-disk are much cheaper than e.g. random reads in a file over the network
|
|
1899
1903
|
virtual bool OnDiskFile(FileHandle &handle);
|
|
1900
1904
|
|
|
1905
|
+
virtual unique_ptr<FileHandle> OpenCompressedFile(unique_ptr<FileHandle> handle, bool write);
|
|
1906
|
+
|
|
1901
1907
|
//! Create a LocalFileSystem.
|
|
1902
1908
|
static unique_ptr<FileSystem> CreateLocal();
|
|
1903
1909
|
|
|
@@ -1923,6 +1929,7 @@ public:
|
|
|
1923
1929
|
FileOpener *opener = nullptr);
|
|
1924
1930
|
|
|
1925
1931
|
FileSystem &fs;
|
|
1932
|
+
string path;
|
|
1926
1933
|
unique_ptr<data_t[]> data;
|
|
1927
1934
|
idx_t offset;
|
|
1928
1935
|
idx_t total_written;
|
|
@@ -2224,14 +2231,14 @@ struct TemplatedValidityData {
|
|
|
2224
2231
|
static constexpr const V MAX_ENTRY = ~V(0);
|
|
2225
2232
|
|
|
2226
2233
|
public:
|
|
2227
|
-
explicit TemplatedValidityData(idx_t count) {
|
|
2234
|
+
DUCKDB_API explicit TemplatedValidityData(idx_t count) {
|
|
2228
2235
|
auto entry_count = EntryCount(count);
|
|
2229
2236
|
owned_data = unique_ptr<V[]>(new V[entry_count]);
|
|
2230
2237
|
for (idx_t entry_idx = 0; entry_idx < entry_count; entry_idx++) {
|
|
2231
2238
|
owned_data[entry_idx] = MAX_ENTRY;
|
|
2232
2239
|
}
|
|
2233
2240
|
}
|
|
2234
|
-
TemplatedValidityData(const V *validity_mask, idx_t count) {
|
|
2241
|
+
DUCKDB_API TemplatedValidityData(const V *validity_mask, idx_t count) {
|
|
2235
2242
|
D_ASSERT(validity_mask);
|
|
2236
2243
|
auto entry_count = EntryCount(count);
|
|
2237
2244
|
owned_data = unique_ptr<V[]>(new V[entry_count]);
|
|
@@ -2243,7 +2250,7 @@ public:
|
|
|
2243
2250
|
unique_ptr<V[]> owned_data;
|
|
2244
2251
|
|
|
2245
2252
|
public:
|
|
2246
|
-
static inline idx_t EntryCount(idx_t count) {
|
|
2253
|
+
DUCKDB_API static inline idx_t EntryCount(idx_t count) {
|
|
2247
2254
|
return (count + (BITS_PER_VALUE - 1)) / BITS_PER_VALUE;
|
|
2248
2255
|
}
|
|
2249
2256
|
};
|
|
@@ -2267,24 +2274,24 @@ public:
|
|
|
2267
2274
|
static constexpr const int STANDARD_MASK_SIZE = STANDARD_ENTRY_COUNT * sizeof(validity_t);
|
|
2268
2275
|
|
|
2269
2276
|
public:
|
|
2270
|
-
TemplatedValidityMask() : validity_mask(nullptr) {
|
|
2277
|
+
DUCKDB_API TemplatedValidityMask() : validity_mask(nullptr) {
|
|
2271
2278
|
}
|
|
2272
|
-
explicit TemplatedValidityMask(idx_t max_count) {
|
|
2279
|
+
DUCKDB_API explicit TemplatedValidityMask(idx_t max_count) {
|
|
2273
2280
|
Initialize(max_count);
|
|
2274
2281
|
}
|
|
2275
|
-
explicit TemplatedValidityMask(V *ptr) : validity_mask(ptr) {
|
|
2282
|
+
DUCKDB_API explicit TemplatedValidityMask(V *ptr) : validity_mask(ptr) {
|
|
2276
2283
|
}
|
|
2277
|
-
TemplatedValidityMask(const TemplatedValidityMask &original, idx_t count) {
|
|
2284
|
+
DUCKDB_API TemplatedValidityMask(const TemplatedValidityMask &original, idx_t count) {
|
|
2278
2285
|
Copy(original, count);
|
|
2279
2286
|
}
|
|
2280
2287
|
|
|
2281
|
-
static inline idx_t ValidityMaskSize(idx_t count = STANDARD_VECTOR_SIZE) {
|
|
2288
|
+
DUCKDB_API static inline idx_t ValidityMaskSize(idx_t count = STANDARD_VECTOR_SIZE) {
|
|
2282
2289
|
return ValidityBuffer::EntryCount(count) * sizeof(V);
|
|
2283
2290
|
}
|
|
2284
|
-
inline bool AllValid() const {
|
|
2291
|
+
DUCKDB_API inline bool AllValid() const {
|
|
2285
2292
|
return !validity_mask;
|
|
2286
2293
|
}
|
|
2287
|
-
bool CheckAllValid(idx_t count) const {
|
|
2294
|
+
DUCKDB_API bool CheckAllValid(idx_t count) const {
|
|
2288
2295
|
if (AllValid()) {
|
|
2289
2296
|
return true;
|
|
2290
2297
|
}
|
|
@@ -2296,7 +2303,7 @@ public:
|
|
|
2296
2303
|
return valid_count == entry_count;
|
|
2297
2304
|
}
|
|
2298
2305
|
|
|
2299
|
-
bool CheckAllValid(idx_t to, idx_t from) const {
|
|
2306
|
+
DUCKDB_API bool CheckAllValid(idx_t to, idx_t from) const {
|
|
2300
2307
|
if (AllValid()) {
|
|
2301
2308
|
return true;
|
|
2302
2309
|
}
|
|
@@ -2308,40 +2315,40 @@ public:
|
|
|
2308
2315
|
return true;
|
|
2309
2316
|
}
|
|
2310
2317
|
|
|
2311
|
-
inline V *GetData() const {
|
|
2318
|
+
DUCKDB_API inline V *GetData() const {
|
|
2312
2319
|
return validity_mask;
|
|
2313
2320
|
}
|
|
2314
|
-
void Reset() {
|
|
2321
|
+
DUCKDB_API void Reset() {
|
|
2315
2322
|
validity_mask = nullptr;
|
|
2316
2323
|
validity_data.reset();
|
|
2317
2324
|
}
|
|
2318
2325
|
|
|
2319
|
-
static inline idx_t EntryCount(idx_t count) {
|
|
2326
|
+
DUCKDB_API static inline idx_t EntryCount(idx_t count) {
|
|
2320
2327
|
return ValidityBuffer::EntryCount(count);
|
|
2321
2328
|
}
|
|
2322
|
-
inline V GetValidityEntry(idx_t entry_idx) const {
|
|
2329
|
+
DUCKDB_API inline V GetValidityEntry(idx_t entry_idx) const {
|
|
2323
2330
|
if (!validity_mask) {
|
|
2324
2331
|
return ValidityBuffer::MAX_ENTRY;
|
|
2325
2332
|
}
|
|
2326
2333
|
return validity_mask[entry_idx];
|
|
2327
2334
|
}
|
|
2328
|
-
static inline bool AllValid(V entry) {
|
|
2335
|
+
DUCKDB_API static inline bool AllValid(V entry) {
|
|
2329
2336
|
return entry == ValidityBuffer::MAX_ENTRY;
|
|
2330
2337
|
}
|
|
2331
|
-
static inline bool NoneValid(V entry) {
|
|
2338
|
+
DUCKDB_API static inline bool NoneValid(V entry) {
|
|
2332
2339
|
return entry == 0;
|
|
2333
2340
|
}
|
|
2334
|
-
static inline bool RowIsValid(V entry, idx_t idx_in_entry) {
|
|
2341
|
+
DUCKDB_API static inline bool RowIsValid(V entry, idx_t idx_in_entry) {
|
|
2335
2342
|
return entry & (V(1) << V(idx_in_entry));
|
|
2336
2343
|
}
|
|
2337
|
-
static inline void GetEntryIndex(idx_t row_idx, idx_t &entry_idx, idx_t &idx_in_entry) {
|
|
2344
|
+
DUCKDB_API static inline void GetEntryIndex(idx_t row_idx, idx_t &entry_idx, idx_t &idx_in_entry) {
|
|
2338
2345
|
entry_idx = row_idx / BITS_PER_VALUE;
|
|
2339
2346
|
idx_in_entry = row_idx % BITS_PER_VALUE;
|
|
2340
2347
|
}
|
|
2341
2348
|
|
|
2342
2349
|
//! RowIsValidUnsafe should only be used if AllValid() is false: it achieves the same as RowIsValid but skips a
|
|
2343
2350
|
//! not-null check
|
|
2344
|
-
inline bool RowIsValidUnsafe(idx_t row_idx) const {
|
|
2351
|
+
DUCKDB_API inline bool RowIsValidUnsafe(idx_t row_idx) const {
|
|
2345
2352
|
D_ASSERT(validity_mask);
|
|
2346
2353
|
idx_t entry_idx, idx_in_entry;
|
|
2347
2354
|
GetEntryIndex(row_idx, entry_idx, idx_in_entry);
|
|
@@ -2350,7 +2357,7 @@ public:
|
|
|
2350
2357
|
}
|
|
2351
2358
|
|
|
2352
2359
|
//! Returns true if a row is valid (i.e. not null), false otherwise
|
|
2353
|
-
inline bool RowIsValid(idx_t row_idx) const {
|
|
2360
|
+
DUCKDB_API inline bool RowIsValid(idx_t row_idx) const {
|
|
2354
2361
|
if (!validity_mask) {
|
|
2355
2362
|
return true;
|
|
2356
2363
|
}
|
|
@@ -2358,7 +2365,7 @@ public:
|
|
|
2358
2365
|
}
|
|
2359
2366
|
|
|
2360
2367
|
//! Same as SetValid, but skips a null check on validity_mask
|
|
2361
|
-
inline void SetValidUnsafe(idx_t row_idx) {
|
|
2368
|
+
DUCKDB_API inline void SetValidUnsafe(idx_t row_idx) {
|
|
2362
2369
|
D_ASSERT(validity_mask);
|
|
2363
2370
|
idx_t entry_idx, idx_in_entry;
|
|
2364
2371
|
GetEntryIndex(row_idx, entry_idx, idx_in_entry);
|
|
@@ -2366,7 +2373,7 @@ public:
|
|
|
2366
2373
|
}
|
|
2367
2374
|
|
|
2368
2375
|
//! Marks the entry at the specified row index as valid (i.e. not-null)
|
|
2369
|
-
inline void SetValid(idx_t row_idx) {
|
|
2376
|
+
DUCKDB_API inline void SetValid(idx_t row_idx) {
|
|
2370
2377
|
if (!validity_mask) {
|
|
2371
2378
|
// if AllValid() we don't need to do anything
|
|
2372
2379
|
// the row is already valid
|
|
@@ -2376,20 +2383,20 @@ public:
|
|
|
2376
2383
|
}
|
|
2377
2384
|
|
|
2378
2385
|
//! Marks the bit at the specified entry as invalid (i.e. null)
|
|
2379
|
-
inline void SetInvalidUnsafe(idx_t entry_idx, idx_t idx_in_entry) {
|
|
2386
|
+
DUCKDB_API inline void SetInvalidUnsafe(idx_t entry_idx, idx_t idx_in_entry) {
|
|
2380
2387
|
D_ASSERT(validity_mask);
|
|
2381
2388
|
validity_mask[entry_idx] &= ~(V(1) << V(idx_in_entry));
|
|
2382
2389
|
}
|
|
2383
2390
|
|
|
2384
2391
|
//! Marks the bit at the specified row index as invalid (i.e. null)
|
|
2385
|
-
inline void SetInvalidUnsafe(idx_t row_idx) {
|
|
2392
|
+
DUCKDB_API inline void SetInvalidUnsafe(idx_t row_idx) {
|
|
2386
2393
|
idx_t entry_idx, idx_in_entry;
|
|
2387
2394
|
GetEntryIndex(row_idx, entry_idx, idx_in_entry);
|
|
2388
2395
|
SetInvalidUnsafe(entry_idx, idx_in_entry);
|
|
2389
2396
|
}
|
|
2390
2397
|
|
|
2391
2398
|
//! Marks the entry at the specified row index as invalid (i.e. null)
|
|
2392
|
-
inline void SetInvalid(idx_t row_idx) {
|
|
2399
|
+
DUCKDB_API inline void SetInvalid(idx_t row_idx) {
|
|
2393
2400
|
if (!validity_mask) {
|
|
2394
2401
|
D_ASSERT(row_idx <= STANDARD_VECTOR_SIZE);
|
|
2395
2402
|
Initialize(STANDARD_VECTOR_SIZE);
|
|
@@ -2398,7 +2405,7 @@ public:
|
|
|
2398
2405
|
}
|
|
2399
2406
|
|
|
2400
2407
|
//! Mark the entry at the specified index as either valid or invalid (non-null or null)
|
|
2401
|
-
inline void Set(idx_t row_idx, bool valid) {
|
|
2408
|
+
DUCKDB_API inline void Set(idx_t row_idx, bool valid) {
|
|
2402
2409
|
if (valid) {
|
|
2403
2410
|
SetValid(row_idx);
|
|
2404
2411
|
} else {
|
|
@@ -2407,14 +2414,14 @@ public:
|
|
|
2407
2414
|
}
|
|
2408
2415
|
|
|
2409
2416
|
//! Ensure the validity mask is writable, allocating space if it is not initialized
|
|
2410
|
-
inline void EnsureWritable() {
|
|
2417
|
+
DUCKDB_API inline void EnsureWritable() {
|
|
2411
2418
|
if (!validity_mask) {
|
|
2412
2419
|
Initialize();
|
|
2413
2420
|
}
|
|
2414
2421
|
}
|
|
2415
2422
|
|
|
2416
2423
|
//! Marks "count" entries in the validity mask as invalid (null)
|
|
2417
|
-
inline void SetAllInvalid(idx_t count) {
|
|
2424
|
+
DUCKDB_API inline void SetAllInvalid(idx_t count) {
|
|
2418
2425
|
EnsureWritable();
|
|
2419
2426
|
for (idx_t i = 0; i < ValidityBuffer::EntryCount(count); i++) {
|
|
2420
2427
|
validity_mask[i] = 0;
|
|
@@ -2422,14 +2429,14 @@ public:
|
|
|
2422
2429
|
}
|
|
2423
2430
|
|
|
2424
2431
|
//! Marks "count" entries in the validity mask as valid (not null)
|
|
2425
|
-
inline void SetAllValid(idx_t count) {
|
|
2432
|
+
DUCKDB_API inline void SetAllValid(idx_t count) {
|
|
2426
2433
|
EnsureWritable();
|
|
2427
2434
|
for (idx_t i = 0; i < ValidityBuffer::EntryCount(count); i++) {
|
|
2428
2435
|
validity_mask[i] = ValidityBuffer::MAX_ENTRY;
|
|
2429
2436
|
}
|
|
2430
2437
|
}
|
|
2431
2438
|
|
|
2432
|
-
inline bool IsMaskSet() const {
|
|
2439
|
+
DUCKDB_API inline bool IsMaskSet() const {
|
|
2433
2440
|
if (validity_mask) {
|
|
2434
2441
|
return true;
|
|
2435
2442
|
}
|
|
@@ -2437,19 +2444,19 @@ public:
|
|
|
2437
2444
|
}
|
|
2438
2445
|
|
|
2439
2446
|
public:
|
|
2440
|
-
void Initialize(validity_t *validity) {
|
|
2447
|
+
DUCKDB_API void Initialize(validity_t *validity) {
|
|
2441
2448
|
validity_data.reset();
|
|
2442
2449
|
validity_mask = validity;
|
|
2443
2450
|
}
|
|
2444
|
-
void Initialize(const TemplatedValidityMask &other) {
|
|
2451
|
+
DUCKDB_API void Initialize(const TemplatedValidityMask &other) {
|
|
2445
2452
|
validity_mask = other.validity_mask;
|
|
2446
2453
|
validity_data = other.validity_data;
|
|
2447
2454
|
}
|
|
2448
|
-
void Initialize(idx_t count = STANDARD_VECTOR_SIZE) {
|
|
2455
|
+
DUCKDB_API void Initialize(idx_t count = STANDARD_VECTOR_SIZE) {
|
|
2449
2456
|
validity_data = make_buffer<ValidityBuffer>(count);
|
|
2450
2457
|
validity_mask = validity_data->owned_data.get();
|
|
2451
2458
|
}
|
|
2452
|
-
void Copy(const TemplatedValidityMask &other, idx_t count) {
|
|
2459
|
+
DUCKDB_API void Copy(const TemplatedValidityMask &other, idx_t count) {
|
|
2453
2460
|
if (other.AllValid()) {
|
|
2454
2461
|
validity_data = nullptr;
|
|
2455
2462
|
validity_mask = nullptr;
|
|
@@ -2466,21 +2473,21 @@ protected:
|
|
|
2466
2473
|
|
|
2467
2474
|
struct ValidityMask : public TemplatedValidityMask<validity_t> {
|
|
2468
2475
|
public:
|
|
2469
|
-
ValidityMask() : TemplatedValidityMask(nullptr) {
|
|
2476
|
+
DUCKDB_API ValidityMask() : TemplatedValidityMask(nullptr) {
|
|
2470
2477
|
}
|
|
2471
|
-
explicit ValidityMask(idx_t max_count) : TemplatedValidityMask(max_count) {
|
|
2478
|
+
DUCKDB_API explicit ValidityMask(idx_t max_count) : TemplatedValidityMask(max_count) {
|
|
2472
2479
|
}
|
|
2473
|
-
explicit ValidityMask(validity_t *ptr) : TemplatedValidityMask(ptr) {
|
|
2480
|
+
DUCKDB_API explicit ValidityMask(validity_t *ptr) : TemplatedValidityMask(ptr) {
|
|
2474
2481
|
}
|
|
2475
|
-
ValidityMask(const ValidityMask &original, idx_t count) : TemplatedValidityMask(original, count) {
|
|
2482
|
+
DUCKDB_API ValidityMask(const ValidityMask &original, idx_t count) : TemplatedValidityMask(original, count) {
|
|
2476
2483
|
}
|
|
2477
2484
|
|
|
2478
2485
|
public:
|
|
2479
|
-
void Resize(idx_t old_size, idx_t new_size);
|
|
2486
|
+
DUCKDB_API void Resize(idx_t old_size, idx_t new_size);
|
|
2480
2487
|
|
|
2481
|
-
void Slice(const ValidityMask &other, idx_t offset);
|
|
2482
|
-
void Combine(const ValidityMask &other, idx_t count);
|
|
2483
|
-
string ToString(idx_t count) const;
|
|
2488
|
+
DUCKDB_API void Slice(const ValidityMask &other, idx_t offset);
|
|
2489
|
+
DUCKDB_API void Combine(const ValidityMask &other, idx_t count);
|
|
2490
|
+
DUCKDB_API string ToString(idx_t count) const;
|
|
2484
2491
|
};
|
|
2485
2492
|
|
|
2486
2493
|
} // namespace duckdb
|
|
@@ -2512,25 +2519,25 @@ class Value {
|
|
|
2512
2519
|
|
|
2513
2520
|
public:
|
|
2514
2521
|
//! Create an empty NULL value of the specified type
|
|
2515
|
-
explicit Value(LogicalType type = LogicalType::SQLNULL);
|
|
2522
|
+
DUCKDB_API explicit Value(LogicalType type = LogicalType::SQLNULL);
|
|
2516
2523
|
//! Create an INTEGER value
|
|
2517
|
-
Value(int32_t val); // NOLINT: Allow implicit conversion from `int32_t`
|
|
2524
|
+
DUCKDB_API Value(int32_t val); // NOLINT: Allow implicit conversion from `int32_t`
|
|
2518
2525
|
//! Create a BIGINT value
|
|
2519
|
-
Value(int64_t val); // NOLINT: Allow implicit conversion from `int64_t`
|
|
2526
|
+
DUCKDB_API Value(int64_t val); // NOLINT: Allow implicit conversion from `int64_t`
|
|
2520
2527
|
//! Create a FLOAT value
|
|
2521
|
-
Value(float val); // NOLINT: Allow implicit conversion from `float`
|
|
2528
|
+
DUCKDB_API Value(float val); // NOLINT: Allow implicit conversion from `float`
|
|
2522
2529
|
//! Create a DOUBLE value
|
|
2523
|
-
Value(double val); // NOLINT: Allow implicit conversion from `double`
|
|
2530
|
+
DUCKDB_API Value(double val); // NOLINT: Allow implicit conversion from `double`
|
|
2524
2531
|
//! Create a VARCHAR value
|
|
2525
|
-
Value(const char *val); // NOLINT: Allow implicit conversion from `const char *`
|
|
2532
|
+
DUCKDB_API Value(const char *val); // NOLINT: Allow implicit conversion from `const char *`
|
|
2526
2533
|
//! Create a NULL value
|
|
2527
|
-
Value(std::nullptr_t val); // NOLINT: Allow implicit conversion from `nullptr_t`
|
|
2534
|
+
DUCKDB_API Value(std::nullptr_t val); // NOLINT: Allow implicit conversion from `nullptr_t`
|
|
2528
2535
|
//! Create a VARCHAR value
|
|
2529
|
-
Value(string_t val); // NOLINT: Allow implicit conversion from `string_t`
|
|
2536
|
+
DUCKDB_API Value(string_t val); // NOLINT: Allow implicit conversion from `string_t`
|
|
2530
2537
|
//! Create a VARCHAR value
|
|
2531
|
-
Value(string val); // NOLINT: Allow implicit conversion from `string`
|
|
2538
|
+
DUCKDB_API Value(string val); // NOLINT: Allow implicit conversion from `string`
|
|
2532
2539
|
|
|
2533
|
-
const LogicalType &type() const {
|
|
2540
|
+
inline const LogicalType &type() const {
|
|
2534
2541
|
return type_;
|
|
2535
2542
|
}
|
|
2536
2543
|
|
|
@@ -2661,32 +2668,32 @@ public:
|
|
|
2661
2668
|
//===--------------------------------------------------------------------===//
|
|
2662
2669
|
// Numeric Operators
|
|
2663
2670
|
//===--------------------------------------------------------------------===//
|
|
2664
|
-
Value operator+(const Value &rhs) const;
|
|
2665
|
-
Value operator-(const Value &rhs) const;
|
|
2666
|
-
Value operator*(const Value &rhs) const;
|
|
2667
|
-
Value operator/(const Value &rhs) const;
|
|
2668
|
-
Value operator%(const Value &rhs) const;
|
|
2671
|
+
DUCKDB_API Value operator+(const Value &rhs) const;
|
|
2672
|
+
DUCKDB_API Value operator-(const Value &rhs) const;
|
|
2673
|
+
DUCKDB_API Value operator*(const Value &rhs) const;
|
|
2674
|
+
DUCKDB_API Value operator/(const Value &rhs) const;
|
|
2675
|
+
DUCKDB_API Value operator%(const Value &rhs) const;
|
|
2669
2676
|
|
|
2670
2677
|
//===--------------------------------------------------------------------===//
|
|
2671
2678
|
// Comparison Operators
|
|
2672
2679
|
//===--------------------------------------------------------------------===//
|
|
2673
|
-
bool operator==(const Value &rhs) const;
|
|
2674
|
-
bool operator!=(const Value &rhs) const;
|
|
2675
|
-
bool operator<(const Value &rhs) const;
|
|
2676
|
-
bool operator>(const Value &rhs) const;
|
|
2677
|
-
bool operator<=(const Value &rhs) const;
|
|
2678
|
-
bool operator>=(const Value &rhs) const;
|
|
2679
|
-
|
|
2680
|
-
bool operator==(const int64_t &rhs) const;
|
|
2681
|
-
bool operator!=(const int64_t &rhs) const;
|
|
2682
|
-
bool operator<(const int64_t &rhs) const;
|
|
2683
|
-
bool operator>(const int64_t &rhs) const;
|
|
2684
|
-
bool operator<=(const int64_t &rhs) const;
|
|
2685
|
-
bool operator>=(const int64_t &rhs) const;
|
|
2686
|
-
|
|
2687
|
-
static bool FloatIsValid(float value);
|
|
2688
|
-
static bool DoubleIsValid(double value);
|
|
2689
|
-
static bool StringIsValid(const char *str, idx_t length);
|
|
2680
|
+
DUCKDB_API bool operator==(const Value &rhs) const;
|
|
2681
|
+
DUCKDB_API bool operator!=(const Value &rhs) const;
|
|
2682
|
+
DUCKDB_API bool operator<(const Value &rhs) const;
|
|
2683
|
+
DUCKDB_API bool operator>(const Value &rhs) const;
|
|
2684
|
+
DUCKDB_API bool operator<=(const Value &rhs) const;
|
|
2685
|
+
DUCKDB_API bool operator>=(const Value &rhs) const;
|
|
2686
|
+
|
|
2687
|
+
DUCKDB_API bool operator==(const int64_t &rhs) const;
|
|
2688
|
+
DUCKDB_API bool operator!=(const int64_t &rhs) const;
|
|
2689
|
+
DUCKDB_API bool operator<(const int64_t &rhs) const;
|
|
2690
|
+
DUCKDB_API bool operator>(const int64_t &rhs) const;
|
|
2691
|
+
DUCKDB_API bool operator<=(const int64_t &rhs) const;
|
|
2692
|
+
DUCKDB_API bool operator>=(const int64_t &rhs) const;
|
|
2693
|
+
|
|
2694
|
+
DUCKDB_API static bool FloatIsValid(float value);
|
|
2695
|
+
DUCKDB_API static bool DoubleIsValid(double value);
|
|
2696
|
+
DUCKDB_API static bool StringIsValid(const char *str, idx_t length);
|
|
2690
2697
|
static bool StringIsValid(const string &str) {
|
|
2691
2698
|
return StringIsValid(str.c_str(), str.size());
|
|
2692
2699
|
}
|
|
@@ -2698,13 +2705,13 @@ public:
|
|
|
2698
2705
|
|
|
2699
2706
|
//! Returns true if the values are (approximately) equivalent. Note this is NOT the SQL equivalence. For this
|
|
2700
2707
|
//! function, NULL values are equivalent and floating point values that are close are equivalent.
|
|
2701
|
-
static bool ValuesAreEqual(const Value &result_value, const Value &value);
|
|
2708
|
+
DUCKDB_API static bool ValuesAreEqual(const Value &result_value, const Value &value);
|
|
2702
2709
|
|
|
2703
2710
|
friend std::ostream &operator<<(std::ostream &out, const Value &val) {
|
|
2704
2711
|
out << val.ToString();
|
|
2705
2712
|
return out;
|
|
2706
2713
|
}
|
|
2707
|
-
void Print() const;
|
|
2714
|
+
DUCKDB_API void Print() const;
|
|
2708
2715
|
|
|
2709
2716
|
private:
|
|
2710
2717
|
//! The logical of the value
|
|
@@ -3283,69 +3290,69 @@ class Vector {
|
|
|
3283
3290
|
|
|
3284
3291
|
public:
|
|
3285
3292
|
//! Create a vector that references the other vector
|
|
3286
|
-
explicit Vector(Vector &other);
|
|
3293
|
+
DUCKDB_API explicit Vector(Vector &other);
|
|
3287
3294
|
//! Create a vector that slices another vector
|
|
3288
|
-
explicit Vector(Vector &other, const SelectionVector &sel, idx_t count);
|
|
3295
|
+
DUCKDB_API explicit Vector(Vector &other, const SelectionVector &sel, idx_t count);
|
|
3289
3296
|
//! Create a vector that slices another vector starting from a specific offset
|
|
3290
|
-
explicit Vector(Vector &other, idx_t offset);
|
|
3297
|
+
DUCKDB_API explicit Vector(Vector &other, idx_t offset);
|
|
3291
3298
|
//! Create a vector of size one holding the passed on value
|
|
3292
|
-
explicit Vector(const Value &value);
|
|
3299
|
+
DUCKDB_API explicit Vector(const Value &value);
|
|
3293
3300
|
//! Create a vector of size tuple_count (non-standard)
|
|
3294
|
-
explicit Vector(LogicalType type, idx_t capacity = STANDARD_VECTOR_SIZE);
|
|
3301
|
+
DUCKDB_API explicit Vector(LogicalType type, idx_t capacity = STANDARD_VECTOR_SIZE);
|
|
3295
3302
|
//! Create an empty standard vector with a type, equivalent to calling Vector(type, true, false)
|
|
3296
|
-
explicit Vector(const VectorCache &cache);
|
|
3303
|
+
DUCKDB_API explicit Vector(const VectorCache &cache);
|
|
3297
3304
|
//! Create a non-owning vector that references the specified data
|
|
3298
|
-
Vector(LogicalType type, data_ptr_t dataptr);
|
|
3305
|
+
DUCKDB_API Vector(LogicalType type, data_ptr_t dataptr);
|
|
3299
3306
|
//! Create an owning vector that holds at most STANDARD_VECTOR_SIZE entries.
|
|
3300
3307
|
/*!
|
|
3301
3308
|
Create a new vector
|
|
3302
3309
|
If create_data is true, the vector will be an owning empty vector.
|
|
3303
3310
|
If zero_data is true, the allocated data will be zero-initialized.
|
|
3304
3311
|
*/
|
|
3305
|
-
Vector(LogicalType type, bool create_data, bool zero_data, idx_t capacity = STANDARD_VECTOR_SIZE);
|
|
3312
|
+
DUCKDB_API Vector(LogicalType type, bool create_data, bool zero_data, idx_t capacity = STANDARD_VECTOR_SIZE);
|
|
3306
3313
|
// implicit copying of Vectors is not allowed
|
|
3307
|
-
Vector(const Vector &) = delete;
|
|
3314
|
+
DUCKDB_API Vector(const Vector &) = delete;
|
|
3308
3315
|
// but moving of vectors is allowed
|
|
3309
|
-
Vector(Vector &&other) noexcept;
|
|
3316
|
+
DUCKDB_API Vector(Vector &&other) noexcept;
|
|
3310
3317
|
|
|
3311
3318
|
public:
|
|
3312
3319
|
//! Create a vector that references the specified value.
|
|
3313
|
-
void Reference(const Value &value);
|
|
3320
|
+
DUCKDB_API void Reference(const Value &value);
|
|
3314
3321
|
//! Causes this vector to reference the data held by the other vector.
|
|
3315
3322
|
//! The type of the "other" vector should match the type of this vector
|
|
3316
|
-
void Reference(Vector &other);
|
|
3323
|
+
DUCKDB_API void Reference(Vector &other);
|
|
3317
3324
|
//! Reinterpret the data of the other vector as the type of this vector
|
|
3318
3325
|
//! Note that this takes the data of the other vector as-is and places it in this vector
|
|
3319
3326
|
//! Without changing the type of this vector
|
|
3320
|
-
void Reinterpret(Vector &other);
|
|
3327
|
+
DUCKDB_API void Reinterpret(Vector &other);
|
|
3321
3328
|
|
|
3322
3329
|
//! Causes this vector to reference the data held by the other vector, changes the type if required.
|
|
3323
|
-
void ReferenceAndSetType(Vector &other);
|
|
3330
|
+
DUCKDB_API void ReferenceAndSetType(Vector &other);
|
|
3324
3331
|
|
|
3325
3332
|
//! Resets a vector from a vector cache.
|
|
3326
3333
|
//! This turns the vector back into an empty FlatVector with STANDARD_VECTOR_SIZE entries.
|
|
3327
3334
|
//! The VectorCache is used so this can be done without requiring any allocations.
|
|
3328
|
-
void ResetFromCache(const VectorCache &cache);
|
|
3335
|
+
DUCKDB_API void ResetFromCache(const VectorCache &cache);
|
|
3329
3336
|
|
|
3330
3337
|
//! Creates a reference to a slice of the other vector
|
|
3331
|
-
void Slice(Vector &other, idx_t offset);
|
|
3338
|
+
DUCKDB_API void Slice(Vector &other, idx_t offset);
|
|
3332
3339
|
//! Creates a reference to a slice of the other vector
|
|
3333
|
-
void Slice(Vector &other, const SelectionVector &sel, idx_t count);
|
|
3340
|
+
DUCKDB_API void Slice(Vector &other, const SelectionVector &sel, idx_t count);
|
|
3334
3341
|
//! Turns the vector into a dictionary vector with the specified dictionary
|
|
3335
|
-
void Slice(const SelectionVector &sel, idx_t count);
|
|
3342
|
+
DUCKDB_API void Slice(const SelectionVector &sel, idx_t count);
|
|
3336
3343
|
//! Slice the vector, keeping the result around in a cache or potentially using the cache instead of slicing
|
|
3337
|
-
void Slice(const SelectionVector &sel, idx_t count, SelCache &cache);
|
|
3344
|
+
DUCKDB_API void Slice(const SelectionVector &sel, idx_t count, SelCache &cache);
|
|
3338
3345
|
|
|
3339
3346
|
//! Creates the data of this vector with the specified type. Any data that
|
|
3340
3347
|
//! is currently in the vector is destroyed.
|
|
3341
|
-
void Initialize(bool zero_data = false, idx_t capacity = STANDARD_VECTOR_SIZE);
|
|
3348
|
+
DUCKDB_API void Initialize(bool zero_data = false, idx_t capacity = STANDARD_VECTOR_SIZE);
|
|
3342
3349
|
|
|
3343
3350
|
//! Converts this Vector to a printable string representation
|
|
3344
|
-
string ToString(idx_t count) const;
|
|
3345
|
-
void Print(idx_t count);
|
|
3351
|
+
DUCKDB_API string ToString(idx_t count) const;
|
|
3352
|
+
DUCKDB_API void Print(idx_t count);
|
|
3346
3353
|
|
|
3347
|
-
string ToString() const;
|
|
3348
|
-
void Print();
|
|
3354
|
+
DUCKDB_API string ToString() const;
|
|
3355
|
+
DUCKDB_API void Print();
|
|
3349
3356
|
|
|
3350
3357
|
//! Flatten the vector, removing any compression and turning it into a FLAT_VECTOR
|
|
3351
3358
|
DUCKDB_API void Normalify(idx_t count);
|
|
@@ -3354,31 +3361,31 @@ public:
|
|
|
3354
3361
|
DUCKDB_API void Orrify(idx_t count, VectorData &data);
|
|
3355
3362
|
|
|
3356
3363
|
//! Turn the vector into a sequence vector
|
|
3357
|
-
void Sequence(int64_t start, int64_t increment);
|
|
3364
|
+
DUCKDB_API void Sequence(int64_t start, int64_t increment);
|
|
3358
3365
|
|
|
3359
3366
|
//! Verify that the Vector is in a consistent, not corrupt state. DEBUG
|
|
3360
3367
|
//! FUNCTION ONLY!
|
|
3361
|
-
void Verify(idx_t count);
|
|
3362
|
-
void Verify(const SelectionVector &sel, idx_t count);
|
|
3363
|
-
void UTFVerify(idx_t count);
|
|
3364
|
-
void UTFVerify(const SelectionVector &sel, idx_t count);
|
|
3368
|
+
DUCKDB_API void Verify(idx_t count);
|
|
3369
|
+
DUCKDB_API void Verify(const SelectionVector &sel, idx_t count);
|
|
3370
|
+
DUCKDB_API void UTFVerify(idx_t count);
|
|
3371
|
+
DUCKDB_API void UTFVerify(const SelectionVector &sel, idx_t count);
|
|
3365
3372
|
|
|
3366
3373
|
//! Returns the [index] element of the Vector as a Value.
|
|
3367
|
-
Value GetValue(idx_t index) const;
|
|
3374
|
+
DUCKDB_API Value GetValue(idx_t index) const;
|
|
3368
3375
|
//! Sets the [index] element of the Vector to the specified Value.
|
|
3369
|
-
void SetValue(idx_t index, const Value &val);
|
|
3376
|
+
DUCKDB_API void SetValue(idx_t index, const Value &val);
|
|
3370
3377
|
|
|
3371
|
-
void SetAuxiliary(buffer_ptr<VectorBuffer> new_buffer) {
|
|
3378
|
+
inline void SetAuxiliary(buffer_ptr<VectorBuffer> new_buffer) {
|
|
3372
3379
|
auxiliary = std::move(new_buffer);
|
|
3373
3380
|
};
|
|
3374
3381
|
|
|
3375
3382
|
//! This functions resizes the vector
|
|
3376
|
-
void Resize(idx_t cur_size, idx_t new_size);
|
|
3383
|
+
DUCKDB_API void Resize(idx_t cur_size, idx_t new_size);
|
|
3377
3384
|
|
|
3378
3385
|
//! Serializes a Vector to a stand-alone binary blob
|
|
3379
|
-
void Serialize(idx_t count, Serializer &serializer);
|
|
3386
|
+
DUCKDB_API void Serialize(idx_t count, Serializer &serializer);
|
|
3380
3387
|
//! Deserializes a blob back into a Vector
|
|
3381
|
-
void Deserialize(idx_t count, Deserializer &source);
|
|
3388
|
+
DUCKDB_API void Deserialize(idx_t count, Deserializer &source);
|
|
3382
3389
|
|
|
3383
3390
|
// Getters
|
|
3384
3391
|
inline VectorType GetVectorType() const {
|
|
@@ -3391,11 +3398,11 @@ public:
|
|
|
3391
3398
|
return data;
|
|
3392
3399
|
}
|
|
3393
3400
|
|
|
3394
|
-
buffer_ptr<VectorBuffer> GetAuxiliary() {
|
|
3401
|
+
inline buffer_ptr<VectorBuffer> GetAuxiliary() {
|
|
3395
3402
|
return auxiliary;
|
|
3396
3403
|
}
|
|
3397
3404
|
|
|
3398
|
-
buffer_ptr<VectorBuffer> GetBuffer() {
|
|
3405
|
+
inline buffer_ptr<VectorBuffer> GetBuffer() {
|
|
3399
3406
|
return buffer;
|
|
3400
3407
|
}
|
|
3401
3408
|
|
|
@@ -3646,8 +3653,8 @@ class VectorCache;
|
|
|
3646
3653
|
class DataChunk {
|
|
3647
3654
|
public:
|
|
3648
3655
|
//! Creates an empty DataChunk
|
|
3649
|
-
DataChunk();
|
|
3650
|
-
~DataChunk();
|
|
3656
|
+
DUCKDB_API DataChunk();
|
|
3657
|
+
DUCKDB_API ~DataChunk();
|
|
3651
3658
|
|
|
3652
3659
|
//! The vectors owned by the DataChunk.
|
|
3653
3660
|
vector<Vector> data;
|
|
@@ -3659,14 +3666,14 @@ public:
|
|
|
3659
3666
|
DUCKDB_API idx_t ColumnCount() const {
|
|
3660
3667
|
return data.size();
|
|
3661
3668
|
}
|
|
3662
|
-
void SetCardinality(idx_t count_p) {
|
|
3669
|
+
inline void SetCardinality(idx_t count_p) {
|
|
3663
3670
|
D_ASSERT(count_p <= capacity);
|
|
3664
3671
|
this->count = count_p;
|
|
3665
3672
|
}
|
|
3666
|
-
void SetCardinality(const DataChunk &other) {
|
|
3673
|
+
inline void SetCardinality(const DataChunk &other) {
|
|
3667
3674
|
this->count = other.size();
|
|
3668
3675
|
}
|
|
3669
|
-
void SetCapacity(const DataChunk &other) {
|
|
3676
|
+
inline void SetCapacity(const DataChunk &other) {
|
|
3670
3677
|
this->capacity = other.capacity;
|
|
3671
3678
|
}
|
|
3672
3679
|
|
|
@@ -3682,9 +3689,9 @@ public:
|
|
|
3682
3689
|
//! This will create one vector of the specified type for each LogicalType in the
|
|
3683
3690
|
//! types list. The vector will be referencing vector to the data owned by
|
|
3684
3691
|
//! the DataChunk.
|
|
3685
|
-
void Initialize(const vector<LogicalType> &types);
|
|
3692
|
+
DUCKDB_API void Initialize(const vector<LogicalType> &types);
|
|
3686
3693
|
//! Initializes an empty DataChunk with the given types. The vectors will *not* have any data allocated for them.
|
|
3687
|
-
void InitializeEmpty(const vector<LogicalType> &types);
|
|
3694
|
+
DUCKDB_API void InitializeEmpty(const vector<LogicalType> &types);
|
|
3688
3695
|
//! Append the other DataChunk to this one. The column count and types of
|
|
3689
3696
|
//! the two DataChunks have to match exactly. Throws an exception if there
|
|
3690
3697
|
//! is not enough space in the chunk and resize is not allowed.
|
|
@@ -5422,7 +5429,7 @@ public:
|
|
|
5422
5429
|
}
|
|
5423
5430
|
|
|
5424
5431
|
//! The location in the query (if any)
|
|
5425
|
-
idx_t query_location = INVALID_INDEX;
|
|
5432
|
+
idx_t query_location = DConstants::INVALID_INDEX;
|
|
5426
5433
|
|
|
5427
5434
|
public:
|
|
5428
5435
|
bool IsAggregate() const override;
|
|
@@ -5491,11 +5498,8 @@ namespace duckdb {
|
|
|
5491
5498
|
//! A column of a table.
|
|
5492
5499
|
class ColumnDefinition {
|
|
5493
5500
|
public:
|
|
5494
|
-
ColumnDefinition(string name, LogicalType type)
|
|
5495
|
-
|
|
5496
|
-
ColumnDefinition(string name, LogicalType type, unique_ptr<ParsedExpression> default_value)
|
|
5497
|
-
: name(name), type(type), default_value(move(default_value)) {
|
|
5498
|
-
}
|
|
5501
|
+
DUCKDB_API ColumnDefinition(string name, LogicalType type);
|
|
5502
|
+
DUCKDB_API ColumnDefinition(string name, LogicalType type, unique_ptr<ParsedExpression> default_value);
|
|
5499
5503
|
|
|
5500
5504
|
//! The name of the entry
|
|
5501
5505
|
string name;
|
|
@@ -5509,10 +5513,10 @@ public:
|
|
|
5509
5513
|
CompressionType compression_type = CompressionType::COMPRESSION_AUTO;
|
|
5510
5514
|
|
|
5511
5515
|
public:
|
|
5512
|
-
ColumnDefinition Copy() const;
|
|
5516
|
+
DUCKDB_API ColumnDefinition Copy() const;
|
|
5513
5517
|
|
|
5514
|
-
void Serialize(Serializer &serializer) const;
|
|
5515
|
-
static ColumnDefinition Deserialize(Deserializer &source);
|
|
5518
|
+
DUCKDB_API void Serialize(Serializer &serializer) const;
|
|
5519
|
+
DUCKDB_API static ColumnDefinition Deserialize(Deserializer &source);
|
|
5516
5520
|
};
|
|
5517
5521
|
|
|
5518
5522
|
} // namespace duckdb
|
|
@@ -5538,24 +5542,11 @@ class TableFunction;
|
|
|
5538
5542
|
struct PragmaInfo;
|
|
5539
5543
|
|
|
5540
5544
|
struct FunctionData {
|
|
5541
|
-
virtual ~FunctionData()
|
|
5542
|
-
}
|
|
5545
|
+
DUCKDB_API virtual ~FunctionData();
|
|
5543
5546
|
|
|
5544
|
-
virtual unique_ptr<FunctionData> Copy()
|
|
5545
|
-
|
|
5546
|
-
|
|
5547
|
-
virtual bool Equals(FunctionData &other) {
|
|
5548
|
-
return true;
|
|
5549
|
-
}
|
|
5550
|
-
static bool Equals(FunctionData *left, FunctionData *right) {
|
|
5551
|
-
if (left == right) {
|
|
5552
|
-
return true;
|
|
5553
|
-
}
|
|
5554
|
-
if (!left || !right) {
|
|
5555
|
-
return false;
|
|
5556
|
-
}
|
|
5557
|
-
return left->Equals(*right);
|
|
5558
|
-
}
|
|
5547
|
+
DUCKDB_API virtual unique_ptr<FunctionData> Copy();
|
|
5548
|
+
DUCKDB_API virtual bool Equals(FunctionData &other);
|
|
5549
|
+
DUCKDB_API static bool Equals(FunctionData *left, FunctionData *right);
|
|
5559
5550
|
};
|
|
5560
5551
|
|
|
5561
5552
|
struct TableFunctionData : public FunctionData {
|
|
@@ -5571,10 +5562,8 @@ struct FunctionParameters {
|
|
|
5571
5562
|
//! Function is the base class used for any type of function (scalar, aggregate or simple function)
|
|
5572
5563
|
class Function {
|
|
5573
5564
|
public:
|
|
5574
|
-
explicit Function(string name)
|
|
5575
|
-
|
|
5576
|
-
virtual ~Function() {
|
|
5577
|
-
}
|
|
5565
|
+
DUCKDB_API explicit Function(string name);
|
|
5566
|
+
DUCKDB_API virtual ~Function();
|
|
5578
5567
|
|
|
5579
5568
|
//! The name of the function
|
|
5580
5569
|
string name;
|
|
@@ -5590,35 +5579,33 @@ public:
|
|
|
5590
5579
|
const unordered_map<string, LogicalType> &named_parameters);
|
|
5591
5580
|
|
|
5592
5581
|
//! Bind a scalar function from the set of functions and input arguments. Returns the index of the chosen function,
|
|
5593
|
-
//! returns INVALID_INDEX and sets error if none could be found
|
|
5594
|
-
static idx_t BindFunction(const string &name, vector<ScalarFunction> &functions,
|
|
5595
|
-
|
|
5596
|
-
static idx_t BindFunction(const string &name, vector<ScalarFunction> &functions,
|
|
5597
|
-
|
|
5582
|
+
//! returns DConstants::INVALID_INDEX and sets error if none could be found
|
|
5583
|
+
DUCKDB_API static idx_t BindFunction(const string &name, vector<ScalarFunction> &functions,
|
|
5584
|
+
vector<LogicalType> &arguments, string &error);
|
|
5585
|
+
DUCKDB_API static idx_t BindFunction(const string &name, vector<ScalarFunction> &functions,
|
|
5586
|
+
vector<unique_ptr<Expression>> &arguments, string &error);
|
|
5598
5587
|
//! Bind an aggregate function from the set of functions and input arguments. Returns the index of the chosen
|
|
5599
|
-
//! function, returns INVALID_INDEX and sets error if none could be found
|
|
5600
|
-
static idx_t BindFunction(const string &name, vector<AggregateFunction> &functions,
|
|
5601
|
-
|
|
5602
|
-
static idx_t BindFunction(const string &name, vector<AggregateFunction> &functions,
|
|
5603
|
-
|
|
5588
|
+
//! function, returns DConstants::INVALID_INDEX and sets error if none could be found
|
|
5589
|
+
DUCKDB_API static idx_t BindFunction(const string &name, vector<AggregateFunction> &functions,
|
|
5590
|
+
vector<LogicalType> &arguments, string &error);
|
|
5591
|
+
DUCKDB_API static idx_t BindFunction(const string &name, vector<AggregateFunction> &functions,
|
|
5592
|
+
vector<unique_ptr<Expression>> &arguments, string &error);
|
|
5604
5593
|
//! Bind a table function from the set of functions and input arguments. Returns the index of the chosen
|
|
5605
|
-
//! function, returns INVALID_INDEX and sets error if none could be found
|
|
5606
|
-
static idx_t BindFunction(const string &name, vector<TableFunction> &functions,
|
|
5607
|
-
|
|
5608
|
-
static idx_t BindFunction(const string &name, vector<TableFunction> &functions,
|
|
5609
|
-
|
|
5594
|
+
//! function, returns DConstants::INVALID_INDEX and sets error if none could be found
|
|
5595
|
+
DUCKDB_API static idx_t BindFunction(const string &name, vector<TableFunction> &functions,
|
|
5596
|
+
vector<LogicalType> &arguments, string &error);
|
|
5597
|
+
DUCKDB_API static idx_t BindFunction(const string &name, vector<TableFunction> &functions,
|
|
5598
|
+
vector<unique_ptr<Expression>> &arguments, string &error);
|
|
5610
5599
|
//! Bind a pragma function from the set of functions and input arguments
|
|
5611
|
-
static idx_t BindFunction(const string &name, vector<PragmaFunction> &functions, PragmaInfo &info,
|
|
5600
|
+
DUCKDB_API static idx_t BindFunction(const string &name, vector<PragmaFunction> &functions, PragmaInfo &info,
|
|
5601
|
+
string &error);
|
|
5612
5602
|
};
|
|
5613
5603
|
|
|
5614
5604
|
class SimpleFunction : public Function {
|
|
5615
5605
|
public:
|
|
5616
|
-
SimpleFunction(string name, vector<LogicalType> arguments,
|
|
5617
|
-
|
|
5618
|
-
|
|
5619
|
-
}
|
|
5620
|
-
~SimpleFunction() override {
|
|
5621
|
-
}
|
|
5606
|
+
DUCKDB_API SimpleFunction(string name, vector<LogicalType> arguments,
|
|
5607
|
+
LogicalType varargs = LogicalType(LogicalTypeId::INVALID));
|
|
5608
|
+
DUCKDB_API ~SimpleFunction() override;
|
|
5622
5609
|
|
|
5623
5610
|
//! The set of arguments of the function
|
|
5624
5611
|
vector<LogicalType> arguments;
|
|
@@ -5627,50 +5614,34 @@ public:
|
|
|
5627
5614
|
LogicalType varargs;
|
|
5628
5615
|
|
|
5629
5616
|
public:
|
|
5630
|
-
virtual string ToString()
|
|
5631
|
-
return Function::CallToString(name, arguments);
|
|
5632
|
-
}
|
|
5617
|
+
DUCKDB_API virtual string ToString();
|
|
5633
5618
|
|
|
5634
|
-
bool HasVarArgs() const
|
|
5635
|
-
return varargs.id() != LogicalTypeId::INVALID;
|
|
5636
|
-
}
|
|
5619
|
+
DUCKDB_API bool HasVarArgs() const;
|
|
5637
5620
|
};
|
|
5638
5621
|
|
|
5639
5622
|
class SimpleNamedParameterFunction : public SimpleFunction {
|
|
5640
5623
|
public:
|
|
5641
|
-
SimpleNamedParameterFunction(string name, vector<LogicalType> arguments,
|
|
5642
|
-
|
|
5643
|
-
|
|
5644
|
-
}
|
|
5645
|
-
~SimpleNamedParameterFunction() override {
|
|
5646
|
-
}
|
|
5624
|
+
DUCKDB_API SimpleNamedParameterFunction(string name, vector<LogicalType> arguments,
|
|
5625
|
+
LogicalType varargs = LogicalType(LogicalTypeId::INVALID));
|
|
5626
|
+
DUCKDB_API ~SimpleNamedParameterFunction() override;
|
|
5647
5627
|
|
|
5648
5628
|
//! The named parameters of the function
|
|
5649
5629
|
unordered_map<string, LogicalType> named_parameters;
|
|
5650
5630
|
|
|
5651
5631
|
public:
|
|
5652
|
-
string ToString() override
|
|
5653
|
-
|
|
5654
|
-
}
|
|
5655
|
-
|
|
5656
|
-
bool HasNamedParameters() {
|
|
5657
|
-
return named_parameters.size() != 0;
|
|
5658
|
-
}
|
|
5632
|
+
DUCKDB_API string ToString() override;
|
|
5633
|
+
DUCKDB_API bool HasNamedParameters();
|
|
5659
5634
|
|
|
5660
|
-
void EvaluateInputParameters(vector<LogicalType> &arguments, vector<Value> ¶meters,
|
|
5661
|
-
|
|
5662
|
-
|
|
5635
|
+
DUCKDB_API void EvaluateInputParameters(vector<LogicalType> &arguments, vector<Value> ¶meters,
|
|
5636
|
+
unordered_map<string, Value> &named_parameters,
|
|
5637
|
+
vector<unique_ptr<ParsedExpression>> &children);
|
|
5663
5638
|
};
|
|
5664
5639
|
|
|
5665
5640
|
class BaseScalarFunction : public SimpleFunction {
|
|
5666
5641
|
public:
|
|
5667
|
-
BaseScalarFunction(string name, vector<LogicalType> arguments, LogicalType return_type,
|
|
5668
|
-
|
|
5669
|
-
|
|
5670
|
-
has_side_effects(has_side_effects) {
|
|
5671
|
-
}
|
|
5672
|
-
~BaseScalarFunction() override {
|
|
5673
|
-
}
|
|
5642
|
+
DUCKDB_API BaseScalarFunction(string name, vector<LogicalType> arguments, LogicalType return_type,
|
|
5643
|
+
bool has_side_effects, LogicalType varargs = LogicalType(LogicalTypeId::INVALID));
|
|
5644
|
+
DUCKDB_API ~BaseScalarFunction() override;
|
|
5674
5645
|
|
|
5675
5646
|
//! Return type of the function
|
|
5676
5647
|
LogicalType return_type;
|
|
@@ -5679,14 +5650,12 @@ public:
|
|
|
5679
5650
|
bool has_side_effects;
|
|
5680
5651
|
|
|
5681
5652
|
public:
|
|
5682
|
-
hash_t Hash() const;
|
|
5653
|
+
DUCKDB_API hash_t Hash() const;
|
|
5683
5654
|
|
|
5684
5655
|
//! Cast a set of expressions to the arguments of this function
|
|
5685
|
-
void CastToFunctionArguments(vector<unique_ptr<Expression>> &children);
|
|
5656
|
+
DUCKDB_API void CastToFunctionArguments(vector<unique_ptr<Expression>> &children);
|
|
5686
5657
|
|
|
5687
|
-
string ToString() override
|
|
5688
|
-
return Function::CallToString(name, arguments, return_type);
|
|
5689
|
-
}
|
|
5658
|
+
DUCKDB_API string ToString() override;
|
|
5690
5659
|
};
|
|
5691
5660
|
|
|
5692
5661
|
class BuiltinFunctions {
|
|
@@ -6014,8 +5983,9 @@ public:
|
|
|
6014
5983
|
static constexpr const int32_t MONTHS_PER_YEAR = 12;
|
|
6015
5984
|
static constexpr const int32_t MONTHS_PER_QUARTER = 3;
|
|
6016
5985
|
static constexpr const int32_t DAYS_PER_WEEK = 7;
|
|
6017
|
-
|
|
6018
|
-
|
|
5986
|
+
//! only used for interval comparison/ordering purposes, in which case a month counts as 30 days
|
|
5987
|
+
static constexpr const int64_t DAYS_PER_MONTH = 30;
|
|
5988
|
+
static constexpr const int64_t DAYS_PER_YEAR = 365;
|
|
6019
5989
|
static constexpr const int64_t MSECS_PER_SEC = 1000;
|
|
6020
5990
|
static constexpr const int32_t SECS_PER_MINUTE = 60;
|
|
6021
5991
|
static constexpr const int32_t MINS_PER_HOUR = 60;
|
|
@@ -6066,6 +6036,12 @@ public:
|
|
|
6066
6036
|
//! Returns the exact difference between two timestamps (days and seconds)
|
|
6067
6037
|
static interval_t GetDifference(timestamp_t timestamp_1, timestamp_t timestamp_2);
|
|
6068
6038
|
|
|
6039
|
+
//! Add an interval to a date
|
|
6040
|
+
static date_t Add(date_t left, interval_t right);
|
|
6041
|
+
//! Add an interval to a time. In case the time overflows or underflows, modify the date by the overflow.
|
|
6042
|
+
//! For example if we go from 23:00 to 02:00, we add a day to the date
|
|
6043
|
+
static dtime_t Add(dtime_t left, interval_t right, date_t &date);
|
|
6044
|
+
|
|
6069
6045
|
//! Comparison operators
|
|
6070
6046
|
static bool Equals(interval_t left, interval_t right);
|
|
6071
6047
|
static bool GreaterThan(interval_t left, interval_t right);
|
|
@@ -6401,23 +6377,17 @@ typedef void (*dependency_function_t)(BoundFunctionExpression &expr, unordered_s
|
|
|
6401
6377
|
|
|
6402
6378
|
class ScalarFunction : public BaseScalarFunction {
|
|
6403
6379
|
public:
|
|
6404
|
-
ScalarFunction(string name, vector<LogicalType> arguments, LogicalType return_type,
|
|
6405
|
-
|
|
6406
|
-
|
|
6407
|
-
|
|
6408
|
-
|
|
6409
|
-
: BaseScalarFunction(name, arguments, return_type, has_side_effects, varargs), function(function), bind(bind),
|
|
6410
|
-
init_local_state(init_local_state), dependency(dependency), statistics(statistics) {
|
|
6411
|
-
}
|
|
6380
|
+
DUCKDB_API ScalarFunction(string name, vector<LogicalType> arguments, LogicalType return_type,
|
|
6381
|
+
scalar_function_t function, bool has_side_effects = false,
|
|
6382
|
+
bind_scalar_function_t bind = nullptr, dependency_function_t dependency = nullptr,
|
|
6383
|
+
function_statistics_t statistics = nullptr, init_local_state_t init_local_state = nullptr,
|
|
6384
|
+
LogicalType varargs = LogicalType(LogicalTypeId::INVALID));
|
|
6412
6385
|
|
|
6413
|
-
ScalarFunction(vector<LogicalType> arguments, LogicalType return_type, scalar_function_t function,
|
|
6414
|
-
|
|
6415
|
-
|
|
6416
|
-
|
|
6417
|
-
|
|
6418
|
-
: ScalarFunction(string(), arguments, return_type, function, has_side_effects, bind, dependency, statistics,
|
|
6419
|
-
init_local_state, varargs) {
|
|
6420
|
-
}
|
|
6386
|
+
DUCKDB_API ScalarFunction(vector<LogicalType> arguments, LogicalType return_type, scalar_function_t function,
|
|
6387
|
+
bool has_side_effects = false, bind_scalar_function_t bind = nullptr,
|
|
6388
|
+
dependency_function_t dependency = nullptr, function_statistics_t statistics = nullptr,
|
|
6389
|
+
init_local_state_t init_local_state = nullptr,
|
|
6390
|
+
LogicalType varargs = LogicalType(LogicalTypeId::INVALID));
|
|
6421
6391
|
|
|
6422
6392
|
//! The main scalar function to execute
|
|
6423
6393
|
scalar_function_t function;
|
|
@@ -6430,73 +6400,30 @@ public:
|
|
|
6430
6400
|
//! The statistics propagation function (if any)
|
|
6431
6401
|
function_statistics_t statistics;
|
|
6432
6402
|
|
|
6433
|
-
static unique_ptr<BoundFunctionExpression> BindScalarFunction(ClientContext &context,
|
|
6434
|
-
|
|
6435
|
-
|
|
6436
|
-
|
|
6437
|
-
static unique_ptr<BoundFunctionExpression> BindScalarFunction(ClientContext &context,
|
|
6438
|
-
|
|
6439
|
-
|
|
6440
|
-
|
|
6441
|
-
|
|
6442
|
-
static unique_ptr<BoundFunctionExpression> BindScalarFunction(ClientContext &context, ScalarFunction bound_function,
|
|
6443
|
-
vector<unique_ptr<Expression>> children,
|
|
6444
|
-
bool is_operator = false);
|
|
6403
|
+
DUCKDB_API static unique_ptr<BoundFunctionExpression> BindScalarFunction(ClientContext &context,
|
|
6404
|
+
const string &schema, const string &name,
|
|
6405
|
+
vector<unique_ptr<Expression>> children,
|
|
6406
|
+
string &error, bool is_operator = false);
|
|
6407
|
+
DUCKDB_API static unique_ptr<BoundFunctionExpression> BindScalarFunction(ClientContext &context,
|
|
6408
|
+
ScalarFunctionCatalogEntry &function,
|
|
6409
|
+
vector<unique_ptr<Expression>> children,
|
|
6410
|
+
string &error, bool is_operator = false);
|
|
6445
6411
|
|
|
6446
|
-
|
|
6447
|
-
|
|
6448
|
-
|
|
6449
|
-
|
|
6450
|
-
bool operator!=(const ScalarFunction &rhs) const {
|
|
6451
|
-
return !(*this == rhs);
|
|
6452
|
-
}
|
|
6412
|
+
DUCKDB_API static unique_ptr<BoundFunctionExpression> BindScalarFunction(ClientContext &context,
|
|
6413
|
+
ScalarFunction bound_function,
|
|
6414
|
+
vector<unique_ptr<Expression>> children,
|
|
6415
|
+
bool is_operator = false);
|
|
6453
6416
|
|
|
6454
|
-
bool
|
|
6455
|
-
|
|
6456
|
-
if (this->arguments.size() != rhs.arguments.size()) {
|
|
6457
|
-
return false;
|
|
6458
|
-
}
|
|
6459
|
-
// argument types
|
|
6460
|
-
for (idx_t i = 0; i < this->arguments.size(); ++i) {
|
|
6461
|
-
if (this->arguments[i] != rhs.arguments[i]) {
|
|
6462
|
-
return false;
|
|
6463
|
-
}
|
|
6464
|
-
}
|
|
6465
|
-
// return type
|
|
6466
|
-
if (this->return_type != rhs.return_type) {
|
|
6467
|
-
return false;
|
|
6468
|
-
}
|
|
6469
|
-
// varargs
|
|
6470
|
-
if (this->varargs != rhs.varargs) {
|
|
6471
|
-
return false;
|
|
6472
|
-
}
|
|
6417
|
+
DUCKDB_API bool operator==(const ScalarFunction &rhs) const;
|
|
6418
|
+
DUCKDB_API bool operator!=(const ScalarFunction &rhs) const;
|
|
6473
6419
|
|
|
6474
|
-
|
|
6475
|
-
}
|
|
6420
|
+
DUCKDB_API bool Equal(const ScalarFunction &rhs) const;
|
|
6476
6421
|
|
|
6477
6422
|
private:
|
|
6478
|
-
bool CompareScalarFunctionT(const scalar_function_t other) const
|
|
6479
|
-
typedef void(scalar_function_ptr_t)(DataChunk &, ExpressionState &, Vector &);
|
|
6480
|
-
|
|
6481
|
-
auto func_ptr = (scalar_function_ptr_t **)function.template target<scalar_function_ptr_t *>();
|
|
6482
|
-
auto other_ptr = (scalar_function_ptr_t **)other.template target<scalar_function_ptr_t *>();
|
|
6483
|
-
|
|
6484
|
-
// Case the functions were created from lambdas the target will return a nullptr
|
|
6485
|
-
if (!func_ptr && !other_ptr) {
|
|
6486
|
-
return true;
|
|
6487
|
-
}
|
|
6488
|
-
if (func_ptr == nullptr || other_ptr == nullptr) {
|
|
6489
|
-
// scalar_function_t (std::functions) from lambdas cannot be compared
|
|
6490
|
-
return false;
|
|
6491
|
-
}
|
|
6492
|
-
return ((size_t)*func_ptr == (size_t)*other_ptr);
|
|
6493
|
-
}
|
|
6423
|
+
bool CompareScalarFunctionT(const scalar_function_t &other) const;
|
|
6494
6424
|
|
|
6495
6425
|
public:
|
|
6496
|
-
static void NopFunction(DataChunk &input, ExpressionState &state, Vector &result)
|
|
6497
|
-
D_ASSERT(input.ColumnCount() >= 1);
|
|
6498
|
-
result.Reference(input.data[0]);
|
|
6499
|
-
}
|
|
6426
|
+
DUCKDB_API static void NopFunction(DataChunk &input, ExpressionState &state, Vector &result);
|
|
6500
6427
|
|
|
6501
6428
|
template <class TA, class TR, class OP>
|
|
6502
6429
|
static void UnaryFunction(DataChunk &input, ExpressionState &state, Vector &result) {
|
|
@@ -6947,12 +6874,12 @@ public:
|
|
|
6947
6874
|
|
|
6948
6875
|
template <class STATE, class INPUT_TYPE, class RESULT_TYPE, class OP>
|
|
6949
6876
|
static void UnaryWindow(Vector &input, FunctionData *bind_data, data_ptr_t state, const FrameBounds &frame,
|
|
6950
|
-
const FrameBounds &prev, Vector &result, idx_t rid) {
|
|
6877
|
+
const FrameBounds &prev, Vector &result, idx_t rid, idx_t bias) {
|
|
6951
6878
|
|
|
6952
|
-
auto idata = FlatVector::GetData<const INPUT_TYPE>(input) -
|
|
6879
|
+
auto idata = FlatVector::GetData<const INPUT_TYPE>(input) - bias;
|
|
6953
6880
|
const auto &ivalid = FlatVector::Validity(input);
|
|
6954
6881
|
OP::template Window<STATE, INPUT_TYPE, RESULT_TYPE>(idata, ivalid, bind_data, (STATE *)state, frame, prev,
|
|
6955
|
-
result, rid);
|
|
6882
|
+
result, rid, bias);
|
|
6956
6883
|
}
|
|
6957
6884
|
|
|
6958
6885
|
template <class STATE_TYPE, class OP>
|
|
@@ -7336,7 +7263,7 @@ class SQLStatement;
|
|
|
7336
7263
|
|
|
7337
7264
|
class QueryErrorContext {
|
|
7338
7265
|
public:
|
|
7339
|
-
explicit QueryErrorContext(SQLStatement *statement_ = nullptr, idx_t query_location_ = INVALID_INDEX)
|
|
7266
|
+
explicit QueryErrorContext(SQLStatement *statement_ = nullptr, idx_t query_location_ = DConstants::INVALID_INDEX)
|
|
7340
7267
|
: statement(statement_), query_location(query_location_) {
|
|
7341
7268
|
}
|
|
7342
7269
|
|
|
@@ -7381,6 +7308,7 @@ struct CreateViewInfo;
|
|
|
7381
7308
|
struct CreateSequenceInfo;
|
|
7382
7309
|
struct CreateCollationInfo;
|
|
7383
7310
|
struct CreateTypeInfo;
|
|
7311
|
+
struct CreateTableInfo;
|
|
7384
7312
|
|
|
7385
7313
|
class ClientContext;
|
|
7386
7314
|
class Transaction;
|
|
@@ -7403,7 +7331,7 @@ struct CatalogEntryLookup {
|
|
|
7403
7331
|
SchemaCatalogEntry *schema;
|
|
7404
7332
|
CatalogEntry *entry;
|
|
7405
7333
|
|
|
7406
|
-
bool Found() const {
|
|
7334
|
+
DUCKDB_API bool Found() const {
|
|
7407
7335
|
return entry;
|
|
7408
7336
|
}
|
|
7409
7337
|
};
|
|
@@ -7417,11 +7345,11 @@ struct SimilarCatalogEntry {
|
|
|
7417
7345
|
//! The schema of the entry.
|
|
7418
7346
|
SchemaCatalogEntry *schema;
|
|
7419
7347
|
|
|
7420
|
-
bool Found() const {
|
|
7348
|
+
DUCKDB_API bool Found() const {
|
|
7421
7349
|
return !name.empty();
|
|
7422
7350
|
}
|
|
7423
7351
|
|
|
7424
|
-
string GetQualifiedName() const;
|
|
7352
|
+
DUCKDB_API string GetQualifiedName() const;
|
|
7425
7353
|
};
|
|
7426
7354
|
|
|
7427
7355
|
//! The Catalog object represents the catalog of the database.
|
|
@@ -7441,79 +7369,88 @@ public:
|
|
|
7441
7369
|
|
|
7442
7370
|
public:
|
|
7443
7371
|
//! Get the ClientContext from the Catalog
|
|
7444
|
-
static Catalog &GetCatalog(ClientContext &context);
|
|
7445
|
-
static Catalog &GetCatalog(DatabaseInstance &db);
|
|
7372
|
+
DUCKDB_API static Catalog &GetCatalog(ClientContext &context);
|
|
7373
|
+
DUCKDB_API static Catalog &GetCatalog(DatabaseInstance &db);
|
|
7446
7374
|
|
|
7447
|
-
DependencyManager &GetDependencyManager() {
|
|
7375
|
+
DUCKDB_API DependencyManager &GetDependencyManager() {
|
|
7448
7376
|
return *dependency_manager;
|
|
7449
7377
|
}
|
|
7450
7378
|
|
|
7451
7379
|
//! Returns the current version of the catalog (incremented whenever anything changes, not stored between restarts)
|
|
7452
|
-
idx_t GetCatalogVersion();
|
|
7380
|
+
DUCKDB_API idx_t GetCatalogVersion();
|
|
7453
7381
|
//! Trigger a modification in the catalog, increasing the catalog version and returning the previous version
|
|
7454
|
-
idx_t ModifyCatalog();
|
|
7382
|
+
DUCKDB_API idx_t ModifyCatalog();
|
|
7455
7383
|
|
|
7456
7384
|
//! Creates a schema in the catalog.
|
|
7457
|
-
CatalogEntry *CreateSchema(ClientContext &context, CreateSchemaInfo *info);
|
|
7385
|
+
DUCKDB_API CatalogEntry *CreateSchema(ClientContext &context, CreateSchemaInfo *info);
|
|
7458
7386
|
//! Creates a table in the catalog.
|
|
7459
|
-
CatalogEntry *CreateTable(ClientContext &context, BoundCreateTableInfo *info);
|
|
7387
|
+
DUCKDB_API CatalogEntry *CreateTable(ClientContext &context, BoundCreateTableInfo *info);
|
|
7388
|
+
//! Creates a table in the catalog.
|
|
7389
|
+
DUCKDB_API CatalogEntry *CreateTable(ClientContext &context, unique_ptr<CreateTableInfo> info);
|
|
7460
7390
|
//! Create a table function in the catalog
|
|
7461
|
-
CatalogEntry *CreateTableFunction(ClientContext &context, CreateTableFunctionInfo *info);
|
|
7391
|
+
DUCKDB_API CatalogEntry *CreateTableFunction(ClientContext &context, CreateTableFunctionInfo *info);
|
|
7462
7392
|
//! Create a copy function in the catalog
|
|
7463
|
-
CatalogEntry *CreateCopyFunction(ClientContext &context, CreateCopyFunctionInfo *info);
|
|
7393
|
+
DUCKDB_API CatalogEntry *CreateCopyFunction(ClientContext &context, CreateCopyFunctionInfo *info);
|
|
7464
7394
|
//! Create a pragma function in the catalog
|
|
7465
|
-
CatalogEntry *CreatePragmaFunction(ClientContext &context, CreatePragmaFunctionInfo *info);
|
|
7395
|
+
DUCKDB_API CatalogEntry *CreatePragmaFunction(ClientContext &context, CreatePragmaFunctionInfo *info);
|
|
7466
7396
|
//! Create a scalar or aggregate function in the catalog
|
|
7467
|
-
CatalogEntry *CreateFunction(ClientContext &context, CreateFunctionInfo *info);
|
|
7397
|
+
DUCKDB_API CatalogEntry *CreateFunction(ClientContext &context, CreateFunctionInfo *info);
|
|
7468
7398
|
//! Creates a table in the catalog.
|
|
7469
|
-
CatalogEntry *CreateView(ClientContext &context, CreateViewInfo *info);
|
|
7399
|
+
DUCKDB_API CatalogEntry *CreateView(ClientContext &context, CreateViewInfo *info);
|
|
7470
7400
|
//! Creates a table in the catalog.
|
|
7471
|
-
CatalogEntry *CreateSequence(ClientContext &context, CreateSequenceInfo *info);
|
|
7401
|
+
DUCKDB_API CatalogEntry *CreateSequence(ClientContext &context, CreateSequenceInfo *info);
|
|
7472
7402
|
//! Creates a Enum in the catalog.
|
|
7473
|
-
CatalogEntry *CreateType(ClientContext &context, CreateTypeInfo *info);
|
|
7403
|
+
DUCKDB_API CatalogEntry *CreateType(ClientContext &context, CreateTypeInfo *info);
|
|
7474
7404
|
//! Creates a collation in the catalog
|
|
7475
|
-
CatalogEntry *CreateCollation(ClientContext &context, CreateCollationInfo *info);
|
|
7405
|
+
DUCKDB_API CatalogEntry *CreateCollation(ClientContext &context, CreateCollationInfo *info);
|
|
7476
7406
|
|
|
7477
7407
|
//! Creates a table in the catalog.
|
|
7478
|
-
CatalogEntry *CreateTable(ClientContext &context, SchemaCatalogEntry *schema,
|
|
7408
|
+
DUCKDB_API CatalogEntry *CreateTable(ClientContext &context, SchemaCatalogEntry *schema,
|
|
7409
|
+
BoundCreateTableInfo *info);
|
|
7479
7410
|
//! Create a table function in the catalog
|
|
7480
|
-
CatalogEntry *CreateTableFunction(ClientContext &context, SchemaCatalogEntry *schema,
|
|
7481
|
-
|
|
7411
|
+
DUCKDB_API CatalogEntry *CreateTableFunction(ClientContext &context, SchemaCatalogEntry *schema,
|
|
7412
|
+
CreateTableFunctionInfo *info);
|
|
7482
7413
|
//! Create a copy function in the catalog
|
|
7483
|
-
CatalogEntry *CreateCopyFunction(ClientContext &context, SchemaCatalogEntry *schema,
|
|
7414
|
+
DUCKDB_API CatalogEntry *CreateCopyFunction(ClientContext &context, SchemaCatalogEntry *schema,
|
|
7415
|
+
CreateCopyFunctionInfo *info);
|
|
7484
7416
|
//! Create a pragma function in the catalog
|
|
7485
|
-
CatalogEntry *CreatePragmaFunction(ClientContext &context, SchemaCatalogEntry *schema,
|
|
7486
|
-
|
|
7417
|
+
DUCKDB_API CatalogEntry *CreatePragmaFunction(ClientContext &context, SchemaCatalogEntry *schema,
|
|
7418
|
+
CreatePragmaFunctionInfo *info);
|
|
7487
7419
|
//! Create a scalar or aggregate function in the catalog
|
|
7488
|
-
CatalogEntry *CreateFunction(ClientContext &context, SchemaCatalogEntry *schema,
|
|
7420
|
+
DUCKDB_API CatalogEntry *CreateFunction(ClientContext &context, SchemaCatalogEntry *schema,
|
|
7421
|
+
CreateFunctionInfo *info);
|
|
7489
7422
|
//! Creates a table in the catalog.
|
|
7490
|
-
CatalogEntry *CreateView(ClientContext &context, SchemaCatalogEntry *schema, CreateViewInfo *info);
|
|
7423
|
+
DUCKDB_API CatalogEntry *CreateView(ClientContext &context, SchemaCatalogEntry *schema, CreateViewInfo *info);
|
|
7491
7424
|
//! Creates a table in the catalog.
|
|
7492
|
-
CatalogEntry *CreateSequence(ClientContext &context, SchemaCatalogEntry *schema,
|
|
7425
|
+
DUCKDB_API CatalogEntry *CreateSequence(ClientContext &context, SchemaCatalogEntry *schema,
|
|
7426
|
+
CreateSequenceInfo *info);
|
|
7493
7427
|
//! Creates a enum in the catalog.
|
|
7494
|
-
CatalogEntry *CreateType(ClientContext &context, SchemaCatalogEntry *schema, CreateTypeInfo *info);
|
|
7428
|
+
DUCKDB_API CatalogEntry *CreateType(ClientContext &context, SchemaCatalogEntry *schema, CreateTypeInfo *info);
|
|
7495
7429
|
//! Creates a collation in the catalog
|
|
7496
|
-
CatalogEntry *CreateCollation(ClientContext &context, SchemaCatalogEntry *schema,
|
|
7430
|
+
DUCKDB_API CatalogEntry *CreateCollation(ClientContext &context, SchemaCatalogEntry *schema,
|
|
7431
|
+
CreateCollationInfo *info);
|
|
7497
7432
|
|
|
7498
7433
|
//! Drops an entry from the catalog
|
|
7499
|
-
void DropEntry(ClientContext &context, DropInfo *info);
|
|
7434
|
+
DUCKDB_API void DropEntry(ClientContext &context, DropInfo *info);
|
|
7500
7435
|
|
|
7501
7436
|
//! Returns the schema object with the specified name, or throws an exception if it does not exist
|
|
7502
|
-
SchemaCatalogEntry *GetSchema(ClientContext &context, const string &name = DEFAULT_SCHEMA,
|
|
7503
|
-
|
|
7437
|
+
DUCKDB_API SchemaCatalogEntry *GetSchema(ClientContext &context, const string &name = DEFAULT_SCHEMA,
|
|
7438
|
+
bool if_exists = false,
|
|
7439
|
+
QueryErrorContext error_context = QueryErrorContext());
|
|
7504
7440
|
//! Scans all the schemas in the system one-by-one, invoking the callback for each entry
|
|
7505
|
-
void ScanSchemas(ClientContext &context, std::function<void(CatalogEntry *)> callback);
|
|
7441
|
+
DUCKDB_API void ScanSchemas(ClientContext &context, std::function<void(CatalogEntry *)> callback);
|
|
7506
7442
|
//! Gets the "schema.name" entry of the specified type, if if_exists=true returns nullptr if entry does not exist,
|
|
7507
7443
|
//! otherwise an exception is thrown
|
|
7508
|
-
CatalogEntry *GetEntry(ClientContext &context, CatalogType type, const string &schema,
|
|
7509
|
-
|
|
7444
|
+
DUCKDB_API CatalogEntry *GetEntry(ClientContext &context, CatalogType type, const string &schema,
|
|
7445
|
+
const string &name, bool if_exists = false,
|
|
7446
|
+
QueryErrorContext error_context = QueryErrorContext());
|
|
7510
7447
|
|
|
7511
7448
|
template <class T>
|
|
7512
7449
|
T *GetEntry(ClientContext &context, const string &schema_name, const string &name, bool if_exists = false,
|
|
7513
7450
|
QueryErrorContext error_context = QueryErrorContext());
|
|
7514
7451
|
|
|
7515
7452
|
//! Alter an existing entry in the catalog.
|
|
7516
|
-
void Alter(ClientContext &context, AlterInfo *info);
|
|
7453
|
+
DUCKDB_API void Alter(ClientContext &context, AlterInfo *info);
|
|
7517
7454
|
|
|
7518
7455
|
private:
|
|
7519
7456
|
//! The catalog version, incremented whenever anything changes in the catalog
|
|
@@ -7537,26 +7474,30 @@ private:
|
|
|
7537
7474
|
};
|
|
7538
7475
|
|
|
7539
7476
|
template <>
|
|
7540
|
-
TableCatalogEntry *Catalog::GetEntry(ClientContext &context, const string &schema_name, const string &name,
|
|
7541
|
-
|
|
7477
|
+
DUCKDB_API TableCatalogEntry *Catalog::GetEntry(ClientContext &context, const string &schema_name, const string &name,
|
|
7478
|
+
bool if_exists, QueryErrorContext error_context);
|
|
7542
7479
|
template <>
|
|
7543
|
-
SequenceCatalogEntry *Catalog::GetEntry(ClientContext &context, const string &schema_name,
|
|
7544
|
-
|
|
7480
|
+
DUCKDB_API SequenceCatalogEntry *Catalog::GetEntry(ClientContext &context, const string &schema_name,
|
|
7481
|
+
const string &name, bool if_exists, QueryErrorContext error_context);
|
|
7545
7482
|
template <>
|
|
7546
|
-
TableFunctionCatalogEntry *Catalog::GetEntry(ClientContext &context, const string &schema_name,
|
|
7547
|
-
|
|
7483
|
+
DUCKDB_API TableFunctionCatalogEntry *Catalog::GetEntry(ClientContext &context, const string &schema_name,
|
|
7484
|
+
const string &name, bool if_exists,
|
|
7485
|
+
QueryErrorContext error_context);
|
|
7548
7486
|
template <>
|
|
7549
|
-
CopyFunctionCatalogEntry *Catalog::GetEntry(ClientContext &context, const string &schema_name,
|
|
7550
|
-
|
|
7487
|
+
DUCKDB_API CopyFunctionCatalogEntry *Catalog::GetEntry(ClientContext &context, const string &schema_name,
|
|
7488
|
+
const string &name, bool if_exists,
|
|
7489
|
+
QueryErrorContext error_context);
|
|
7551
7490
|
template <>
|
|
7552
|
-
PragmaFunctionCatalogEntry *Catalog::GetEntry(ClientContext &context, const string &schema_name,
|
|
7553
|
-
|
|
7491
|
+
DUCKDB_API PragmaFunctionCatalogEntry *Catalog::GetEntry(ClientContext &context, const string &schema_name,
|
|
7492
|
+
const string &name, bool if_exists,
|
|
7493
|
+
QueryErrorContext error_context);
|
|
7554
7494
|
template <>
|
|
7555
|
-
AggregateFunctionCatalogEntry *Catalog::GetEntry(ClientContext &context, const string &schema_name,
|
|
7556
|
-
|
|
7495
|
+
DUCKDB_API AggregateFunctionCatalogEntry *Catalog::GetEntry(ClientContext &context, const string &schema_name,
|
|
7496
|
+
const string &name, bool if_exists,
|
|
7497
|
+
QueryErrorContext error_context);
|
|
7557
7498
|
template <>
|
|
7558
|
-
CollateCatalogEntry *Catalog::GetEntry(ClientContext &context, const string &schema_name, const string &name,
|
|
7559
|
-
|
|
7499
|
+
DUCKDB_API CollateCatalogEntry *Catalog::GetEntry(ClientContext &context, const string &schema_name, const string &name,
|
|
7500
|
+
bool if_exists, QueryErrorContext error_context);
|
|
7560
7501
|
|
|
7561
7502
|
} // namespace duckdb
|
|
7562
7503
|
|
|
@@ -7921,7 +7862,7 @@ struct ColumnBinding {
|
|
|
7921
7862
|
idx_t table_index;
|
|
7922
7863
|
idx_t column_index;
|
|
7923
7864
|
|
|
7924
|
-
ColumnBinding() : table_index(INVALID_INDEX), column_index(INVALID_INDEX) {
|
|
7865
|
+
ColumnBinding() : table_index(DConstants::INVALID_INDEX), column_index(DConstants::INVALID_INDEX) {
|
|
7925
7866
|
}
|
|
7926
7867
|
ColumnBinding(idx_t table, idx_t column) : table_index(table), column_index(column) {
|
|
7927
7868
|
}
|
|
@@ -7975,7 +7916,7 @@ public:
|
|
|
7975
7916
|
|
|
7976
7917
|
virtual string GetName() const;
|
|
7977
7918
|
virtual string ParamsToString() const;
|
|
7978
|
-
virtual string ToString(
|
|
7919
|
+
virtual string ToString() const;
|
|
7979
7920
|
void Print();
|
|
7980
7921
|
//! Debug method: verify that the integrity of expressions & child nodes are maintained
|
|
7981
7922
|
virtual void Verify();
|
|
@@ -8119,26 +8060,29 @@ typedef void (*aggregate_simple_update_t)(Vector inputs[], FunctionData *bind_da
|
|
|
8119
8060
|
//! The type used for updating complex windowed aggregate functions (optional)
|
|
8120
8061
|
typedef std::pair<idx_t, idx_t> FrameBounds;
|
|
8121
8062
|
typedef void (*aggregate_window_t)(Vector inputs[], FunctionData *bind_data, idx_t input_count, data_ptr_t state,
|
|
8122
|
-
const FrameBounds &frame, const FrameBounds &prev, Vector &result, idx_t
|
|
8063
|
+
const FrameBounds &frame, const FrameBounds &prev, Vector &result, idx_t rid,
|
|
8064
|
+
idx_t bias);
|
|
8123
8065
|
|
|
8124
8066
|
class AggregateFunction : public BaseScalarFunction {
|
|
8125
8067
|
public:
|
|
8126
|
-
AggregateFunction(const string &name, const vector<LogicalType> &arguments,
|
|
8127
|
-
|
|
8128
|
-
|
|
8129
|
-
|
|
8130
|
-
|
|
8131
|
-
|
|
8068
|
+
DUCKDB_API AggregateFunction(const string &name, const vector<LogicalType> &arguments,
|
|
8069
|
+
const LogicalType &return_type, aggregate_size_t state_size,
|
|
8070
|
+
aggregate_initialize_t initialize, aggregate_update_t update,
|
|
8071
|
+
aggregate_combine_t combine, aggregate_finalize_t finalize,
|
|
8072
|
+
aggregate_simple_update_t simple_update = nullptr,
|
|
8073
|
+
bind_aggregate_function_t bind = nullptr, aggregate_destructor_t destructor = nullptr,
|
|
8074
|
+
aggregate_statistics_t statistics = nullptr, aggregate_window_t window = nullptr)
|
|
8132
8075
|
: BaseScalarFunction(name, arguments, return_type, false), state_size(state_size), initialize(initialize),
|
|
8133
8076
|
update(update), combine(combine), finalize(finalize), simple_update(simple_update), window(window),
|
|
8134
8077
|
bind(bind), destructor(destructor), statistics(statistics) {
|
|
8135
8078
|
}
|
|
8136
8079
|
|
|
8137
|
-
AggregateFunction(const vector<LogicalType> &arguments, const LogicalType &return_type,
|
|
8138
|
-
|
|
8139
|
-
|
|
8140
|
-
|
|
8141
|
-
|
|
8080
|
+
DUCKDB_API AggregateFunction(const vector<LogicalType> &arguments, const LogicalType &return_type,
|
|
8081
|
+
aggregate_size_t state_size, aggregate_initialize_t initialize,
|
|
8082
|
+
aggregate_update_t update, aggregate_combine_t combine, aggregate_finalize_t finalize,
|
|
8083
|
+
aggregate_simple_update_t simple_update = nullptr,
|
|
8084
|
+
bind_aggregate_function_t bind = nullptr, aggregate_destructor_t destructor = nullptr,
|
|
8085
|
+
aggregate_statistics_t statistics = nullptr, aggregate_window_t window = nullptr)
|
|
8142
8086
|
: AggregateFunction(string(), arguments, return_type, state_size, initialize, update, combine, finalize,
|
|
8143
8087
|
simple_update, bind, destructor, statistics, window) {
|
|
8144
8088
|
}
|
|
@@ -8166,23 +8110,23 @@ public:
|
|
|
8166
8110
|
//! The statistics propagation function (may be null)
|
|
8167
8111
|
aggregate_statistics_t statistics;
|
|
8168
8112
|
|
|
8169
|
-
bool operator==(const AggregateFunction &rhs) const {
|
|
8113
|
+
DUCKDB_API bool operator==(const AggregateFunction &rhs) const {
|
|
8170
8114
|
return state_size == rhs.state_size && initialize == rhs.initialize && update == rhs.update &&
|
|
8171
8115
|
combine == rhs.combine && finalize == rhs.finalize && window == rhs.window;
|
|
8172
8116
|
}
|
|
8173
|
-
bool operator!=(const AggregateFunction &rhs) const {
|
|
8117
|
+
DUCKDB_API bool operator!=(const AggregateFunction &rhs) const {
|
|
8174
8118
|
return !(*this == rhs);
|
|
8175
8119
|
}
|
|
8176
8120
|
|
|
8177
|
-
static unique_ptr<BoundAggregateExpression>
|
|
8121
|
+
DUCKDB_API static unique_ptr<BoundAggregateExpression>
|
|
8178
8122
|
BindAggregateFunction(ClientContext &context, AggregateFunction bound_function,
|
|
8179
8123
|
vector<unique_ptr<Expression>> children, unique_ptr<Expression> filter = nullptr,
|
|
8180
8124
|
bool is_distinct = false, unique_ptr<BoundOrderModifier> order_bys = nullptr);
|
|
8181
8125
|
|
|
8182
|
-
static unique_ptr<FunctionData> BindSortedAggregate(AggregateFunction &bound_function,
|
|
8183
|
-
|
|
8184
|
-
|
|
8185
|
-
|
|
8126
|
+
DUCKDB_API static unique_ptr<FunctionData> BindSortedAggregate(AggregateFunction &bound_function,
|
|
8127
|
+
vector<unique_ptr<Expression>> &children,
|
|
8128
|
+
unique_ptr<FunctionData> bind_info,
|
|
8129
|
+
unique_ptr<BoundOrderModifier> order_bys);
|
|
8186
8130
|
|
|
8187
8131
|
public:
|
|
8188
8132
|
template <class STATE, class RESULT_TYPE, class OP>
|
|
@@ -8261,10 +8205,10 @@ public:
|
|
|
8261
8205
|
|
|
8262
8206
|
template <class STATE, class INPUT_TYPE, class RESULT_TYPE, class OP>
|
|
8263
8207
|
static void UnaryWindow(Vector inputs[], FunctionData *bind_data, idx_t input_count, data_ptr_t state,
|
|
8264
|
-
const FrameBounds &frame, const FrameBounds &prev, Vector &result, idx_t rid) {
|
|
8208
|
+
const FrameBounds &frame, const FrameBounds &prev, Vector &result, idx_t rid, idx_t bias) {
|
|
8265
8209
|
D_ASSERT(input_count == 1);
|
|
8266
8210
|
AggregateExecutor::UnaryWindow<STATE, INPUT_TYPE, RESULT_TYPE, OP>(inputs[0], bind_data, state, frame, prev,
|
|
8267
|
-
result, rid);
|
|
8211
|
+
result, rid, bias);
|
|
8268
8212
|
}
|
|
8269
8213
|
|
|
8270
8214
|
template <class STATE, class A_TYPE, class B_TYPE, class OP>
|
|
@@ -9457,11 +9401,13 @@ namespace duckdb {
|
|
|
9457
9401
|
class Printer {
|
|
9458
9402
|
public:
|
|
9459
9403
|
//! Print the object to stderr
|
|
9460
|
-
static void Print(const string &str);
|
|
9404
|
+
DUCKDB_API static void Print(const string &str);
|
|
9461
9405
|
//! Prints Progress
|
|
9462
|
-
static void PrintProgress(int percentage, const char *pbstr, int pbwidth);
|
|
9406
|
+
DUCKDB_API static void PrintProgress(int percentage, const char *pbstr, int pbwidth);
|
|
9463
9407
|
//! Prints an empty line when progress bar is done
|
|
9464
|
-
static void FinishProgressBarPrint(const char *pbstr, int pbwidth);
|
|
9408
|
+
DUCKDB_API static void FinishProgressBarPrint(const char *pbstr, int pbwidth);
|
|
9409
|
+
//! Whether or not we are printing to a terminal
|
|
9410
|
+
DUCKDB_API static bool IsTerminal();
|
|
9465
9411
|
};
|
|
9466
9412
|
} // namespace duckdb
|
|
9467
9413
|
|
|
@@ -9823,16 +9769,16 @@ namespace duckdb {
|
|
|
9823
9769
|
*/
|
|
9824
9770
|
class StringUtil {
|
|
9825
9771
|
public:
|
|
9826
|
-
static bool CharacterIsSpace(char c) {
|
|
9772
|
+
DUCKDB_API static bool CharacterIsSpace(char c) {
|
|
9827
9773
|
return c == ' ' || c == '\t' || c == '\n' || c == '\v' || c == '\f' || c == '\r';
|
|
9828
9774
|
}
|
|
9829
|
-
static bool CharacterIsNewline(char c) {
|
|
9775
|
+
DUCKDB_API static bool CharacterIsNewline(char c) {
|
|
9830
9776
|
return c == '\n' || c == '\r';
|
|
9831
9777
|
}
|
|
9832
|
-
static bool CharacterIsDigit(char c) {
|
|
9778
|
+
DUCKDB_API static bool CharacterIsDigit(char c) {
|
|
9833
9779
|
return c >= '0' && c <= '9';
|
|
9834
9780
|
}
|
|
9835
|
-
static char CharacterToLower(char c) {
|
|
9781
|
+
DUCKDB_API static char CharacterToLower(char c) {
|
|
9836
9782
|
if (c >= 'A' && c <= 'Z') {
|
|
9837
9783
|
return c - ('A' - 'a');
|
|
9838
9784
|
}
|
|
@@ -9840,25 +9786,25 @@ public:
|
|
|
9840
9786
|
}
|
|
9841
9787
|
|
|
9842
9788
|
//! Returns true if the needle string exists in the haystack
|
|
9843
|
-
static bool Contains(const string &haystack, const string &needle);
|
|
9789
|
+
DUCKDB_API static bool Contains(const string &haystack, const string &needle);
|
|
9844
9790
|
|
|
9845
9791
|
//! Returns true if the target string starts with the given prefix
|
|
9846
|
-
static bool StartsWith(string str, string prefix);
|
|
9792
|
+
DUCKDB_API static bool StartsWith(string str, string prefix);
|
|
9847
9793
|
|
|
9848
9794
|
//! Returns true if the target string <b>ends</b> with the given suffix.
|
|
9849
|
-
static bool EndsWith(const string &str, const string &suffix);
|
|
9795
|
+
DUCKDB_API static bool EndsWith(const string &str, const string &suffix);
|
|
9850
9796
|
|
|
9851
9797
|
//! Repeat a string multiple times
|
|
9852
|
-
static string Repeat(const string &str, const idx_t n);
|
|
9798
|
+
DUCKDB_API static string Repeat(const string &str, const idx_t n);
|
|
9853
9799
|
|
|
9854
9800
|
//! Split the input string based on newline char
|
|
9855
|
-
static vector<string> Split(const string &str, char delimiter);
|
|
9801
|
+
DUCKDB_API static vector<string> Split(const string &str, char delimiter);
|
|
9856
9802
|
|
|
9857
9803
|
//! Split the input string allong a quote. Note that any escaping is NOT supported.
|
|
9858
|
-
static vector<string> SplitWithQuote(const string &str, char delimiter = ',', char quote = '"');
|
|
9804
|
+
DUCKDB_API static vector<string> SplitWithQuote(const string &str, char delimiter = ',', char quote = '"');
|
|
9859
9805
|
|
|
9860
9806
|
//! Join multiple strings into one string. Components are concatenated by the given separator
|
|
9861
|
-
static string Join(const vector<string> &input, const string &separator);
|
|
9807
|
+
DUCKDB_API static string Join(const vector<string> &input, const string &separator);
|
|
9862
9808
|
|
|
9863
9809
|
//! Join multiple items of container with given size, transformed to string
|
|
9864
9810
|
//! using function, into one string using the given separator
|
|
@@ -9882,13 +9828,13 @@ public:
|
|
|
9882
9828
|
}
|
|
9883
9829
|
|
|
9884
9830
|
//! Return a string that formats the give number of bytes
|
|
9885
|
-
static string BytesToHumanReadableString(idx_t bytes);
|
|
9831
|
+
DUCKDB_API static string BytesToHumanReadableString(idx_t bytes);
|
|
9886
9832
|
|
|
9887
9833
|
//! Convert a string to uppercase
|
|
9888
|
-
static string Upper(const string &str);
|
|
9834
|
+
DUCKDB_API static string Upper(const string &str);
|
|
9889
9835
|
|
|
9890
9836
|
//! Convert a string to lowercase
|
|
9891
|
-
static string Lower(const string &str);
|
|
9837
|
+
DUCKDB_API static string Lower(const string &str);
|
|
9892
9838
|
|
|
9893
9839
|
//! Format a string using printf semantics
|
|
9894
9840
|
template <typename... Args>
|
|
@@ -9897,30 +9843,38 @@ public:
|
|
|
9897
9843
|
}
|
|
9898
9844
|
|
|
9899
9845
|
//! Split the input string into a vector of strings based on the split string
|
|
9900
|
-
static vector<string> Split(const string &input, const string &split);
|
|
9846
|
+
DUCKDB_API static vector<string> Split(const string &input, const string &split);
|
|
9901
9847
|
|
|
9902
9848
|
//! Remove the whitespace char in the left end of the string
|
|
9903
|
-
static void LTrim(string &str);
|
|
9849
|
+
DUCKDB_API static void LTrim(string &str);
|
|
9904
9850
|
//! Remove the whitespace char in the right end of the string
|
|
9905
|
-
static void RTrim(string &str);
|
|
9851
|
+
DUCKDB_API static void RTrim(string &str);
|
|
9906
9852
|
//! Remove the whitespace char in the left and right end of the string
|
|
9907
|
-
static void Trim(string &str);
|
|
9853
|
+
DUCKDB_API static void Trim(string &str);
|
|
9908
9854
|
|
|
9909
|
-
static string Replace(string source, const string &from, const string &to);
|
|
9855
|
+
DUCKDB_API static string Replace(string source, const string &from, const string &to);
|
|
9910
9856
|
|
|
9911
9857
|
//! Get the levenshtein distance from two strings
|
|
9912
|
-
static idx_t LevenshteinDistance(const string &s1, const string &s2);
|
|
9858
|
+
DUCKDB_API static idx_t LevenshteinDistance(const string &s1, const string &s2);
|
|
9913
9859
|
|
|
9914
9860
|
//! Get the top-n strings (sorted by the given score distance) from a set of scores.
|
|
9915
9861
|
//! At least one entry is returned (if there is one).
|
|
9916
9862
|
//! Strings are only returned if they have a score less than the threshold.
|
|
9917
|
-
static vector<string> TopNStrings(vector<std::pair<string, idx_t>> scores, idx_t n = 5,
|
|
9863
|
+
DUCKDB_API static vector<string> TopNStrings(vector<std::pair<string, idx_t>> scores, idx_t n = 5,
|
|
9864
|
+
idx_t threshold = 5);
|
|
9918
9865
|
//! Computes the levenshtein distance of each string in strings, and compares it to target, then returns TopNStrings
|
|
9919
9866
|
//! with the given params.
|
|
9920
|
-
static vector<string> TopNLevenshtein(const vector<string> &strings, const string &target, idx_t n = 5,
|
|
9921
|
-
|
|
9922
|
-
static string CandidatesMessage(const vector<string> &candidates,
|
|
9867
|
+
DUCKDB_API static vector<string> TopNLevenshtein(const vector<string> &strings, const string &target, idx_t n = 5,
|
|
9868
|
+
idx_t threshold = 5);
|
|
9869
|
+
DUCKDB_API static string CandidatesMessage(const vector<string> &candidates,
|
|
9870
|
+
const string &candidate = "Candidate bindings");
|
|
9871
|
+
|
|
9872
|
+
//! Generate an error message in the form of "{message_prefix}: nearest_string, nearest_string2, ...
|
|
9873
|
+
//! Equivalent to calling TopNLevenshtein followed by CandidatesMessage
|
|
9874
|
+
DUCKDB_API static string CandidatesErrorMessage(const vector<string> &strings, const string &target,
|
|
9875
|
+
const string &message_prefix, idx_t n = 5);
|
|
9923
9876
|
};
|
|
9877
|
+
|
|
9924
9878
|
} // namespace duckdb
|
|
9925
9879
|
|
|
9926
9880
|
|
|
@@ -10033,6 +9987,7 @@ enum class OptimizerType : uint32_t {
|
|
|
10033
9987
|
};
|
|
10034
9988
|
|
|
10035
9989
|
string OptimizerTypeToString(OptimizerType type);
|
|
9990
|
+
OptimizerType OptimizerTypeFromString(const string &str);
|
|
10036
9991
|
|
|
10037
9992
|
} // namespace duckdb
|
|
10038
9993
|
|
|
@@ -10061,6 +10016,29 @@ enum class WindowAggregationMode : uint32_t {
|
|
|
10061
10016
|
|
|
10062
10017
|
} // namespace duckdb
|
|
10063
10018
|
|
|
10019
|
+
//===----------------------------------------------------------------------===//
|
|
10020
|
+
// DuckDB
|
|
10021
|
+
//
|
|
10022
|
+
// duckdb/common/enums/set_scope.hpp
|
|
10023
|
+
//
|
|
10024
|
+
//
|
|
10025
|
+
//===----------------------------------------------------------------------===//
|
|
10026
|
+
|
|
10027
|
+
|
|
10028
|
+
|
|
10029
|
+
|
|
10030
|
+
|
|
10031
|
+
namespace duckdb {
|
|
10032
|
+
|
|
10033
|
+
enum class SetScope : uint8_t {
|
|
10034
|
+
AUTOMATIC = 0,
|
|
10035
|
+
LOCAL = 1, /* unused */
|
|
10036
|
+
SESSION = 2,
|
|
10037
|
+
GLOBAL = 3
|
|
10038
|
+
};
|
|
10039
|
+
|
|
10040
|
+
} // namespace duckdb
|
|
10041
|
+
|
|
10064
10042
|
|
|
10065
10043
|
namespace duckdb {
|
|
10066
10044
|
class ClientContext;
|
|
@@ -10068,6 +10046,7 @@ class TableFunctionRef;
|
|
|
10068
10046
|
class CompressionFunction;
|
|
10069
10047
|
|
|
10070
10048
|
struct CompressionFunctionSet;
|
|
10049
|
+
struct DBConfig;
|
|
10071
10050
|
|
|
10072
10051
|
enum class AccessMode : uint8_t { UNDEFINED = 0, AUTOMATIC = 1, READ_ONLY = 2, READ_WRITE = 3 };
|
|
10073
10052
|
|
|
@@ -10078,25 +10057,31 @@ enum class CheckpointAbort : uint8_t {
|
|
|
10078
10057
|
DEBUG_ABORT_AFTER_FREE_LIST_WRITE = 3
|
|
10079
10058
|
};
|
|
10080
10059
|
|
|
10081
|
-
|
|
10082
|
-
|
|
10083
|
-
|
|
10084
|
-
DEFAULT_ORDER_TYPE,
|
|
10085
|
-
DEFAULT_NULL_ORDER,
|
|
10086
|
-
ENABLE_EXTERNAL_ACCESS,
|
|
10087
|
-
ENABLE_OBJECT_CACHE,
|
|
10088
|
-
MAXIMUM_MEMORY,
|
|
10089
|
-
THREADS
|
|
10090
|
-
};
|
|
10060
|
+
typedef void (*set_global_function_t)(DatabaseInstance *db, DBConfig &config, const Value ¶meter);
|
|
10061
|
+
typedef void (*set_local_function_t)(ClientContext &context, const Value ¶meter);
|
|
10062
|
+
typedef Value (*get_setting_function_t)(ClientContext &context);
|
|
10091
10063
|
|
|
10092
10064
|
struct ConfigurationOption {
|
|
10093
|
-
ConfigurationOptionType type;
|
|
10094
10065
|
const char *name;
|
|
10095
10066
|
const char *description;
|
|
10096
10067
|
LogicalTypeId parameter_type;
|
|
10068
|
+
set_global_function_t set_global;
|
|
10069
|
+
set_local_function_t set_local;
|
|
10070
|
+
get_setting_function_t get_setting;
|
|
10071
|
+
};
|
|
10072
|
+
|
|
10073
|
+
typedef void (*set_option_callback_t)(ClientContext &context, SetScope scope, Value ¶meter);
|
|
10074
|
+
|
|
10075
|
+
struct ExtensionOption {
|
|
10076
|
+
ExtensionOption(string description_p, LogicalType type_p, set_option_callback_t set_function_p)
|
|
10077
|
+
: description(move(description_p)), type(move(type_p)), set_function(set_function_p) {
|
|
10078
|
+
}
|
|
10079
|
+
|
|
10080
|
+
string description;
|
|
10081
|
+
LogicalType type;
|
|
10082
|
+
set_option_callback_t set_function;
|
|
10097
10083
|
};
|
|
10098
10084
|
|
|
10099
|
-
// this is optional and only used in tests at the moment
|
|
10100
10085
|
struct DBConfig {
|
|
10101
10086
|
friend class DatabaseInstance;
|
|
10102
10087
|
friend class StorageManager;
|
|
@@ -10136,8 +10121,6 @@ public:
|
|
|
10136
10121
|
bool enable_external_access = true;
|
|
10137
10122
|
//! Whether or not object cache is used
|
|
10138
10123
|
bool object_cache_enable = false;
|
|
10139
|
-
//! Database configuration variables as controlled by SET
|
|
10140
|
-
case_insensitive_map_t<Value> set_variables;
|
|
10141
10124
|
//! Force checkpoint when CHECKPOINT is called or on shutdown, even if no changes have been made
|
|
10142
10125
|
bool force_checkpoint = false;
|
|
10143
10126
|
//! Run a checkpoint on successful shutdown and delete the WAL, to leave only a single database file behind
|
|
@@ -10158,6 +10141,14 @@ public:
|
|
|
10158
10141
|
//! Debug setting for window aggregation mode: (window, combine, separate)
|
|
10159
10142
|
WindowAggregationMode window_mode = WindowAggregationMode::WINDOW;
|
|
10160
10143
|
|
|
10144
|
+
//! Extra parameters that can be SET for loaded extensions
|
|
10145
|
+
case_insensitive_map_t<ExtensionOption> extension_parameters;
|
|
10146
|
+
//! Database configuration variables as controlled by SET
|
|
10147
|
+
case_insensitive_map_t<Value> set_variables;
|
|
10148
|
+
|
|
10149
|
+
DUCKDB_API void AddExtensionOption(string name, string description, LogicalType parameter,
|
|
10150
|
+
set_option_callback_t function = nullptr);
|
|
10151
|
+
|
|
10161
10152
|
public:
|
|
10162
10153
|
DUCKDB_API static DBConfig &GetConfig(ClientContext &context);
|
|
10163
10154
|
DUCKDB_API static DBConfig &GetConfig(DatabaseInstance &db);
|
|
@@ -10203,8 +10194,10 @@ class DuckDB;
|
|
|
10203
10194
|
//! The Extension class is the base class used to define extensions
|
|
10204
10195
|
class Extension {
|
|
10205
10196
|
public:
|
|
10197
|
+
DUCKDB_API virtual ~Extension();
|
|
10198
|
+
|
|
10206
10199
|
DUCKDB_API virtual void Load(DuckDB &db) = 0;
|
|
10207
|
-
DUCKDB_API virtual
|
|
10200
|
+
DUCKDB_API virtual std::string Name() = 0;
|
|
10208
10201
|
};
|
|
10209
10202
|
|
|
10210
10203
|
} // namespace duckdb
|
|
@@ -10252,6 +10245,7 @@ private:
|
|
|
10252
10245
|
unique_ptr<TaskScheduler> scheduler;
|
|
10253
10246
|
unique_ptr<ObjectCache> object_cache;
|
|
10254
10247
|
unique_ptr<ConnectionManager> connection_manager;
|
|
10248
|
+
unordered_set<std::string> loaded_extensions;
|
|
10255
10249
|
};
|
|
10256
10250
|
|
|
10257
10251
|
//! The database object. This object holds the catalog and all the
|
|
@@ -10260,6 +10254,8 @@ class DuckDB {
|
|
|
10260
10254
|
public:
|
|
10261
10255
|
DUCKDB_API explicit DuckDB(const char *path = nullptr, DBConfig *config = nullptr);
|
|
10262
10256
|
DUCKDB_API explicit DuckDB(const string &path, DBConfig *config = nullptr);
|
|
10257
|
+
DUCKDB_API explicit DuckDB(DatabaseInstance &instance);
|
|
10258
|
+
|
|
10263
10259
|
DUCKDB_API ~DuckDB();
|
|
10264
10260
|
|
|
10265
10261
|
//! Reference to the actual database instance
|
|
@@ -10269,7 +10265,11 @@ public:
|
|
|
10269
10265
|
template <class T>
|
|
10270
10266
|
void LoadExtension() {
|
|
10271
10267
|
T extension;
|
|
10268
|
+
if (ExtensionIsLoaded(extension.Name())) {
|
|
10269
|
+
return;
|
|
10270
|
+
}
|
|
10272
10271
|
extension.Load(*this);
|
|
10272
|
+
SetExtensionLoaded(extension.Name());
|
|
10273
10273
|
}
|
|
10274
10274
|
|
|
10275
10275
|
DUCKDB_API FileSystem &GetFileSystem();
|
|
@@ -10277,16 +10277,39 @@ public:
|
|
|
10277
10277
|
DUCKDB_API idx_t NumberOfThreads();
|
|
10278
10278
|
DUCKDB_API static const char *SourceID();
|
|
10279
10279
|
DUCKDB_API static const char *LibraryVersion();
|
|
10280
|
+
DUCKDB_API static string Platform();
|
|
10281
|
+
DUCKDB_API bool ExtensionIsLoaded(const std::string &name);
|
|
10282
|
+
DUCKDB_API void SetExtensionLoaded(const std::string &name);
|
|
10280
10283
|
};
|
|
10281
10284
|
|
|
10282
10285
|
} // namespace duckdb
|
|
10283
10286
|
|
|
10284
10287
|
|
|
10288
|
+
//===----------------------------------------------------------------------===//
|
|
10289
|
+
// DuckDB
|
|
10290
|
+
//
|
|
10291
|
+
// duckdb/main/loadable_extension.hpp
|
|
10292
|
+
//
|
|
10293
|
+
//
|
|
10294
|
+
//===----------------------------------------------------------------------===//
|
|
10295
|
+
|
|
10285
10296
|
|
|
10286
10297
|
|
|
10287
10298
|
#ifdef DUCKDB_BUILD_LOADABLE_EXTENSION
|
|
10288
10299
|
#ifdef _WIN32
|
|
10300
|
+
#ifndef NOMINMAX
|
|
10301
|
+
#define NOMINMAX
|
|
10302
|
+
#endif
|
|
10303
|
+
|
|
10304
|
+
#ifndef _WINSOCKAPI_
|
|
10305
|
+
#define _WINSOCKAPI_
|
|
10306
|
+
#endif
|
|
10289
10307
|
#include <windows.h>
|
|
10308
|
+
|
|
10309
|
+
#undef CreateDirectory
|
|
10310
|
+
#undef MoveFile
|
|
10311
|
+
#undef RemoveDirectory
|
|
10312
|
+
|
|
10290
10313
|
#include <delayimp.h>
|
|
10291
10314
|
|
|
10292
10315
|
extern "C" {
|
|
@@ -10294,7 +10317,7 @@ extern "C" {
|
|
|
10294
10317
|
This is interesting: Windows would normally require a duckdb.dll being on the DLL search path when we load an extension
|
|
10295
10318
|
using LoadLibrary(). However, there is likely no such dll, because DuckDB was statically linked, or is running as part
|
|
10296
10319
|
of an R or Python module with a completely different name (that we don't know) or something of the sorts. Amazingly,
|
|
10297
|
-
Windows supports lazy-loading DLLs by linking them with /DELAYLOAD. Then a callback will be
|
|
10320
|
+
Windows supports lazy-loading DLLs by linking them with /DELAYLOAD. Then a callback will be triggered whenever we access
|
|
10298
10321
|
symbols in the extension. Since DuckDB is already running in the host process (hopefully), we can use
|
|
10299
10322
|
GetModuleHandle(NULL) to return the current process so the symbols are looked for there. See here for another
|
|
10300
10323
|
explanation of this crazy process:
|
|
@@ -10332,8 +10355,9 @@ ExternC const PfnDliHook __pfnDliFailureHook2 = duckdb_dllimport_delay_hook;
|
|
|
10332
10355
|
|
|
10333
10356
|
|
|
10334
10357
|
|
|
10358
|
+
#ifndef DUCKDB_API
|
|
10335
10359
|
#ifdef _WIN32
|
|
10336
|
-
#
|
|
10360
|
+
#if defined(DUCKDB_BUILD_LIBRARY) && !defined(DUCKDB_BUILD_LOADABLE_EXTENSION)
|
|
10337
10361
|
#define DUCKDB_API __declspec(dllexport)
|
|
10338
10362
|
#else
|
|
10339
10363
|
#define DUCKDB_API __declspec(dllimport)
|
|
@@ -10341,6 +10365,7 @@ ExternC const PfnDliHook __pfnDliFailureHook2 = duckdb_dllimport_delay_hook;
|
|
|
10341
10365
|
#else
|
|
10342
10366
|
#define DUCKDB_API
|
|
10343
10367
|
#endif
|
|
10368
|
+
#endif
|
|
10344
10369
|
|
|
10345
10370
|
#include <stdbool.h>
|
|
10346
10371
|
#include <stdint.h>
|
|
@@ -11894,14 +11919,11 @@ class TableCatalogEntry;
|
|
|
11894
11919
|
class Connection;
|
|
11895
11920
|
|
|
11896
11921
|
//! The Appender class can be used to append elements to a table.
|
|
11897
|
-
class
|
|
11922
|
+
class BaseAppender {
|
|
11923
|
+
protected:
|
|
11898
11924
|
//! The amount of chunks that will be gathered in the chunk collection before flushing
|
|
11899
11925
|
static constexpr const idx_t FLUSH_COUNT = 100;
|
|
11900
11926
|
|
|
11901
|
-
//! A reference to a database connection that created this appender
|
|
11902
|
-
shared_ptr<ClientContext> context;
|
|
11903
|
-
//! The table description (including column names)
|
|
11904
|
-
unique_ptr<TableDescription> description;
|
|
11905
11927
|
//! The append types
|
|
11906
11928
|
vector<LogicalType> types;
|
|
11907
11929
|
//! The buffered data for the append
|
|
@@ -11912,9 +11934,9 @@ class Appender {
|
|
|
11912
11934
|
idx_t column = 0;
|
|
11913
11935
|
|
|
11914
11936
|
public:
|
|
11915
|
-
DUCKDB_API
|
|
11916
|
-
DUCKDB_API
|
|
11917
|
-
DUCKDB_API ~
|
|
11937
|
+
DUCKDB_API BaseAppender();
|
|
11938
|
+
DUCKDB_API BaseAppender(vector<LogicalType> types);
|
|
11939
|
+
DUCKDB_API virtual ~BaseAppender();
|
|
11918
11940
|
|
|
11919
11941
|
//! Begins a new row append, after calling this the other AppendX() functions
|
|
11920
11942
|
//! should be called the correct amount of times. After that,
|
|
@@ -11950,7 +11972,9 @@ public:
|
|
|
11950
11972
|
return column;
|
|
11951
11973
|
}
|
|
11952
11974
|
|
|
11953
|
-
|
|
11975
|
+
protected:
|
|
11976
|
+
void Destructor();
|
|
11977
|
+
virtual void FlushInternal(ChunkCollection &collection) = 0;
|
|
11954
11978
|
void InitializeChunk();
|
|
11955
11979
|
void FlushChunk();
|
|
11956
11980
|
|
|
@@ -11972,46 +11996,75 @@ private:
|
|
|
11972
11996
|
void AppendValue(const Value &value);
|
|
11973
11997
|
};
|
|
11974
11998
|
|
|
11999
|
+
class Appender : public BaseAppender {
|
|
12000
|
+
//! A reference to a database connection that created this appender
|
|
12001
|
+
shared_ptr<ClientContext> context;
|
|
12002
|
+
//! The table description (including column names)
|
|
12003
|
+
unique_ptr<TableDescription> description;
|
|
12004
|
+
|
|
12005
|
+
public:
|
|
12006
|
+
DUCKDB_API Appender(Connection &con, const string &schema_name, const string &table_name);
|
|
12007
|
+
DUCKDB_API Appender(Connection &con, const string &table_name);
|
|
12008
|
+
DUCKDB_API ~Appender() override;
|
|
12009
|
+
|
|
12010
|
+
protected:
|
|
12011
|
+
void FlushInternal(ChunkCollection &collection) override;
|
|
12012
|
+
};
|
|
12013
|
+
|
|
12014
|
+
class InternalAppender : public BaseAppender {
|
|
12015
|
+
//! The client context
|
|
12016
|
+
ClientContext &context;
|
|
12017
|
+
//! The internal table entry to append to
|
|
12018
|
+
TableCatalogEntry &table;
|
|
12019
|
+
|
|
12020
|
+
public:
|
|
12021
|
+
DUCKDB_API InternalAppender(ClientContext &context, TableCatalogEntry &table);
|
|
12022
|
+
DUCKDB_API ~InternalAppender() override;
|
|
12023
|
+
|
|
12024
|
+
protected:
|
|
12025
|
+
void FlushInternal(ChunkCollection &collection) override;
|
|
12026
|
+
};
|
|
12027
|
+
|
|
11975
12028
|
template <>
|
|
11976
|
-
void
|
|
12029
|
+
DUCKDB_API void BaseAppender::Append(bool value);
|
|
11977
12030
|
template <>
|
|
11978
|
-
void
|
|
12031
|
+
DUCKDB_API void BaseAppender::Append(int8_t value);
|
|
11979
12032
|
template <>
|
|
11980
|
-
void
|
|
12033
|
+
DUCKDB_API void BaseAppender::Append(int16_t value);
|
|
11981
12034
|
template <>
|
|
11982
|
-
void
|
|
12035
|
+
DUCKDB_API void BaseAppender::Append(int32_t value);
|
|
11983
12036
|
template <>
|
|
11984
|
-
void
|
|
12037
|
+
DUCKDB_API void BaseAppender::Append(int64_t value);
|
|
11985
12038
|
template <>
|
|
11986
|
-
void
|
|
12039
|
+
DUCKDB_API void BaseAppender::Append(hugeint_t value);
|
|
11987
12040
|
template <>
|
|
11988
|
-
void
|
|
12041
|
+
DUCKDB_API void BaseAppender::Append(uint8_t value);
|
|
11989
12042
|
template <>
|
|
11990
|
-
void
|
|
12043
|
+
DUCKDB_API void BaseAppender::Append(uint16_t value);
|
|
11991
12044
|
template <>
|
|
11992
|
-
void
|
|
12045
|
+
DUCKDB_API void BaseAppender::Append(uint32_t value);
|
|
11993
12046
|
template <>
|
|
11994
|
-
void
|
|
12047
|
+
DUCKDB_API void BaseAppender::Append(uint64_t value);
|
|
11995
12048
|
template <>
|
|
11996
|
-
void
|
|
12049
|
+
DUCKDB_API void BaseAppender::Append(float value);
|
|
11997
12050
|
template <>
|
|
11998
|
-
void
|
|
12051
|
+
DUCKDB_API void BaseAppender::Append(double value);
|
|
11999
12052
|
template <>
|
|
12000
|
-
void
|
|
12053
|
+
DUCKDB_API void BaseAppender::Append(date_t value);
|
|
12001
12054
|
template <>
|
|
12002
|
-
void
|
|
12055
|
+
DUCKDB_API void BaseAppender::Append(dtime_t value);
|
|
12003
12056
|
template <>
|
|
12004
|
-
void
|
|
12057
|
+
DUCKDB_API void BaseAppender::Append(timestamp_t value);
|
|
12005
12058
|
template <>
|
|
12006
|
-
void
|
|
12059
|
+
DUCKDB_API void BaseAppender::Append(interval_t value);
|
|
12007
12060
|
template <>
|
|
12008
|
-
void
|
|
12061
|
+
DUCKDB_API void BaseAppender::Append(const char *value);
|
|
12009
12062
|
template <>
|
|
12010
|
-
void
|
|
12063
|
+
DUCKDB_API void BaseAppender::Append(string_t value);
|
|
12011
12064
|
template <>
|
|
12012
|
-
void
|
|
12065
|
+
DUCKDB_API void BaseAppender::Append(Value value);
|
|
12013
12066
|
template <>
|
|
12014
|
-
void
|
|
12067
|
+
DUCKDB_API void BaseAppender::Append(std::nullptr_t value);
|
|
12015
12068
|
|
|
12016
12069
|
} // namespace duckdb
|
|
12017
12070
|
//===----------------------------------------------------------------------===//
|
|
@@ -12175,22 +12228,21 @@ enum class ConstraintType : uint8_t {
|
|
|
12175
12228
|
//! Constraint is the base class of any type of table constraint.
|
|
12176
12229
|
class Constraint {
|
|
12177
12230
|
public:
|
|
12178
|
-
explicit Constraint(ConstraintType type)
|
|
12179
|
-
virtual ~Constraint()
|
|
12180
|
-
}
|
|
12231
|
+
DUCKDB_API explicit Constraint(ConstraintType type);
|
|
12232
|
+
DUCKDB_API virtual ~Constraint();
|
|
12181
12233
|
|
|
12182
12234
|
ConstraintType type;
|
|
12183
12235
|
|
|
12184
12236
|
public:
|
|
12185
|
-
virtual string ToString() const = 0;
|
|
12186
|
-
void Print();
|
|
12237
|
+
DUCKDB_API virtual string ToString() const = 0;
|
|
12238
|
+
DUCKDB_API void Print();
|
|
12187
12239
|
|
|
12188
|
-
virtual unique_ptr<Constraint> Copy() = 0;
|
|
12240
|
+
DUCKDB_API virtual unique_ptr<Constraint> Copy() = 0;
|
|
12189
12241
|
//! Serializes a Constraint to a stand-alone binary blob
|
|
12190
|
-
virtual void Serialize(Serializer &serializer);
|
|
12242
|
+
DUCKDB_API virtual void Serialize(Serializer &serializer);
|
|
12191
12243
|
//! Deserializes a blob back into a Constraint, returns NULL if
|
|
12192
12244
|
//! deserialization is not possible
|
|
12193
|
-
static unique_ptr<Constraint> Deserialize(Deserializer &source);
|
|
12245
|
+
DUCKDB_API static unique_ptr<Constraint> Deserialize(Deserializer &source);
|
|
12194
12246
|
};
|
|
12195
12247
|
} // namespace duckdb
|
|
12196
12248
|
|
|
@@ -12278,7 +12330,7 @@ public:
|
|
|
12278
12330
|
|
|
12279
12331
|
//! Returns the column index of the specified column name.
|
|
12280
12332
|
//! If the column does not exist:
|
|
12281
|
-
//! If if_exists is true, returns INVALID_INDEX
|
|
12333
|
+
//! If if_exists is true, returns DConstants::INVALID_INDEX
|
|
12282
12334
|
//! If if_exists is false, throws an exception
|
|
12283
12335
|
idx_t GetColumnIndex(string &name, bool if_exists = false);
|
|
12284
12336
|
|
|
@@ -12317,21 +12369,21 @@ class CatalogSet {
|
|
|
12317
12369
|
friend class DependencyManager;
|
|
12318
12370
|
|
|
12319
12371
|
public:
|
|
12320
|
-
explicit CatalogSet(Catalog &catalog, unique_ptr<DefaultGenerator> defaults = nullptr);
|
|
12372
|
+
DUCKDB_API explicit CatalogSet(Catalog &catalog, unique_ptr<DefaultGenerator> defaults = nullptr);
|
|
12321
12373
|
|
|
12322
12374
|
//! Create an entry in the catalog set. Returns whether or not it was
|
|
12323
12375
|
//! successful.
|
|
12324
|
-
bool CreateEntry(ClientContext &context, const string &name, unique_ptr<CatalogEntry> value,
|
|
12325
|
-
|
|
12376
|
+
DUCKDB_API bool CreateEntry(ClientContext &context, const string &name, unique_ptr<CatalogEntry> value,
|
|
12377
|
+
unordered_set<CatalogEntry *> &dependencies);
|
|
12326
12378
|
|
|
12327
|
-
bool AlterEntry(ClientContext &context, const string &name, AlterInfo *alter_info);
|
|
12379
|
+
DUCKDB_API bool AlterEntry(ClientContext &context, const string &name, AlterInfo *alter_info);
|
|
12328
12380
|
|
|
12329
|
-
bool DropEntry(ClientContext &context, const string &name, bool cascade);
|
|
12381
|
+
DUCKDB_API bool DropEntry(ClientContext &context, const string &name, bool cascade);
|
|
12330
12382
|
|
|
12331
12383
|
void CleanupEntry(CatalogEntry *catalog_entry);
|
|
12332
12384
|
|
|
12333
12385
|
//! Returns the entry with the specified name
|
|
12334
|
-
CatalogEntry *GetEntry(ClientContext &context, const string &name);
|
|
12386
|
+
DUCKDB_API CatalogEntry *GetEntry(ClientContext &context, const string &name);
|
|
12335
12387
|
|
|
12336
12388
|
//! Gets the entry that is most similar to the given name (i.e. smallest levenshtein distance), or empty string if
|
|
12337
12389
|
//! none is found. The returned pair consists of the entry name and the distance (smaller means closer).
|
|
@@ -12342,9 +12394,9 @@ public:
|
|
|
12342
12394
|
void Undo(CatalogEntry *entry);
|
|
12343
12395
|
|
|
12344
12396
|
//! Scan the catalog set, invoking the callback method for every committed entry
|
|
12345
|
-
void Scan(const std::function<void(CatalogEntry *)> &callback);
|
|
12397
|
+
DUCKDB_API void Scan(const std::function<void(CatalogEntry *)> &callback);
|
|
12346
12398
|
//! Scan the catalog set, invoking the callback method for every entry
|
|
12347
|
-
void Scan(ClientContext &context, const std::function<void(CatalogEntry *)> &callback);
|
|
12399
|
+
DUCKDB_API void Scan(ClientContext &context, const std::function<void(CatalogEntry *)> &callback);
|
|
12348
12400
|
|
|
12349
12401
|
template <class T>
|
|
12350
12402
|
vector<T *> GetEntries(ClientContext &context) {
|
|
@@ -12353,8 +12405,8 @@ public:
|
|
|
12353
12405
|
return result;
|
|
12354
12406
|
}
|
|
12355
12407
|
|
|
12356
|
-
static bool HasConflict(ClientContext &context, transaction_t timestamp);
|
|
12357
|
-
static bool UseTimestamp(ClientContext &context, transaction_t timestamp);
|
|
12408
|
+
DUCKDB_API static bool HasConflict(ClientContext &context, transaction_t timestamp);
|
|
12409
|
+
DUCKDB_API static bool UseTimestamp(ClientContext &context, transaction_t timestamp);
|
|
12358
12410
|
|
|
12359
12411
|
CatalogEntry *GetEntryFromIndex(idx_t index);
|
|
12360
12412
|
void UpdateTimestamp(CatalogEntry *entry, transaction_t timestamp);
|
|
@@ -12505,7 +12557,6 @@ private:
|
|
|
12505
12557
|
} // namespace duckdb
|
|
12506
12558
|
|
|
12507
12559
|
|
|
12508
|
-
|
|
12509
12560
|
//===----------------------------------------------------------------------===//
|
|
12510
12561
|
// DuckDB
|
|
12511
12562
|
//
|
|
@@ -12521,24 +12572,6 @@ private:
|
|
|
12521
12572
|
namespace duckdb {
|
|
12522
12573
|
using std::deque;
|
|
12523
12574
|
}
|
|
12524
|
-
//===----------------------------------------------------------------------===//
|
|
12525
|
-
// DuckDB
|
|
12526
|
-
//
|
|
12527
|
-
// duckdb/common/enums/output_type.hpp
|
|
12528
|
-
//
|
|
12529
|
-
//
|
|
12530
|
-
//===----------------------------------------------------------------------===//
|
|
12531
|
-
|
|
12532
|
-
|
|
12533
|
-
|
|
12534
|
-
|
|
12535
|
-
|
|
12536
|
-
namespace duckdb {
|
|
12537
|
-
|
|
12538
|
-
enum class ExplainOutputType : uint8_t { ALL = 0, OPTIMIZED_ONLY = 1, PHYSICAL_ONLY = 2 };
|
|
12539
|
-
|
|
12540
|
-
} // namespace duckdb
|
|
12541
|
-
|
|
12542
12575
|
|
|
12543
12576
|
//===----------------------------------------------------------------------===//
|
|
12544
12577
|
// DuckDB
|
|
@@ -12690,6 +12723,7 @@ enum class PhysicalOperatorType : uint8_t {
|
|
|
12690
12723
|
// Helpers
|
|
12691
12724
|
// -----------------------------
|
|
12692
12725
|
EXPLAIN,
|
|
12726
|
+
EXPLAIN_ANALYZE,
|
|
12693
12727
|
EMPTY_RESULT,
|
|
12694
12728
|
EXECUTE,
|
|
12695
12729
|
PREPARE,
|
|
@@ -12948,14 +12982,13 @@ struct ParallelState;
|
|
|
12948
12982
|
class TableFilterSet;
|
|
12949
12983
|
|
|
12950
12984
|
struct FunctionOperatorData {
|
|
12951
|
-
virtual ~FunctionOperatorData()
|
|
12952
|
-
}
|
|
12985
|
+
DUCKDB_API virtual ~FunctionOperatorData();
|
|
12953
12986
|
};
|
|
12954
12987
|
|
|
12955
12988
|
struct TableFilterCollection {
|
|
12989
|
+
DUCKDB_API explicit TableFilterCollection(TableFilterSet *table_filters);
|
|
12990
|
+
|
|
12956
12991
|
TableFilterSet *table_filters;
|
|
12957
|
-
explicit TableFilterCollection(TableFilterSet *table_filters) : table_filters(table_filters) {
|
|
12958
|
-
}
|
|
12959
12992
|
};
|
|
12960
12993
|
|
|
12961
12994
|
typedef unique_ptr<FunctionData> (*table_function_bind_t)(ClientContext &context, vector<Value> &inputs,
|
|
@@ -13000,6 +13033,7 @@ typedef string (*table_function_to_string_t)(const FunctionData *bind_data);
|
|
|
13000
13033
|
|
|
13001
13034
|
class TableFunction : public SimpleNamedParameterFunction {
|
|
13002
13035
|
public:
|
|
13036
|
+
DUCKDB_API
|
|
13003
13037
|
TableFunction(string name, vector<LogicalType> arguments, table_function_t function,
|
|
13004
13038
|
table_function_bind_t bind = nullptr, table_function_init_t init = nullptr,
|
|
13005
13039
|
table_statistics_t statistics = nullptr, table_function_cleanup_t cleanup = nullptr,
|
|
@@ -13010,14 +13044,8 @@ public:
|
|
|
13010
13044
|
table_function_parallel_t parallel_function = nullptr,
|
|
13011
13045
|
table_function_init_parallel_t parallel_init = nullptr,
|
|
13012
13046
|
table_function_parallel_state_next_t parallel_state_next = nullptr, bool projection_pushdown = false,
|
|
13013
|
-
bool filter_pushdown = false, table_function_progress_t query_progress = nullptr)
|
|
13014
|
-
|
|
13015
|
-
statistics(statistics), cleanup(cleanup), dependency(dependency), cardinality(cardinality),
|
|
13016
|
-
pushdown_complex_filter(pushdown_complex_filter), to_string(to_string), max_threads(max_threads),
|
|
13017
|
-
init_parallel_state(init_parallel_state), parallel_function(parallel_function), parallel_init(parallel_init),
|
|
13018
|
-
parallel_state_next(parallel_state_next), table_scan_progress(query_progress),
|
|
13019
|
-
projection_pushdown(projection_pushdown), filter_pushdown(filter_pushdown) {
|
|
13020
|
-
}
|
|
13047
|
+
bool filter_pushdown = false, table_function_progress_t query_progress = nullptr);
|
|
13048
|
+
DUCKDB_API
|
|
13021
13049
|
TableFunction(const vector<LogicalType> &arguments, table_function_t function, table_function_bind_t bind = nullptr,
|
|
13022
13050
|
table_function_init_t init = nullptr, table_statistics_t statistics = nullptr,
|
|
13023
13051
|
table_function_cleanup_t cleanup = nullptr, table_function_dependency_t dependency = nullptr,
|
|
@@ -13028,13 +13056,8 @@ public:
|
|
|
13028
13056
|
table_function_parallel_t parallel_function = nullptr,
|
|
13029
13057
|
table_function_init_parallel_t parallel_init = nullptr,
|
|
13030
13058
|
table_function_parallel_state_next_t parallel_state_next = nullptr, bool projection_pushdown = false,
|
|
13031
|
-
bool filter_pushdown = false, table_function_progress_t query_progress = nullptr)
|
|
13032
|
-
|
|
13033
|
-
pushdown_complex_filter, to_string, max_threads, init_parallel_state, parallel_function,
|
|
13034
|
-
parallel_init, parallel_state_next, projection_pushdown, filter_pushdown, query_progress) {
|
|
13035
|
-
}
|
|
13036
|
-
TableFunction() : SimpleNamedParameterFunction("", {}) {
|
|
13037
|
-
}
|
|
13059
|
+
bool filter_pushdown = false, table_function_progress_t query_progress = nullptr);
|
|
13060
|
+
DUCKDB_API TableFunction();
|
|
13038
13061
|
|
|
13039
13062
|
//! Bind function
|
|
13040
13063
|
//! This function is used for determining the return type of a table producing function and returning bind data
|
|
@@ -13082,10 +13105,6 @@ public:
|
|
|
13082
13105
|
//! Whether or not the table function supports filter pushdown. If not supported a filter will be added
|
|
13083
13106
|
//! that applies the table filter directly.
|
|
13084
13107
|
bool filter_pushdown;
|
|
13085
|
-
|
|
13086
|
-
string ToString() override {
|
|
13087
|
-
return SimpleNamedParameterFunction::ToString();
|
|
13088
|
-
}
|
|
13089
13108
|
};
|
|
13090
13109
|
|
|
13091
13110
|
} // namespace duckdb
|
|
@@ -13170,6 +13189,7 @@ namespace duckdb {
|
|
|
13170
13189
|
struct ConcurrentQueue;
|
|
13171
13190
|
struct QueueProducerToken;
|
|
13172
13191
|
class ClientContext;
|
|
13192
|
+
class DatabaseInstance;
|
|
13173
13193
|
class TaskScheduler;
|
|
13174
13194
|
|
|
13175
13195
|
struct SchedulerThread;
|
|
@@ -13193,6 +13213,7 @@ public:
|
|
|
13193
13213
|
~TaskScheduler();
|
|
13194
13214
|
|
|
13195
13215
|
static TaskScheduler &GetScheduler(ClientContext &context);
|
|
13216
|
+
static TaskScheduler &GetScheduler(DatabaseInstance &db);
|
|
13196
13217
|
|
|
13197
13218
|
unique_ptr<ProducerToken> CreateProducer();
|
|
13198
13219
|
//! Schedule a task to be executed by the task scheduler
|
|
@@ -13437,7 +13458,7 @@ public:
|
|
|
13437
13458
|
//! Starts the thread
|
|
13438
13459
|
void Start();
|
|
13439
13460
|
//! Stops the thread
|
|
13440
|
-
void Stop();
|
|
13461
|
+
void Stop(bool success = true);
|
|
13441
13462
|
//! Gets current percentage
|
|
13442
13463
|
int GetCurrentPercentage();
|
|
13443
13464
|
|
|
@@ -13454,7 +13475,7 @@ private:
|
|
|
13454
13475
|
std::condition_variable c;
|
|
13455
13476
|
mutex m;
|
|
13456
13477
|
#endif
|
|
13457
|
-
idx_t show_progress_after;
|
|
13478
|
+
atomic<idx_t> show_progress_after;
|
|
13458
13479
|
idx_t time_update_bar;
|
|
13459
13480
|
atomic<int> current_percentage;
|
|
13460
13481
|
atomic<bool> stop;
|
|
@@ -13540,6 +13561,75 @@ private:
|
|
|
13540
13561
|
|
|
13541
13562
|
#include <random>
|
|
13542
13563
|
|
|
13564
|
+
//===----------------------------------------------------------------------===//
|
|
13565
|
+
// DuckDB
|
|
13566
|
+
//
|
|
13567
|
+
// duckdb/main/client_config.hpp
|
|
13568
|
+
//
|
|
13569
|
+
//
|
|
13570
|
+
//===----------------------------------------------------------------------===//
|
|
13571
|
+
|
|
13572
|
+
|
|
13573
|
+
|
|
13574
|
+
|
|
13575
|
+
|
|
13576
|
+
//===----------------------------------------------------------------------===//
|
|
13577
|
+
// DuckDB
|
|
13578
|
+
//
|
|
13579
|
+
// duckdb/common/enums/output_type.hpp
|
|
13580
|
+
//
|
|
13581
|
+
//
|
|
13582
|
+
//===----------------------------------------------------------------------===//
|
|
13583
|
+
|
|
13584
|
+
|
|
13585
|
+
|
|
13586
|
+
|
|
13587
|
+
|
|
13588
|
+
namespace duckdb {
|
|
13589
|
+
|
|
13590
|
+
enum class ExplainOutputType : uint8_t { ALL = 0, OPTIMIZED_ONLY = 1, PHYSICAL_ONLY = 2 };
|
|
13591
|
+
|
|
13592
|
+
} // namespace duckdb
|
|
13593
|
+
|
|
13594
|
+
|
|
13595
|
+
|
|
13596
|
+
namespace duckdb {
|
|
13597
|
+
class ClientContext;
|
|
13598
|
+
|
|
13599
|
+
struct ClientConfig {
|
|
13600
|
+
//! If the progress bar is enabled or not.
|
|
13601
|
+
bool enable_progress_bar = false;
|
|
13602
|
+
//! If the print of the progress bar is enabled
|
|
13603
|
+
bool print_progress_bar = true;
|
|
13604
|
+
//! The wait time before showing the progress bar
|
|
13605
|
+
int wait_time = 2000;
|
|
13606
|
+
|
|
13607
|
+
// Whether or not aggressive query verification is enabled
|
|
13608
|
+
bool query_verification_enabled = false;
|
|
13609
|
+
//! Enable the running of optimizers
|
|
13610
|
+
bool enable_optimizer = true;
|
|
13611
|
+
//! Force parallelism of small tables, used for testing
|
|
13612
|
+
bool verify_parallelism = false;
|
|
13613
|
+
//! Force index join independent of table cardinality, used for testing
|
|
13614
|
+
bool force_index_join = false;
|
|
13615
|
+
//! Force out-of-core computation for operators that support it, used for testing
|
|
13616
|
+
bool force_external = false;
|
|
13617
|
+
//! Maximum bits allowed for using a perfect hash table (i.e. the perfect HT can hold up to 2^perfect_ht_threshold
|
|
13618
|
+
//! elements)
|
|
13619
|
+
idx_t perfect_ht_threshold = 12;
|
|
13620
|
+
|
|
13621
|
+
//! The explain output type used when none is specified (default: PHYSICAL_ONLY)
|
|
13622
|
+
ExplainOutputType explain_output_type = ExplainOutputType::PHYSICAL_ONLY;
|
|
13623
|
+
|
|
13624
|
+
//! Generic options
|
|
13625
|
+
case_insensitive_map_t<Value> set_variables;
|
|
13626
|
+
|
|
13627
|
+
public:
|
|
13628
|
+
static ClientConfig &GetConfig(ClientContext &context);
|
|
13629
|
+
};
|
|
13630
|
+
|
|
13631
|
+
} // namespace duckdb
|
|
13632
|
+
|
|
13543
13633
|
|
|
13544
13634
|
namespace duckdb {
|
|
13545
13635
|
class Appender;
|
|
@@ -13584,35 +13674,12 @@ public:
|
|
|
13584
13674
|
|
|
13585
13675
|
//! The Progress Bar
|
|
13586
13676
|
unique_ptr<ProgressBar> progress_bar;
|
|
13587
|
-
//! If the progress bar is enabled or not.
|
|
13588
|
-
bool enable_progress_bar = false;
|
|
13589
|
-
//! If the print of the progress bar is enabled
|
|
13590
|
-
bool print_progress_bar = true;
|
|
13591
|
-
//! The wait time before showing the progress bar
|
|
13592
|
-
int wait_time = 2000;
|
|
13593
13677
|
|
|
13594
13678
|
unique_ptr<SchemaCatalogEntry> temporary_objects;
|
|
13595
13679
|
unordered_map<string, shared_ptr<PreparedStatementData>> prepared_statements;
|
|
13596
13680
|
|
|
13597
|
-
case_insensitive_map_t<Value> set_variables;
|
|
13598
|
-
|
|
13599
|
-
// Whether or not aggressive query verification is enabled
|
|
13600
|
-
bool query_verification_enabled = false;
|
|
13601
|
-
//! Enable the running of optimizers
|
|
13602
|
-
bool enable_optimizer = true;
|
|
13603
|
-
//! Force parallelism of small tables, used for testing
|
|
13604
|
-
bool verify_parallelism = false;
|
|
13605
|
-
//! Force index join independent of table cardinality, used for testing
|
|
13606
|
-
bool force_index_join = false;
|
|
13607
|
-
//! Force out-of-core computation for operators that support it, used for testing
|
|
13608
|
-
bool force_external = false;
|
|
13609
|
-
//! Maximum bits allowed for using a perfect hash table (i.e. the perfect HT can hold up to 2^perfect_ht_threshold
|
|
13610
|
-
//! elements)
|
|
13611
|
-
idx_t perfect_ht_threshold = 12;
|
|
13612
13681
|
//! The writer used to log queries (if logging is enabled)
|
|
13613
13682
|
unique_ptr<BufferedFileWriter> log_query_writer;
|
|
13614
|
-
//! The explain output type used when none is specified (default: PHYSICAL_ONLY)
|
|
13615
|
-
ExplainOutputType explain_output_type = ExplainOutputType::PHYSICAL_ONLY;
|
|
13616
13683
|
//! The random generator used by random(). Its seed value can be set by setseed().
|
|
13617
13684
|
std::mt19937 random_engine;
|
|
13618
13685
|
|
|
@@ -13620,6 +13687,9 @@ public:
|
|
|
13620
13687
|
|
|
13621
13688
|
unique_ptr<FileOpener> file_opener;
|
|
13622
13689
|
|
|
13690
|
+
//! The client configuration
|
|
13691
|
+
ClientConfig config;
|
|
13692
|
+
|
|
13623
13693
|
public:
|
|
13624
13694
|
DUCKDB_API Transaction &ActiveTransaction() {
|
|
13625
13695
|
return transaction.ActiveTransaction();
|