duckdb 0.5.2-dev2076.0 → 0.5.2-dev2131.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 +1257 -1082
- package/src/duckdb.hpp +988 -676
- package/src/parquet-amalgamation.cpp +37530 -37530
package/src/duckdb.hpp
CHANGED
|
@@ -11,8 +11,8 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
|
|
11
11
|
#pragma once
|
|
12
12
|
#define DUCKDB_AMALGAMATION 1
|
|
13
13
|
#define DUCKDB_AMALGAMATION_EXTENDED 1
|
|
14
|
-
#define DUCKDB_SOURCE_ID "
|
|
15
|
-
#define DUCKDB_VERSION "v0.5.2-
|
|
14
|
+
#define DUCKDB_SOURCE_ID "9cfe9c42d8"
|
|
15
|
+
#define DUCKDB_VERSION "v0.5.2-dev2131"
|
|
16
16
|
//===----------------------------------------------------------------------===//
|
|
17
17
|
// DuckDB
|
|
18
18
|
//
|
|
@@ -198,6 +198,46 @@ struct Storage {
|
|
|
198
198
|
constexpr static int FILE_HEADER_SIZE = 4096;
|
|
199
199
|
};
|
|
200
200
|
|
|
201
|
+
struct LogicalIndex {
|
|
202
|
+
explicit LogicalIndex(idx_t index) : index(index) {
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
idx_t index;
|
|
206
|
+
|
|
207
|
+
inline bool operator==(const LogicalIndex &rhs) const {
|
|
208
|
+
return index == rhs.index;
|
|
209
|
+
};
|
|
210
|
+
inline bool operator!=(const LogicalIndex &rhs) const {
|
|
211
|
+
return index != rhs.index;
|
|
212
|
+
};
|
|
213
|
+
inline bool operator<(const LogicalIndex &rhs) const {
|
|
214
|
+
return index < rhs.index;
|
|
215
|
+
};
|
|
216
|
+
bool IsValid() {
|
|
217
|
+
return index != DConstants::INVALID_INDEX;
|
|
218
|
+
}
|
|
219
|
+
};
|
|
220
|
+
|
|
221
|
+
struct PhysicalIndex {
|
|
222
|
+
explicit PhysicalIndex(idx_t index) : index(index) {
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
idx_t index;
|
|
226
|
+
|
|
227
|
+
inline bool operator==(const PhysicalIndex &rhs) const {
|
|
228
|
+
return index == rhs.index;
|
|
229
|
+
};
|
|
230
|
+
inline bool operator!=(const PhysicalIndex &rhs) const {
|
|
231
|
+
return index != rhs.index;
|
|
232
|
+
};
|
|
233
|
+
inline bool operator<(const PhysicalIndex &rhs) const {
|
|
234
|
+
return index < rhs.index;
|
|
235
|
+
};
|
|
236
|
+
bool IsValid() {
|
|
237
|
+
return index != DConstants::INVALID_INDEX;
|
|
238
|
+
}
|
|
239
|
+
};
|
|
240
|
+
|
|
201
241
|
uint64_t NextPowerOfTwo(uint64_t v);
|
|
202
242
|
|
|
203
243
|
} // namespace duckdb
|
|
@@ -1490,7 +1530,8 @@ enum class ExceptionType {
|
|
|
1490
1530
|
OUT_OF_MEMORY = 33, // out of memory
|
|
1491
1531
|
PERMISSION = 34, // insufficient permissions
|
|
1492
1532
|
PARAMETER_NOT_RESOLVED = 35, // parameter types could not be resolved
|
|
1493
|
-
PARAMETER_NOT_ALLOWED = 36
|
|
1533
|
+
PARAMETER_NOT_ALLOWED = 36, // parameter types not allowed
|
|
1534
|
+
DEPENDENCY = 37 // dependency
|
|
1494
1535
|
};
|
|
1495
1536
|
|
|
1496
1537
|
class Exception : public std::exception {
|
|
@@ -1657,6 +1698,16 @@ public:
|
|
|
1657
1698
|
}
|
|
1658
1699
|
};
|
|
1659
1700
|
|
|
1701
|
+
class DependencyException : public Exception {
|
|
1702
|
+
public:
|
|
1703
|
+
DUCKDB_API explicit DependencyException(const string &msg);
|
|
1704
|
+
|
|
1705
|
+
template <typename... Args>
|
|
1706
|
+
explicit DependencyException(const string &msg, Args... params)
|
|
1707
|
+
: DependencyException(ConstructMessage(msg, params...)) {
|
|
1708
|
+
}
|
|
1709
|
+
};
|
|
1710
|
+
|
|
1660
1711
|
class IOException : public Exception {
|
|
1661
1712
|
public:
|
|
1662
1713
|
DUCKDB_API explicit IOException(const string &msg);
|
|
@@ -7114,6 +7165,9 @@ public:
|
|
|
7114
7165
|
const storage_t &StorageOid() const;
|
|
7115
7166
|
void SetStorageOid(storage_t storage_oid);
|
|
7116
7167
|
|
|
7168
|
+
LogicalIndex Logical() const;
|
|
7169
|
+
PhysicalIndex Physical() const;
|
|
7170
|
+
|
|
7117
7171
|
//! oid
|
|
7118
7172
|
const column_t &Oid() const;
|
|
7119
7173
|
void SetOid(column_t oid);
|
|
@@ -7137,9 +7191,9 @@ public:
|
|
|
7137
7191
|
void ChangeGeneratedExpressionType(const LogicalType &type);
|
|
7138
7192
|
void GetListOfDependencies(vector<string> &dependencies) const;
|
|
7139
7193
|
|
|
7140
|
-
string GetName();
|
|
7194
|
+
string GetName() const;
|
|
7141
7195
|
|
|
7142
|
-
LogicalType GetType();
|
|
7196
|
+
LogicalType GetType() const;
|
|
7143
7197
|
|
|
7144
7198
|
private:
|
|
7145
7199
|
//! The name of the entry
|
|
@@ -7149,9 +7203,9 @@ private:
|
|
|
7149
7203
|
//! Compression Type used for this column
|
|
7150
7204
|
duckdb::CompressionType compression_type = duckdb::CompressionType::COMPRESSION_AUTO;
|
|
7151
7205
|
//! The index of the column in the storage of the table
|
|
7152
|
-
storage_t storage_oid;
|
|
7206
|
+
storage_t storage_oid = DConstants::INVALID_INDEX;
|
|
7153
7207
|
//! The index of the column in the table
|
|
7154
|
-
idx_t oid;
|
|
7208
|
+
idx_t oid = DConstants::INVALID_INDEX;
|
|
7155
7209
|
//! The category of the column
|
|
7156
7210
|
TableColumnType category = TableColumnType::STANDARD;
|
|
7157
7211
|
//! Used by Generated Columns
|
|
@@ -7381,6 +7435,11 @@ struct ExpressionState {
|
|
|
7381
7435
|
public:
|
|
7382
7436
|
void AddChild(Expression *expr);
|
|
7383
7437
|
void Finalize();
|
|
7438
|
+
Allocator &GetAllocator();
|
|
7439
|
+
bool HasContext();
|
|
7440
|
+
ClientContext &GetContext();
|
|
7441
|
+
|
|
7442
|
+
void Verify(ExpressionExecutorState &root);
|
|
7384
7443
|
};
|
|
7385
7444
|
|
|
7386
7445
|
struct ExecuteFunctionState : public ExpressionState {
|
|
@@ -7397,10 +7456,13 @@ public:
|
|
|
7397
7456
|
|
|
7398
7457
|
struct ExpressionExecutorState {
|
|
7399
7458
|
explicit ExpressionExecutorState(const string &name);
|
|
7459
|
+
|
|
7400
7460
|
unique_ptr<ExpressionState> root_state;
|
|
7401
|
-
ExpressionExecutor *executor;
|
|
7461
|
+
ExpressionExecutor *executor = nullptr;
|
|
7402
7462
|
CycleCounter profiler;
|
|
7403
7463
|
string name;
|
|
7464
|
+
|
|
7465
|
+
void Verify();
|
|
7404
7466
|
};
|
|
7405
7467
|
|
|
7406
7468
|
} // namespace duckdb
|
|
@@ -8211,7 +8273,8 @@ typedef std::function<void(DataChunk &, ExpressionState &, Vector &)> scalar_fun
|
|
|
8211
8273
|
//! Binds the scalar function and creates the function data
|
|
8212
8274
|
typedef unique_ptr<FunctionData> (*bind_scalar_function_t)(ClientContext &context, ScalarFunction &bound_function,
|
|
8213
8275
|
vector<unique_ptr<Expression>> &arguments);
|
|
8214
|
-
typedef unique_ptr<FunctionLocalState> (*init_local_state_t)(
|
|
8276
|
+
typedef unique_ptr<FunctionLocalState> (*init_local_state_t)(ExpressionState &state,
|
|
8277
|
+
const BoundFunctionExpression &expr,
|
|
8215
8278
|
FunctionData *bind_data);
|
|
8216
8279
|
typedef unique_ptr<BaseStatistics> (*function_statistics_t)(ClientContext &context, FunctionStatisticsInput &input);
|
|
8217
8280
|
//! Adds the dependencies of this BoundFunctionExpression to the set of dependencies
|
|
@@ -9651,11 +9714,10 @@ public:
|
|
|
9651
9714
|
} // namespace duckdb
|
|
9652
9715
|
|
|
9653
9716
|
|
|
9654
|
-
|
|
9655
9717
|
//===----------------------------------------------------------------------===//
|
|
9656
9718
|
// DuckDB
|
|
9657
9719
|
//
|
|
9658
|
-
// duckdb/parser/
|
|
9720
|
+
// duckdb/parser/column_list.hpp
|
|
9659
9721
|
//
|
|
9660
9722
|
//
|
|
9661
9723
|
//===----------------------------------------------------------------------===//
|
|
@@ -9663,70 +9725,10 @@ public:
|
|
|
9663
9725
|
|
|
9664
9726
|
|
|
9665
9727
|
|
|
9666
|
-
|
|
9667
|
-
|
|
9668
|
-
namespace duckdb {
|
|
9669
|
-
|
|
9670
|
-
class Serializer;
|
|
9671
|
-
class Deserializer;
|
|
9672
|
-
class FieldWriter;
|
|
9673
|
-
class FieldReader;
|
|
9674
|
-
|
|
9675
|
-
//===--------------------------------------------------------------------===//
|
|
9676
|
-
// Constraint Types
|
|
9677
|
-
//===--------------------------------------------------------------------===//
|
|
9678
|
-
enum class ConstraintType : uint8_t {
|
|
9679
|
-
INVALID = 0, // invalid constraint type
|
|
9680
|
-
NOT_NULL = 1, // NOT NULL constraint
|
|
9681
|
-
CHECK = 2, // CHECK constraint
|
|
9682
|
-
UNIQUE = 3, // UNIQUE constraint
|
|
9683
|
-
FOREIGN_KEY = 4, // FOREIGN KEY constraint
|
|
9684
|
-
};
|
|
9685
|
-
|
|
9686
|
-
enum class ForeignKeyType : uint8_t {
|
|
9687
|
-
FK_TYPE_PRIMARY_KEY_TABLE = 0, // main table
|
|
9688
|
-
FK_TYPE_FOREIGN_KEY_TABLE = 1, // referencing table
|
|
9689
|
-
FK_TYPE_SELF_REFERENCE_TABLE = 2 // self refrencing table
|
|
9690
|
-
};
|
|
9691
|
-
|
|
9692
|
-
struct ForeignKeyInfo {
|
|
9693
|
-
ForeignKeyType type;
|
|
9694
|
-
string schema;
|
|
9695
|
-
//! if type is FK_TYPE_FOREIGN_KEY_TABLE, means main key table, if type is FK_TYPE_PRIMARY_KEY_TABLE, means foreign
|
|
9696
|
-
//! key table
|
|
9697
|
-
string table;
|
|
9698
|
-
//! The set of main key table's column's index
|
|
9699
|
-
vector<storage_t> pk_keys;
|
|
9700
|
-
//! The set of foreign key table's column's index
|
|
9701
|
-
vector<storage_t> fk_keys;
|
|
9702
|
-
};
|
|
9703
|
-
|
|
9704
|
-
//! Constraint is the base class of any type of table constraint.
|
|
9705
|
-
class Constraint {
|
|
9706
|
-
public:
|
|
9707
|
-
DUCKDB_API explicit Constraint(ConstraintType type);
|
|
9708
|
-
DUCKDB_API virtual ~Constraint();
|
|
9709
|
-
|
|
9710
|
-
ConstraintType type;
|
|
9711
|
-
|
|
9712
|
-
public:
|
|
9713
|
-
DUCKDB_API virtual string ToString() const = 0;
|
|
9714
|
-
DUCKDB_API void Print() const;
|
|
9715
|
-
|
|
9716
|
-
DUCKDB_API virtual unique_ptr<Constraint> Copy() const = 0;
|
|
9717
|
-
//! Serializes a Constraint to a stand-alone binary blob
|
|
9718
|
-
DUCKDB_API void Serialize(Serializer &serializer) const;
|
|
9719
|
-
//! Serializes a Constraint to a stand-alone binary blob
|
|
9720
|
-
DUCKDB_API virtual void Serialize(FieldWriter &writer) const = 0;
|
|
9721
|
-
//! Deserializes a blob back into a Constraint
|
|
9722
|
-
DUCKDB_API static unique_ptr<Constraint> Deserialize(Deserializer &source);
|
|
9723
|
-
};
|
|
9724
|
-
} // namespace duckdb
|
|
9725
|
-
|
|
9726
9728
|
//===----------------------------------------------------------------------===//
|
|
9727
9729
|
// DuckDB
|
|
9728
9730
|
//
|
|
9729
|
-
// duckdb/
|
|
9731
|
+
// duckdb/common/field_writer.hpp
|
|
9730
9732
|
//
|
|
9731
9733
|
//
|
|
9732
9734
|
//===----------------------------------------------------------------------===//
|
|
@@ -9734,55 +9736,26 @@ public:
|
|
|
9734
9736
|
|
|
9735
9737
|
|
|
9736
9738
|
|
|
9737
|
-
|
|
9738
|
-
|
|
9739
|
-
|
|
9740
|
-
namespace duckdb {
|
|
9741
|
-
//! Bound equivalent of Constraint
|
|
9742
|
-
class BoundConstraint {
|
|
9743
|
-
public:
|
|
9744
|
-
explicit BoundConstraint(ConstraintType type) : type(type) {};
|
|
9745
|
-
virtual ~BoundConstraint() {
|
|
9746
|
-
}
|
|
9747
|
-
|
|
9748
|
-
void Serialize(Serializer &serializer) const {
|
|
9749
|
-
serializer.Write(type);
|
|
9750
|
-
}
|
|
9751
|
-
|
|
9752
|
-
static unique_ptr<BoundConstraint> Deserialize(Deserializer &source) {
|
|
9753
|
-
return make_unique<BoundConstraint>(source.Read<ConstraintType>());
|
|
9754
|
-
}
|
|
9755
|
-
|
|
9756
|
-
ConstraintType type;
|
|
9757
|
-
};
|
|
9758
|
-
} // namespace duckdb
|
|
9759
|
-
|
|
9760
9739
|
//===----------------------------------------------------------------------===//
|
|
9761
9740
|
// DuckDB
|
|
9762
9741
|
//
|
|
9763
|
-
// duckdb/
|
|
9742
|
+
// duckdb/common/set.hpp
|
|
9764
9743
|
//
|
|
9765
9744
|
//
|
|
9766
9745
|
//===----------------------------------------------------------------------===//
|
|
9767
9746
|
|
|
9768
9747
|
|
|
9769
9748
|
|
|
9749
|
+
#include <set>
|
|
9770
9750
|
|
|
9751
|
+
namespace duckdb {
|
|
9752
|
+
using std::set;
|
|
9753
|
+
}
|
|
9771
9754
|
|
|
9772
9755
|
//===----------------------------------------------------------------------===//
|
|
9773
9756
|
// DuckDB
|
|
9774
9757
|
//
|
|
9775
|
-
// duckdb/
|
|
9776
|
-
//
|
|
9777
|
-
//
|
|
9778
|
-
//===----------------------------------------------------------------------===//
|
|
9779
|
-
|
|
9780
|
-
|
|
9781
|
-
|
|
9782
|
-
//===----------------------------------------------------------------------===//
|
|
9783
|
-
// DuckDB
|
|
9784
|
-
//
|
|
9785
|
-
// duckdb/common/enums/logical_operator_type.hpp
|
|
9758
|
+
// duckdb/common/serializer/buffered_serializer.hpp
|
|
9786
9759
|
//
|
|
9787
9760
|
//
|
|
9788
9761
|
//===----------------------------------------------------------------------===//
|
|
@@ -9793,106 +9766,747 @@ public:
|
|
|
9793
9766
|
|
|
9794
9767
|
namespace duckdb {
|
|
9795
9768
|
|
|
9796
|
-
|
|
9797
|
-
// Logical Operator Types
|
|
9798
|
-
//===--------------------------------------------------------------------===//
|
|
9799
|
-
enum class LogicalOperatorType : uint8_t {
|
|
9800
|
-
LOGICAL_INVALID = 0,
|
|
9801
|
-
LOGICAL_PROJECTION = 1,
|
|
9802
|
-
LOGICAL_FILTER = 2,
|
|
9803
|
-
LOGICAL_AGGREGATE_AND_GROUP_BY = 3,
|
|
9804
|
-
LOGICAL_WINDOW = 4,
|
|
9805
|
-
LOGICAL_UNNEST = 5,
|
|
9806
|
-
LOGICAL_LIMIT = 6,
|
|
9807
|
-
LOGICAL_ORDER_BY = 7,
|
|
9808
|
-
LOGICAL_TOP_N = 8,
|
|
9809
|
-
LOGICAL_COPY_TO_FILE = 10,
|
|
9810
|
-
LOGICAL_DISTINCT = 11,
|
|
9811
|
-
LOGICAL_SAMPLE = 12,
|
|
9812
|
-
LOGICAL_LIMIT_PERCENT = 13,
|
|
9769
|
+
#define SERIALIZER_DEFAULT_SIZE 1024
|
|
9813
9770
|
|
|
9814
|
-
|
|
9815
|
-
|
|
9816
|
-
|
|
9817
|
-
|
|
9818
|
-
LOGICAL_CHUNK_GET = 26,
|
|
9819
|
-
LOGICAL_DELIM_GET = 27,
|
|
9820
|
-
LOGICAL_EXPRESSION_GET = 28,
|
|
9821
|
-
LOGICAL_DUMMY_SCAN = 29,
|
|
9822
|
-
LOGICAL_EMPTY_RESULT = 30,
|
|
9823
|
-
LOGICAL_CTE_REF = 31,
|
|
9824
|
-
// -----------------------------
|
|
9825
|
-
// Joins
|
|
9826
|
-
// -----------------------------
|
|
9827
|
-
LOGICAL_JOIN = 50,
|
|
9828
|
-
LOGICAL_DELIM_JOIN = 51,
|
|
9829
|
-
LOGICAL_COMPARISON_JOIN = 52,
|
|
9830
|
-
LOGICAL_ANY_JOIN = 53,
|
|
9831
|
-
LOGICAL_CROSS_PRODUCT = 54,
|
|
9832
|
-
// -----------------------------
|
|
9833
|
-
// SetOps
|
|
9834
|
-
// -----------------------------
|
|
9835
|
-
LOGICAL_UNION = 75,
|
|
9836
|
-
LOGICAL_EXCEPT = 76,
|
|
9837
|
-
LOGICAL_INTERSECT = 77,
|
|
9838
|
-
LOGICAL_RECURSIVE_CTE = 78,
|
|
9771
|
+
struct BinaryData {
|
|
9772
|
+
unique_ptr<data_t[]> data;
|
|
9773
|
+
idx_t size;
|
|
9774
|
+
};
|
|
9839
9775
|
|
|
9840
|
-
|
|
9841
|
-
|
|
9842
|
-
|
|
9843
|
-
|
|
9844
|
-
|
|
9845
|
-
|
|
9776
|
+
class BufferedSerializer : public Serializer {
|
|
9777
|
+
public:
|
|
9778
|
+
//! Serializes to a buffer allocated by the serializer, will expand when
|
|
9779
|
+
//! writing past the initial threshold
|
|
9780
|
+
DUCKDB_API explicit BufferedSerializer(idx_t maximum_size = SERIALIZER_DEFAULT_SIZE);
|
|
9781
|
+
//! Serializes to a provided (owned) data pointer
|
|
9782
|
+
BufferedSerializer(unique_ptr<data_t[]> data, idx_t size);
|
|
9783
|
+
BufferedSerializer(data_ptr_t data, idx_t size);
|
|
9846
9784
|
|
|
9847
|
-
|
|
9848
|
-
|
|
9849
|
-
// -----------------------------
|
|
9850
|
-
LOGICAL_ALTER = 125,
|
|
9851
|
-
LOGICAL_CREATE_TABLE = 126,
|
|
9852
|
-
LOGICAL_CREATE_INDEX = 127,
|
|
9853
|
-
LOGICAL_CREATE_SEQUENCE = 128,
|
|
9854
|
-
LOGICAL_CREATE_VIEW = 129,
|
|
9855
|
-
LOGICAL_CREATE_SCHEMA = 130,
|
|
9856
|
-
LOGICAL_CREATE_MACRO = 131,
|
|
9857
|
-
LOGICAL_DROP = 132,
|
|
9858
|
-
LOGICAL_PRAGMA = 133,
|
|
9859
|
-
LOGICAL_TRANSACTION = 134,
|
|
9860
|
-
LOGICAL_CREATE_TYPE = 135,
|
|
9785
|
+
idx_t maximum_size;
|
|
9786
|
+
data_ptr_t data;
|
|
9861
9787
|
|
|
9862
|
-
|
|
9863
|
-
// Explain
|
|
9864
|
-
// -----------------------------
|
|
9865
|
-
LOGICAL_EXPLAIN = 150,
|
|
9788
|
+
BinaryData blob;
|
|
9866
9789
|
|
|
9867
|
-
|
|
9868
|
-
|
|
9869
|
-
// -----------------------------
|
|
9870
|
-
LOGICAL_SHOW = 160,
|
|
9790
|
+
public:
|
|
9791
|
+
void WriteData(const_data_ptr_t buffer, uint64_t write_size) override;
|
|
9871
9792
|
|
|
9872
|
-
|
|
9873
|
-
|
|
9874
|
-
|
|
9875
|
-
|
|
9876
|
-
LOGICAL_EXECUTE = 176,
|
|
9877
|
-
LOGICAL_EXPORT = 177,
|
|
9878
|
-
LOGICAL_VACUUM = 178,
|
|
9879
|
-
LOGICAL_SET = 179,
|
|
9880
|
-
LOGICAL_LOAD = 180
|
|
9881
|
-
};
|
|
9793
|
+
//! Retrieves the data after the writing has been completed
|
|
9794
|
+
BinaryData GetData() {
|
|
9795
|
+
return std::move(blob);
|
|
9796
|
+
}
|
|
9882
9797
|
|
|
9883
|
-
|
|
9798
|
+
void Reset() {
|
|
9799
|
+
blob.size = 0;
|
|
9800
|
+
}
|
|
9801
|
+
};
|
|
9884
9802
|
|
|
9885
9803
|
} // namespace duckdb
|
|
9886
9804
|
|
|
9805
|
+
#include <type_traits>
|
|
9806
|
+
|
|
9807
|
+
namespace duckdb {
|
|
9808
|
+
class BufferedSerializer;
|
|
9809
|
+
|
|
9810
|
+
struct IndexWriteOperation {
|
|
9811
|
+
template <class SRC, class DST>
|
|
9812
|
+
static DST Operation(SRC input) {
|
|
9813
|
+
return input.index;
|
|
9814
|
+
}
|
|
9815
|
+
};
|
|
9816
|
+
|
|
9817
|
+
class FieldWriter {
|
|
9818
|
+
public:
|
|
9819
|
+
DUCKDB_API FieldWriter(Serializer &serializer);
|
|
9820
|
+
DUCKDB_API ~FieldWriter();
|
|
9821
|
+
|
|
9822
|
+
public:
|
|
9823
|
+
template <class T>
|
|
9824
|
+
void WriteField(const T &element) {
|
|
9825
|
+
static_assert(std::is_trivially_destructible<T>(), "WriteField object must be trivially destructible");
|
|
9826
|
+
|
|
9827
|
+
AddField();
|
|
9828
|
+
WriteData((const_data_ptr_t)&element, sizeof(T));
|
|
9829
|
+
}
|
|
9830
|
+
|
|
9831
|
+
//! Write a string with a length prefix
|
|
9832
|
+
void WriteString(const string &val) {
|
|
9833
|
+
WriteStringLen((const_data_ptr_t)val.c_str(), val.size());
|
|
9834
|
+
}
|
|
9835
|
+
void WriteStringLen(const_data_ptr_t val, idx_t len) {
|
|
9836
|
+
AddField();
|
|
9837
|
+
Write<uint32_t>((uint32_t)len);
|
|
9838
|
+
if (len > 0) {
|
|
9839
|
+
WriteData(val, len);
|
|
9840
|
+
}
|
|
9841
|
+
}
|
|
9842
|
+
void WriteBlob(const_data_ptr_t val, idx_t len) {
|
|
9843
|
+
AddField();
|
|
9844
|
+
if (len > 0) {
|
|
9845
|
+
WriteData(val, len);
|
|
9846
|
+
}
|
|
9847
|
+
}
|
|
9848
|
+
|
|
9849
|
+
template <class T, class CONTAINER_TYPE = vector<T>>
|
|
9850
|
+
void WriteList(const CONTAINER_TYPE &elements) {
|
|
9851
|
+
AddField();
|
|
9852
|
+
Write<uint32_t>(elements.size());
|
|
9853
|
+
for (auto &element : elements) {
|
|
9854
|
+
Write<T>(element);
|
|
9855
|
+
}
|
|
9856
|
+
}
|
|
9857
|
+
|
|
9858
|
+
template <class T, class SRC, class OP, class CONTAINER_TYPE = vector<SRC>>
|
|
9859
|
+
void WriteGenericList(const CONTAINER_TYPE &elements) {
|
|
9860
|
+
AddField();
|
|
9861
|
+
Write<uint32_t>(elements.size());
|
|
9862
|
+
for (auto &element : elements) {
|
|
9863
|
+
Write<T>(OP::template Operation<SRC, T>(element));
|
|
9864
|
+
}
|
|
9865
|
+
}
|
|
9866
|
+
|
|
9867
|
+
template <class T>
|
|
9868
|
+
void WriteIndexList(const vector<T> &elements) {
|
|
9869
|
+
WriteGenericList<idx_t, T, IndexWriteOperation>(elements);
|
|
9870
|
+
}
|
|
9871
|
+
|
|
9872
|
+
// vector<bool> yay
|
|
9873
|
+
template <class T, class CONTAINER_TYPE = vector<T>>
|
|
9874
|
+
void WriteListNoReference(const CONTAINER_TYPE &elements) {
|
|
9875
|
+
AddField();
|
|
9876
|
+
Write<uint32_t>(elements.size());
|
|
9877
|
+
for (auto element : elements) {
|
|
9878
|
+
Write<T>(element);
|
|
9879
|
+
}
|
|
9880
|
+
}
|
|
9881
|
+
|
|
9882
|
+
template <class T>
|
|
9883
|
+
void WriteSerializable(const T &element) {
|
|
9884
|
+
AddField();
|
|
9885
|
+
element.Serialize(*buffer);
|
|
9886
|
+
}
|
|
9887
|
+
|
|
9888
|
+
template <class T>
|
|
9889
|
+
void WriteSerializableList(const vector<unique_ptr<T>> &elements) {
|
|
9890
|
+
AddField();
|
|
9891
|
+
Write<uint32_t>(elements.size());
|
|
9892
|
+
for (idx_t i = 0; i < elements.size(); i++) {
|
|
9893
|
+
elements[i]->Serialize(*buffer);
|
|
9894
|
+
}
|
|
9895
|
+
}
|
|
9896
|
+
|
|
9897
|
+
template <class T>
|
|
9898
|
+
void WriteRegularSerializableList(const vector<T> &elements) {
|
|
9899
|
+
AddField();
|
|
9900
|
+
Write<uint32_t>(elements.size());
|
|
9901
|
+
for (idx_t i = 0; i < elements.size(); i++) {
|
|
9902
|
+
elements[i].Serialize(*buffer);
|
|
9903
|
+
}
|
|
9904
|
+
}
|
|
9905
|
+
|
|
9906
|
+
template <class T>
|
|
9907
|
+
void WriteOptional(const unique_ptr<T> &element) {
|
|
9908
|
+
AddField();
|
|
9909
|
+
Write<bool>(element ? true : false);
|
|
9910
|
+
if (element) {
|
|
9911
|
+
element->Serialize(*buffer);
|
|
9912
|
+
}
|
|
9913
|
+
}
|
|
9914
|
+
|
|
9915
|
+
// Called after all fields have been written. Should always be called.
|
|
9916
|
+
DUCKDB_API void Finalize();
|
|
9917
|
+
|
|
9918
|
+
Serializer &GetSerializer() {
|
|
9919
|
+
return *buffer;
|
|
9920
|
+
}
|
|
9921
|
+
|
|
9922
|
+
private:
|
|
9923
|
+
void AddField() {
|
|
9924
|
+
field_count++;
|
|
9925
|
+
}
|
|
9926
|
+
|
|
9927
|
+
template <class T>
|
|
9928
|
+
void Write(const T &element) {
|
|
9929
|
+
WriteData((const_data_ptr_t)&element, sizeof(T));
|
|
9930
|
+
}
|
|
9931
|
+
|
|
9932
|
+
DUCKDB_API void WriteData(const_data_ptr_t buffer, idx_t write_size);
|
|
9933
|
+
|
|
9934
|
+
private:
|
|
9935
|
+
Serializer &serializer;
|
|
9936
|
+
unique_ptr<BufferedSerializer> buffer;
|
|
9937
|
+
idx_t field_count;
|
|
9938
|
+
bool finalized;
|
|
9939
|
+
};
|
|
9940
|
+
|
|
9941
|
+
template <>
|
|
9942
|
+
DUCKDB_API void FieldWriter::Write(const string &val);
|
|
9943
|
+
|
|
9944
|
+
class FieldDeserializer : public Deserializer {
|
|
9945
|
+
public:
|
|
9946
|
+
FieldDeserializer(Deserializer &root);
|
|
9947
|
+
|
|
9948
|
+
public:
|
|
9949
|
+
void ReadData(data_ptr_t buffer, idx_t read_size) override;
|
|
9950
|
+
|
|
9951
|
+
void SetRemainingData(idx_t remaining_data);
|
|
9952
|
+
idx_t RemainingData();
|
|
9953
|
+
Deserializer &GetRoot() {
|
|
9954
|
+
return root;
|
|
9955
|
+
}
|
|
9956
|
+
|
|
9957
|
+
private:
|
|
9958
|
+
Deserializer &root;
|
|
9959
|
+
idx_t remaining_data;
|
|
9960
|
+
};
|
|
9961
|
+
|
|
9962
|
+
struct IndexReadOperation {
|
|
9963
|
+
template <class SRC, class DST>
|
|
9964
|
+
static DST Operation(SRC input) {
|
|
9965
|
+
return DST(input);
|
|
9966
|
+
}
|
|
9967
|
+
};
|
|
9968
|
+
|
|
9969
|
+
class FieldReader {
|
|
9970
|
+
public:
|
|
9971
|
+
DUCKDB_API FieldReader(Deserializer &source);
|
|
9972
|
+
DUCKDB_API ~FieldReader();
|
|
9973
|
+
|
|
9974
|
+
public:
|
|
9975
|
+
template <class T>
|
|
9976
|
+
T ReadRequired() {
|
|
9977
|
+
if (field_count >= max_field_count) {
|
|
9978
|
+
// field is not there, throw an exception
|
|
9979
|
+
throw SerializationException("Attempting to read a required field, but field is missing");
|
|
9980
|
+
}
|
|
9981
|
+
// field is there, read the actual value
|
|
9982
|
+
AddField();
|
|
9983
|
+
return source.Read<T>();
|
|
9984
|
+
}
|
|
9985
|
+
|
|
9986
|
+
template <class T>
|
|
9987
|
+
T ReadField(T default_value) {
|
|
9988
|
+
if (field_count >= max_field_count) {
|
|
9989
|
+
// field is not there, read the default value
|
|
9990
|
+
return default_value;
|
|
9991
|
+
}
|
|
9992
|
+
// field is there, read the actual value
|
|
9993
|
+
AddField();
|
|
9994
|
+
return source.Read<T>();
|
|
9995
|
+
}
|
|
9996
|
+
|
|
9997
|
+
template <class T, class CONTAINER_TYPE = vector<T>>
|
|
9998
|
+
CONTAINER_TYPE ReadRequiredList() {
|
|
9999
|
+
if (field_count >= max_field_count) {
|
|
10000
|
+
// field is not there, throw an exception
|
|
10001
|
+
throw SerializationException("Attempting to read a required field, but field is missing");
|
|
10002
|
+
}
|
|
10003
|
+
AddField();
|
|
10004
|
+
auto result_count = source.Read<uint32_t>();
|
|
10005
|
+
CONTAINER_TYPE result;
|
|
10006
|
+
result.reserve(result_count);
|
|
10007
|
+
for (idx_t i = 0; i < result_count; i++) {
|
|
10008
|
+
result.push_back(source.Read<T>());
|
|
10009
|
+
}
|
|
10010
|
+
return result;
|
|
10011
|
+
}
|
|
10012
|
+
|
|
10013
|
+
template <class T, class SRC, class OP>
|
|
10014
|
+
vector<T> ReadRequiredGenericList() {
|
|
10015
|
+
if (field_count >= max_field_count) {
|
|
10016
|
+
// field is not there, throw an exception
|
|
10017
|
+
throw SerializationException("Attempting to read a required field, but field is missing");
|
|
10018
|
+
}
|
|
10019
|
+
AddField();
|
|
10020
|
+
auto result_count = source.Read<uint32_t>();
|
|
10021
|
+
vector<T> result;
|
|
10022
|
+
result.reserve(result_count);
|
|
10023
|
+
for (idx_t i = 0; i < result_count; i++) {
|
|
10024
|
+
result.push_back(OP::template Operation<SRC, T>(source.Read<SRC>()));
|
|
10025
|
+
}
|
|
10026
|
+
return result;
|
|
10027
|
+
}
|
|
10028
|
+
|
|
10029
|
+
template <class T>
|
|
10030
|
+
vector<T> ReadRequiredIndexList() {
|
|
10031
|
+
return ReadRequiredGenericList<T, idx_t, IndexReadOperation>();
|
|
10032
|
+
}
|
|
10033
|
+
|
|
10034
|
+
template <class T>
|
|
10035
|
+
set<T> ReadRequiredSet() {
|
|
10036
|
+
if (field_count >= max_field_count) {
|
|
10037
|
+
// field is not there, throw an exception
|
|
10038
|
+
throw SerializationException("Attempting to read a required field, but field is missing");
|
|
10039
|
+
}
|
|
10040
|
+
AddField();
|
|
10041
|
+
auto result_count = source.Read<uint32_t>();
|
|
10042
|
+
set<T> result;
|
|
10043
|
+
for (idx_t i = 0; i < result_count; i++) {
|
|
10044
|
+
result.insert(source.Read<T>());
|
|
10045
|
+
}
|
|
10046
|
+
return result;
|
|
10047
|
+
}
|
|
10048
|
+
|
|
10049
|
+
template <class T, typename... ARGS>
|
|
10050
|
+
unique_ptr<T> ReadOptional(unique_ptr<T> default_value, ARGS &&...args) {
|
|
10051
|
+
if (field_count >= max_field_count) {
|
|
10052
|
+
// field is not there, read the default value
|
|
10053
|
+
return default_value;
|
|
10054
|
+
}
|
|
10055
|
+
// field is there, read the actual value
|
|
10056
|
+
AddField();
|
|
10057
|
+
return source.template ReadOptional<T>(std::forward<ARGS>(args)...);
|
|
10058
|
+
}
|
|
10059
|
+
|
|
10060
|
+
template <class T, class RETURN_TYPE = unique_ptr<T>>
|
|
10061
|
+
RETURN_TYPE ReadSerializable(RETURN_TYPE default_value) {
|
|
10062
|
+
if (field_count >= max_field_count) {
|
|
10063
|
+
// field is not there, read the default value
|
|
10064
|
+
return default_value;
|
|
10065
|
+
}
|
|
10066
|
+
// field is there, read the actual value
|
|
10067
|
+
AddField();
|
|
10068
|
+
return T::Deserialize(source);
|
|
10069
|
+
}
|
|
10070
|
+
|
|
10071
|
+
template <class T, class RETURN_TYPE = unique_ptr<T>, typename... ARGS>
|
|
10072
|
+
RETURN_TYPE ReadSerializable(RETURN_TYPE default_value, ARGS &&...args) {
|
|
10073
|
+
if (field_count >= max_field_count) {
|
|
10074
|
+
// field is not there, read the default value
|
|
10075
|
+
return default_value;
|
|
10076
|
+
}
|
|
10077
|
+
// field is there, read the actual value
|
|
10078
|
+
AddField();
|
|
10079
|
+
return T::Deserialize(source, std::forward<ARGS>(args)...);
|
|
10080
|
+
}
|
|
10081
|
+
|
|
10082
|
+
template <class T, class RETURN_TYPE = unique_ptr<T>>
|
|
10083
|
+
RETURN_TYPE ReadRequiredSerializable() {
|
|
10084
|
+
if (field_count >= max_field_count) {
|
|
10085
|
+
// field is not there, throw an exception
|
|
10086
|
+
throw SerializationException("Attempting to read mandatory field, but field is missing");
|
|
10087
|
+
}
|
|
10088
|
+
// field is there, read the actual value
|
|
10089
|
+
AddField();
|
|
10090
|
+
return T::Deserialize(source);
|
|
10091
|
+
}
|
|
10092
|
+
|
|
10093
|
+
template <class T, class RETURN_TYPE = unique_ptr<T>, typename... ARGS>
|
|
10094
|
+
RETURN_TYPE ReadRequiredSerializable(ARGS &&...args) {
|
|
10095
|
+
if (field_count >= max_field_count) {
|
|
10096
|
+
// field is not there, throw an exception
|
|
10097
|
+
throw SerializationException("Attempting to read mandatory field, but field is missing");
|
|
10098
|
+
}
|
|
10099
|
+
// field is there, read the actual value
|
|
10100
|
+
AddField();
|
|
10101
|
+
return T::Deserialize(source, std::forward<ARGS>(args)...);
|
|
10102
|
+
}
|
|
10103
|
+
|
|
10104
|
+
template <class T, class RETURN_TYPE = unique_ptr<T>, typename... ARGS>
|
|
10105
|
+
vector<RETURN_TYPE> ReadRequiredSerializableList(ARGS &&...args) {
|
|
10106
|
+
if (field_count >= max_field_count) {
|
|
10107
|
+
// field is not there, throw an exception
|
|
10108
|
+
throw SerializationException("Attempting to read mandatory field, but field is missing");
|
|
10109
|
+
}
|
|
10110
|
+
// field is there, read the actual value
|
|
10111
|
+
AddField();
|
|
10112
|
+
auto result_count = source.Read<uint32_t>();
|
|
10113
|
+
|
|
10114
|
+
vector<RETURN_TYPE> result;
|
|
10115
|
+
for (idx_t i = 0; i < result_count; i++) {
|
|
10116
|
+
result.push_back(T::Deserialize(source, std::forward<ARGS>(args)...));
|
|
10117
|
+
}
|
|
10118
|
+
return result;
|
|
10119
|
+
}
|
|
10120
|
+
|
|
10121
|
+
void ReadBlob(data_ptr_t result, idx_t read_size) {
|
|
10122
|
+
if (field_count >= max_field_count) {
|
|
10123
|
+
// field is not there, throw an exception
|
|
10124
|
+
throw SerializationException("Attempting to read a required field, but field is missing");
|
|
10125
|
+
}
|
|
10126
|
+
// field is there, read the actual value
|
|
10127
|
+
AddField();
|
|
10128
|
+
source.ReadData(result, read_size);
|
|
10129
|
+
}
|
|
10130
|
+
|
|
10131
|
+
//! Called after all fields have been read. Should always be called.
|
|
10132
|
+
DUCKDB_API void Finalize();
|
|
10133
|
+
|
|
10134
|
+
Deserializer &GetSource() {
|
|
10135
|
+
return source;
|
|
10136
|
+
}
|
|
10137
|
+
|
|
10138
|
+
private:
|
|
10139
|
+
void AddField() {
|
|
10140
|
+
field_count++;
|
|
10141
|
+
}
|
|
10142
|
+
|
|
10143
|
+
private:
|
|
10144
|
+
FieldDeserializer source;
|
|
10145
|
+
idx_t field_count;
|
|
10146
|
+
idx_t max_field_count;
|
|
10147
|
+
idx_t total_size;
|
|
10148
|
+
bool finalized;
|
|
10149
|
+
};
|
|
10150
|
+
|
|
10151
|
+
} // namespace duckdb
|
|
10152
|
+
|
|
10153
|
+
|
|
10154
|
+
namespace duckdb {
|
|
10155
|
+
|
|
10156
|
+
//! A set of column definitions
|
|
10157
|
+
class ColumnList {
|
|
10158
|
+
public:
|
|
10159
|
+
class ColumnListIterator;
|
|
10160
|
+
|
|
10161
|
+
public:
|
|
10162
|
+
ColumnList(bool allow_duplicate_names = false);
|
|
10163
|
+
|
|
10164
|
+
DUCKDB_API void AddColumn(ColumnDefinition column);
|
|
10165
|
+
void Finalize();
|
|
10166
|
+
|
|
10167
|
+
DUCKDB_API const ColumnDefinition &GetColumn(LogicalIndex index) const;
|
|
10168
|
+
DUCKDB_API const ColumnDefinition &GetColumn(PhysicalIndex index) const;
|
|
10169
|
+
DUCKDB_API const ColumnDefinition &GetColumn(const string &name) const;
|
|
10170
|
+
DUCKDB_API ColumnDefinition &GetColumnMutable(LogicalIndex index);
|
|
10171
|
+
DUCKDB_API ColumnDefinition &GetColumnMutable(PhysicalIndex index);
|
|
10172
|
+
DUCKDB_API ColumnDefinition &GetColumnMutable(const string &name);
|
|
10173
|
+
|
|
10174
|
+
DUCKDB_API bool ColumnExists(const string &name) const;
|
|
10175
|
+
|
|
10176
|
+
DUCKDB_API LogicalIndex GetColumnIndex(string &column_name) const;
|
|
10177
|
+
DUCKDB_API PhysicalIndex LogicalToPhysical(LogicalIndex index) const;
|
|
10178
|
+
DUCKDB_API LogicalIndex PhysicalToLogical(PhysicalIndex index) const;
|
|
10179
|
+
|
|
10180
|
+
idx_t LogicalColumnCount() const {
|
|
10181
|
+
return columns.size();
|
|
10182
|
+
}
|
|
10183
|
+
idx_t PhysicalColumnCount() const {
|
|
10184
|
+
return physical_columns.size();
|
|
10185
|
+
}
|
|
10186
|
+
bool empty() const {
|
|
10187
|
+
return columns.empty();
|
|
10188
|
+
}
|
|
10189
|
+
|
|
10190
|
+
ColumnList Copy() const;
|
|
10191
|
+
void Serialize(FieldWriter &writer) const;
|
|
10192
|
+
static ColumnList Deserialize(FieldReader &reader);
|
|
10193
|
+
|
|
10194
|
+
DUCKDB_API ColumnListIterator Logical() const;
|
|
10195
|
+
DUCKDB_API ColumnListIterator Physical() const;
|
|
10196
|
+
|
|
10197
|
+
void SetAllowDuplicates(bool allow_duplicates) {
|
|
10198
|
+
allow_duplicate_names = allow_duplicates;
|
|
10199
|
+
}
|
|
10200
|
+
|
|
10201
|
+
private:
|
|
10202
|
+
vector<ColumnDefinition> columns;
|
|
10203
|
+
//! A map of column name to column index
|
|
10204
|
+
case_insensitive_map_t<column_t> name_map;
|
|
10205
|
+
//! The set of physical columns
|
|
10206
|
+
vector<idx_t> physical_columns;
|
|
10207
|
+
//! Allow duplicate names or not
|
|
10208
|
+
bool allow_duplicate_names;
|
|
10209
|
+
|
|
10210
|
+
private:
|
|
10211
|
+
void AddToNameMap(ColumnDefinition &column);
|
|
10212
|
+
|
|
10213
|
+
public:
|
|
10214
|
+
// logical iterator
|
|
10215
|
+
class ColumnListIterator {
|
|
10216
|
+
public:
|
|
10217
|
+
DUCKDB_API ColumnListIterator(const ColumnList &list, bool physical) : list(list), physical(physical) {
|
|
10218
|
+
}
|
|
10219
|
+
|
|
10220
|
+
private:
|
|
10221
|
+
const ColumnList &list;
|
|
10222
|
+
bool physical;
|
|
10223
|
+
|
|
10224
|
+
private:
|
|
10225
|
+
class ColumnLogicalIteratorInternal {
|
|
10226
|
+
public:
|
|
10227
|
+
DUCKDB_API ColumnLogicalIteratorInternal(const ColumnList &list, bool physical, idx_t pos, idx_t end)
|
|
10228
|
+
: list(list), physical(physical), pos(pos), end(end) {
|
|
10229
|
+
}
|
|
10230
|
+
|
|
10231
|
+
const ColumnList &list;
|
|
10232
|
+
bool physical;
|
|
10233
|
+
idx_t pos;
|
|
10234
|
+
idx_t end;
|
|
10235
|
+
|
|
10236
|
+
public:
|
|
10237
|
+
DUCKDB_API ColumnLogicalIteratorInternal &operator++() {
|
|
10238
|
+
pos++;
|
|
10239
|
+
return *this;
|
|
10240
|
+
}
|
|
10241
|
+
DUCKDB_API bool operator!=(const ColumnLogicalIteratorInternal &other) const {
|
|
10242
|
+
return pos != other.pos || end != other.end || &list != &other.list;
|
|
10243
|
+
}
|
|
10244
|
+
DUCKDB_API const ColumnDefinition &operator*() const {
|
|
10245
|
+
if (physical) {
|
|
10246
|
+
return list.GetColumn(PhysicalIndex(pos));
|
|
10247
|
+
} else {
|
|
10248
|
+
return list.GetColumn(LogicalIndex(pos));
|
|
10249
|
+
}
|
|
10250
|
+
}
|
|
10251
|
+
};
|
|
10252
|
+
|
|
10253
|
+
public:
|
|
10254
|
+
idx_t Size() {
|
|
10255
|
+
return physical ? list.PhysicalColumnCount() : list.LogicalColumnCount();
|
|
10256
|
+
}
|
|
10257
|
+
|
|
10258
|
+
DUCKDB_API ColumnLogicalIteratorInternal begin() {
|
|
10259
|
+
return ColumnLogicalIteratorInternal(list, physical, 0, Size());
|
|
10260
|
+
}
|
|
10261
|
+
DUCKDB_API ColumnLogicalIteratorInternal end() {
|
|
10262
|
+
return ColumnLogicalIteratorInternal(list, physical, Size(), Size());
|
|
10263
|
+
}
|
|
10264
|
+
};
|
|
10265
|
+
};
|
|
10266
|
+
|
|
10267
|
+
} // namespace duckdb
|
|
10268
|
+
|
|
10269
|
+
//===----------------------------------------------------------------------===//
|
|
10270
|
+
// DuckDB
|
|
10271
|
+
//
|
|
10272
|
+
// duckdb/parser/constraint.hpp
|
|
10273
|
+
//
|
|
10274
|
+
//
|
|
10275
|
+
//===----------------------------------------------------------------------===//
|
|
10276
|
+
|
|
10277
|
+
|
|
10278
|
+
|
|
10279
|
+
|
|
10280
|
+
|
|
10281
|
+
|
|
10282
|
+
namespace duckdb {
|
|
10283
|
+
|
|
10284
|
+
class Serializer;
|
|
10285
|
+
class Deserializer;
|
|
10286
|
+
class FieldWriter;
|
|
10287
|
+
class FieldReader;
|
|
10288
|
+
|
|
10289
|
+
//===--------------------------------------------------------------------===//
|
|
10290
|
+
// Constraint Types
|
|
10291
|
+
//===--------------------------------------------------------------------===//
|
|
10292
|
+
enum class ConstraintType : uint8_t {
|
|
10293
|
+
INVALID = 0, // invalid constraint type
|
|
10294
|
+
NOT_NULL = 1, // NOT NULL constraint
|
|
10295
|
+
CHECK = 2, // CHECK constraint
|
|
10296
|
+
UNIQUE = 3, // UNIQUE constraint
|
|
10297
|
+
FOREIGN_KEY = 4, // FOREIGN KEY constraint
|
|
10298
|
+
};
|
|
10299
|
+
|
|
10300
|
+
enum class ForeignKeyType : uint8_t {
|
|
10301
|
+
FK_TYPE_PRIMARY_KEY_TABLE = 0, // main table
|
|
10302
|
+
FK_TYPE_FOREIGN_KEY_TABLE = 1, // referencing table
|
|
10303
|
+
FK_TYPE_SELF_REFERENCE_TABLE = 2 // self refrencing table
|
|
10304
|
+
};
|
|
10305
|
+
|
|
10306
|
+
struct ForeignKeyInfo {
|
|
10307
|
+
ForeignKeyType type;
|
|
10308
|
+
string schema;
|
|
10309
|
+
//! if type is FK_TYPE_FOREIGN_KEY_TABLE, means main key table, if type is FK_TYPE_PRIMARY_KEY_TABLE, means foreign
|
|
10310
|
+
//! key table
|
|
10311
|
+
string table;
|
|
10312
|
+
//! The set of main key table's column's index
|
|
10313
|
+
vector<PhysicalIndex> pk_keys;
|
|
10314
|
+
//! The set of foreign key table's column's index
|
|
10315
|
+
vector<PhysicalIndex> fk_keys;
|
|
10316
|
+
};
|
|
10317
|
+
|
|
10318
|
+
//! Constraint is the base class of any type of table constraint.
|
|
10319
|
+
class Constraint {
|
|
10320
|
+
public:
|
|
10321
|
+
DUCKDB_API explicit Constraint(ConstraintType type);
|
|
10322
|
+
DUCKDB_API virtual ~Constraint();
|
|
10323
|
+
|
|
10324
|
+
ConstraintType type;
|
|
10325
|
+
|
|
10326
|
+
public:
|
|
10327
|
+
DUCKDB_API virtual string ToString() const = 0;
|
|
10328
|
+
DUCKDB_API void Print() const;
|
|
10329
|
+
|
|
10330
|
+
DUCKDB_API virtual unique_ptr<Constraint> Copy() const = 0;
|
|
10331
|
+
//! Serializes a Constraint to a stand-alone binary blob
|
|
10332
|
+
DUCKDB_API void Serialize(Serializer &serializer) const;
|
|
10333
|
+
//! Serializes a Constraint to a stand-alone binary blob
|
|
10334
|
+
DUCKDB_API virtual void Serialize(FieldWriter &writer) const = 0;
|
|
10335
|
+
//! Deserializes a blob back into a Constraint
|
|
10336
|
+
DUCKDB_API static unique_ptr<Constraint> Deserialize(Deserializer &source);
|
|
10337
|
+
};
|
|
10338
|
+
} // namespace duckdb
|
|
10339
|
+
|
|
10340
|
+
//===----------------------------------------------------------------------===//
|
|
10341
|
+
// DuckDB
|
|
10342
|
+
//
|
|
10343
|
+
// duckdb/planner/bound_constraint.hpp
|
|
10344
|
+
//
|
|
10345
|
+
//
|
|
10346
|
+
//===----------------------------------------------------------------------===//
|
|
10347
|
+
|
|
10348
|
+
|
|
10349
|
+
|
|
10350
|
+
|
|
10351
|
+
|
|
10352
|
+
|
|
10353
|
+
|
|
10354
|
+
namespace duckdb {
|
|
10355
|
+
//! Bound equivalent of Constraint
|
|
10356
|
+
class BoundConstraint {
|
|
10357
|
+
public:
|
|
10358
|
+
explicit BoundConstraint(ConstraintType type) : type(type) {};
|
|
10359
|
+
virtual ~BoundConstraint() {
|
|
10360
|
+
}
|
|
10361
|
+
|
|
10362
|
+
void Serialize(Serializer &serializer) const {
|
|
10363
|
+
serializer.Write(type);
|
|
10364
|
+
}
|
|
10365
|
+
|
|
10366
|
+
static unique_ptr<BoundConstraint> Deserialize(Deserializer &source) {
|
|
10367
|
+
return make_unique<BoundConstraint>(source.Read<ConstraintType>());
|
|
10368
|
+
}
|
|
10369
|
+
|
|
10370
|
+
ConstraintType type;
|
|
10371
|
+
};
|
|
10372
|
+
} // namespace duckdb
|
|
10373
|
+
|
|
10374
|
+
//===----------------------------------------------------------------------===//
|
|
10375
|
+
// DuckDB
|
|
10376
|
+
//
|
|
10377
|
+
// duckdb/planner/expression.hpp
|
|
10378
|
+
//
|
|
10379
|
+
//
|
|
10380
|
+
//===----------------------------------------------------------------------===//
|
|
10381
|
+
|
|
10382
|
+
|
|
10383
|
+
|
|
10384
|
+
|
|
10385
|
+
|
|
10386
|
+
//===----------------------------------------------------------------------===//
|
|
10387
|
+
// DuckDB
|
|
10388
|
+
//
|
|
10389
|
+
// duckdb/planner/plan_serialization.hpp
|
|
10390
|
+
//
|
|
10391
|
+
//
|
|
10392
|
+
//===----------------------------------------------------------------------===//
|
|
10393
|
+
|
|
10394
|
+
|
|
10395
|
+
|
|
10396
|
+
//===----------------------------------------------------------------------===//
|
|
10397
|
+
// DuckDB
|
|
10398
|
+
//
|
|
10399
|
+
// duckdb/common/enums/logical_operator_type.hpp
|
|
10400
|
+
//
|
|
10401
|
+
//
|
|
10402
|
+
//===----------------------------------------------------------------------===//
|
|
10403
|
+
|
|
10404
|
+
|
|
10405
|
+
|
|
10406
|
+
|
|
10407
|
+
|
|
10408
|
+
namespace duckdb {
|
|
10409
|
+
|
|
10410
|
+
//===--------------------------------------------------------------------===//
|
|
10411
|
+
// Logical Operator Types
|
|
10412
|
+
//===--------------------------------------------------------------------===//
|
|
10413
|
+
enum class LogicalOperatorType : uint8_t {
|
|
10414
|
+
LOGICAL_INVALID = 0,
|
|
10415
|
+
LOGICAL_PROJECTION = 1,
|
|
10416
|
+
LOGICAL_FILTER = 2,
|
|
10417
|
+
LOGICAL_AGGREGATE_AND_GROUP_BY = 3,
|
|
10418
|
+
LOGICAL_WINDOW = 4,
|
|
10419
|
+
LOGICAL_UNNEST = 5,
|
|
10420
|
+
LOGICAL_LIMIT = 6,
|
|
10421
|
+
LOGICAL_ORDER_BY = 7,
|
|
10422
|
+
LOGICAL_TOP_N = 8,
|
|
10423
|
+
LOGICAL_COPY_TO_FILE = 10,
|
|
10424
|
+
LOGICAL_DISTINCT = 11,
|
|
10425
|
+
LOGICAL_SAMPLE = 12,
|
|
10426
|
+
LOGICAL_LIMIT_PERCENT = 13,
|
|
10427
|
+
|
|
10428
|
+
// -----------------------------
|
|
10429
|
+
// Data sources
|
|
10430
|
+
// -----------------------------
|
|
10431
|
+
LOGICAL_GET = 25,
|
|
10432
|
+
LOGICAL_CHUNK_GET = 26,
|
|
10433
|
+
LOGICAL_DELIM_GET = 27,
|
|
10434
|
+
LOGICAL_EXPRESSION_GET = 28,
|
|
10435
|
+
LOGICAL_DUMMY_SCAN = 29,
|
|
10436
|
+
LOGICAL_EMPTY_RESULT = 30,
|
|
10437
|
+
LOGICAL_CTE_REF = 31,
|
|
10438
|
+
// -----------------------------
|
|
10439
|
+
// Joins
|
|
10440
|
+
// -----------------------------
|
|
10441
|
+
LOGICAL_JOIN = 50,
|
|
10442
|
+
LOGICAL_DELIM_JOIN = 51,
|
|
10443
|
+
LOGICAL_COMPARISON_JOIN = 52,
|
|
10444
|
+
LOGICAL_ANY_JOIN = 53,
|
|
10445
|
+
LOGICAL_CROSS_PRODUCT = 54,
|
|
10446
|
+
// -----------------------------
|
|
10447
|
+
// SetOps
|
|
10448
|
+
// -----------------------------
|
|
10449
|
+
LOGICAL_UNION = 75,
|
|
10450
|
+
LOGICAL_EXCEPT = 76,
|
|
10451
|
+
LOGICAL_INTERSECT = 77,
|
|
10452
|
+
LOGICAL_RECURSIVE_CTE = 78,
|
|
10453
|
+
|
|
10454
|
+
// -----------------------------
|
|
10455
|
+
// Updates
|
|
10456
|
+
// -----------------------------
|
|
10457
|
+
LOGICAL_INSERT = 100,
|
|
10458
|
+
LOGICAL_DELETE = 101,
|
|
10459
|
+
LOGICAL_UPDATE = 102,
|
|
10460
|
+
|
|
10461
|
+
// -----------------------------
|
|
10462
|
+
// Schema
|
|
10463
|
+
// -----------------------------
|
|
10464
|
+
LOGICAL_ALTER = 125,
|
|
10465
|
+
LOGICAL_CREATE_TABLE = 126,
|
|
10466
|
+
LOGICAL_CREATE_INDEX = 127,
|
|
10467
|
+
LOGICAL_CREATE_SEQUENCE = 128,
|
|
10468
|
+
LOGICAL_CREATE_VIEW = 129,
|
|
10469
|
+
LOGICAL_CREATE_SCHEMA = 130,
|
|
10470
|
+
LOGICAL_CREATE_MACRO = 131,
|
|
10471
|
+
LOGICAL_DROP = 132,
|
|
10472
|
+
LOGICAL_PRAGMA = 133,
|
|
10473
|
+
LOGICAL_TRANSACTION = 134,
|
|
10474
|
+
LOGICAL_CREATE_TYPE = 135,
|
|
10475
|
+
|
|
10476
|
+
// -----------------------------
|
|
10477
|
+
// Explain
|
|
10478
|
+
// -----------------------------
|
|
10479
|
+
LOGICAL_EXPLAIN = 150,
|
|
10480
|
+
|
|
10481
|
+
// -----------------------------
|
|
10482
|
+
// Show
|
|
10483
|
+
// -----------------------------
|
|
10484
|
+
LOGICAL_SHOW = 160,
|
|
10485
|
+
|
|
10486
|
+
// -----------------------------
|
|
10487
|
+
// Helpers
|
|
10488
|
+
// -----------------------------
|
|
10489
|
+
LOGICAL_PREPARE = 175,
|
|
10490
|
+
LOGICAL_EXECUTE = 176,
|
|
10491
|
+
LOGICAL_EXPORT = 177,
|
|
10492
|
+
LOGICAL_VACUUM = 178,
|
|
10493
|
+
LOGICAL_SET = 179,
|
|
10494
|
+
LOGICAL_LOAD = 180
|
|
10495
|
+
};
|
|
10496
|
+
|
|
10497
|
+
DUCKDB_API string LogicalOperatorToString(LogicalOperatorType type);
|
|
10498
|
+
|
|
10499
|
+
} // namespace duckdb
|
|
10500
|
+
|
|
10501
|
+
|
|
10502
|
+
//===----------------------------------------------------------------------===//
|
|
10503
|
+
// DuckDB
|
|
10504
|
+
//
|
|
10505
|
+
// duckdb/planner/bound_parameter_map.hpp
|
|
10506
|
+
//
|
|
10507
|
+
//
|
|
10508
|
+
//===----------------------------------------------------------------------===//
|
|
9887
10509
|
|
|
9888
|
-
//===----------------------------------------------------------------------===//
|
|
9889
|
-
// DuckDB
|
|
9890
|
-
//
|
|
9891
|
-
// duckdb/planner/bound_parameter_map.hpp
|
|
9892
|
-
//
|
|
9893
|
-
//
|
|
9894
|
-
//===----------------------------------------------------------------------===//
|
|
9895
|
-
|
|
9896
10510
|
|
|
9897
10511
|
|
|
9898
10512
|
|
|
@@ -10018,37 +10632,62 @@ protected:
|
|
|
10018
10632
|
|
|
10019
10633
|
|
|
10020
10634
|
|
|
10635
|
+
|
|
10021
10636
|
//===----------------------------------------------------------------------===//
|
|
10022
10637
|
// DuckDB
|
|
10023
10638
|
//
|
|
10024
|
-
// duckdb/common/
|
|
10639
|
+
// duckdb/common/stack.hpp
|
|
10025
10640
|
//
|
|
10026
10641
|
//
|
|
10027
10642
|
//===----------------------------------------------------------------------===//
|
|
10028
10643
|
|
|
10029
10644
|
|
|
10030
10645
|
|
|
10031
|
-
#include <
|
|
10646
|
+
#include <stack>
|
|
10032
10647
|
|
|
10033
10648
|
namespace duckdb {
|
|
10034
|
-
using std::
|
|
10649
|
+
using std::stack;
|
|
10035
10650
|
}
|
|
10036
10651
|
|
|
10037
10652
|
//===----------------------------------------------------------------------===//
|
|
10038
10653
|
// DuckDB
|
|
10039
10654
|
//
|
|
10040
|
-
// duckdb/common/
|
|
10655
|
+
// duckdb/common/index_map.hpp
|
|
10041
10656
|
//
|
|
10042
10657
|
//
|
|
10043
10658
|
//===----------------------------------------------------------------------===//
|
|
10044
10659
|
|
|
10045
10660
|
|
|
10046
10661
|
|
|
10047
|
-
|
|
10662
|
+
|
|
10663
|
+
|
|
10664
|
+
|
|
10048
10665
|
|
|
10049
10666
|
namespace duckdb {
|
|
10050
|
-
|
|
10051
|
-
|
|
10667
|
+
|
|
10668
|
+
struct LogicalIndexHashFunction {
|
|
10669
|
+
uint64_t operator()(const LogicalIndex &index) const {
|
|
10670
|
+
return std::hash<idx_t>()(index.index);
|
|
10671
|
+
}
|
|
10672
|
+
};
|
|
10673
|
+
|
|
10674
|
+
struct PhysicalIndexHashFunction {
|
|
10675
|
+
uint64_t operator()(const PhysicalIndex &index) const {
|
|
10676
|
+
return std::hash<idx_t>()(index.index);
|
|
10677
|
+
}
|
|
10678
|
+
};
|
|
10679
|
+
|
|
10680
|
+
template <typename T>
|
|
10681
|
+
using logical_index_map_t = unordered_map<LogicalIndex, T, LogicalIndexHashFunction>;
|
|
10682
|
+
|
|
10683
|
+
using logical_index_set_t = unordered_set<LogicalIndex, LogicalIndexHashFunction>;
|
|
10684
|
+
|
|
10685
|
+
template <typename T>
|
|
10686
|
+
using physical_index_map_t = unordered_map<PhysicalIndex, T, PhysicalIndexHashFunction>;
|
|
10687
|
+
|
|
10688
|
+
using physical_index_set_t = unordered_set<PhysicalIndex, PhysicalIndexHashFunction>;
|
|
10689
|
+
|
|
10690
|
+
} // namespace duckdb
|
|
10052
10691
|
|
|
10053
10692
|
|
|
10054
10693
|
namespace duckdb {
|
|
@@ -10064,39 +10703,39 @@ public:
|
|
|
10064
10703
|
|
|
10065
10704
|
public:
|
|
10066
10705
|
//! Get the bind order that ensures dependencies are resolved before dependents are
|
|
10067
|
-
stack<
|
|
10706
|
+
stack<LogicalIndex> GetBindOrder(const ColumnList &columns);
|
|
10068
10707
|
|
|
10069
10708
|
//! Adds a connection between the dependent and its dependencies
|
|
10070
|
-
void AddGeneratedColumn(
|
|
10709
|
+
void AddGeneratedColumn(LogicalIndex index, const vector<LogicalIndex> &indices, bool root = true);
|
|
10071
10710
|
//! Add a generated column from a column definition
|
|
10072
|
-
void AddGeneratedColumn(const ColumnDefinition &column, const
|
|
10711
|
+
void AddGeneratedColumn(const ColumnDefinition &column, const ColumnList &list);
|
|
10073
10712
|
|
|
10074
10713
|
//! Removes the column(s) and outputs the new column indices
|
|
10075
|
-
vector<
|
|
10714
|
+
vector<LogicalIndex> RemoveColumn(LogicalIndex index, idx_t column_amount);
|
|
10076
10715
|
|
|
10077
|
-
bool IsDependencyOf(
|
|
10078
|
-
bool HasDependencies(
|
|
10079
|
-
const
|
|
10716
|
+
bool IsDependencyOf(LogicalIndex dependent, LogicalIndex dependency) const;
|
|
10717
|
+
bool HasDependencies(LogicalIndex index) const;
|
|
10718
|
+
const logical_index_set_t &GetDependencies(LogicalIndex index) const;
|
|
10080
10719
|
|
|
10081
|
-
bool HasDependents(
|
|
10082
|
-
const
|
|
10720
|
+
bool HasDependents(LogicalIndex index) const;
|
|
10721
|
+
const logical_index_set_t &GetDependents(LogicalIndex index) const;
|
|
10083
10722
|
|
|
10084
10723
|
private:
|
|
10085
|
-
void RemoveStandardColumn(
|
|
10086
|
-
void RemoveGeneratedColumn(
|
|
10724
|
+
void RemoveStandardColumn(LogicalIndex index);
|
|
10725
|
+
void RemoveGeneratedColumn(LogicalIndex index);
|
|
10087
10726
|
|
|
10088
|
-
void AdjustSingle(
|
|
10727
|
+
void AdjustSingle(LogicalIndex idx, idx_t offset);
|
|
10089
10728
|
// Clean up the gaps created by a Remove operation
|
|
10090
|
-
vector<
|
|
10729
|
+
vector<LogicalIndex> CleanupInternals(idx_t column_amount);
|
|
10091
10730
|
|
|
10092
10731
|
private:
|
|
10093
10732
|
//! A map of column dependency to generated column(s)
|
|
10094
|
-
|
|
10733
|
+
logical_index_map_t<logical_index_set_t> dependencies_map;
|
|
10095
10734
|
//! A map of generated column name to (potentially generated)column dependencies
|
|
10096
|
-
|
|
10735
|
+
logical_index_map_t<logical_index_set_t> dependents_map;
|
|
10097
10736
|
//! For resolve-order purposes, keep track of the 'direct' (not inherited) dependencies of a generated column
|
|
10098
|
-
|
|
10099
|
-
|
|
10737
|
+
logical_index_map_t<logical_index_set_t> direct_dependencies;
|
|
10738
|
+
logical_index_set_t deleted_columns;
|
|
10100
10739
|
};
|
|
10101
10740
|
|
|
10102
10741
|
} // namespace duckdb
|
|
@@ -10127,19 +10766,15 @@ public:
|
|
|
10127
10766
|
//! A reference to the underlying storage unit used for this table
|
|
10128
10767
|
std::shared_ptr<DataTable> storage;
|
|
10129
10768
|
//! A list of columns that are part of this table
|
|
10130
|
-
|
|
10769
|
+
ColumnList columns;
|
|
10131
10770
|
//! A list of constraints that are part of this table
|
|
10132
10771
|
vector<unique_ptr<Constraint>> constraints;
|
|
10133
10772
|
//! A list of constraints that are part of this table
|
|
10134
10773
|
vector<unique_ptr<BoundConstraint>> bound_constraints;
|
|
10135
10774
|
ColumnDependencyManager column_dependency_manager;
|
|
10136
|
-
//! A map of column name to column index
|
|
10137
|
-
case_insensitive_map_t<column_t> name_map;
|
|
10138
10775
|
|
|
10139
10776
|
public:
|
|
10140
10777
|
bool HasGeneratedColumns() const;
|
|
10141
|
-
//! For debugging purposes, count how many columns are STANDARD
|
|
10142
|
-
idx_t StandardColumnCount() const;
|
|
10143
10778
|
unique_ptr<CatalogEntry> AlterEntry(ClientContext &context, AlterInfo *info) override;
|
|
10144
10779
|
//! Returns whether or not a column with the given name exists
|
|
10145
10780
|
DUCKDB_API bool ColumnExists(const string &name);
|
|
@@ -10169,10 +10804,9 @@ public:
|
|
|
10169
10804
|
//! If the column does not exist:
|
|
10170
10805
|
//! If if_column_exists is true, returns DConstants::INVALID_INDEX
|
|
10171
10806
|
//! If if_column_exists is false, throws an exception
|
|
10172
|
-
|
|
10807
|
+
LogicalIndex GetColumnIndex(string &name, bool if_exists = false);
|
|
10173
10808
|
|
|
10174
10809
|
private:
|
|
10175
|
-
const string &GetColumnName(column_t index);
|
|
10176
10810
|
unique_ptr<CatalogEntry> RenameColumn(ClientContext &context, RenameColumnInfo &info);
|
|
10177
10811
|
unique_ptr<CatalogEntry> AddColumn(ClientContext &context, AddColumnInfo &info);
|
|
10178
10812
|
unique_ptr<CatalogEntry> RemoveColumn(ClientContext &context, RemoveColumnInfo &info);
|
|
@@ -13108,6 +13742,8 @@ private:
|
|
|
13108
13742
|
DatabaseInstance &db;
|
|
13109
13743
|
//! The task queue
|
|
13110
13744
|
unique_ptr<ConcurrentQueue> queue;
|
|
13745
|
+
//! Lock for modifying the thread count
|
|
13746
|
+
mutex thread_lock;
|
|
13111
13747
|
//! The active background threads of the task scheduler
|
|
13112
13748
|
vector<unique_ptr<SchedulerThread>> threads;
|
|
13113
13749
|
//! Markers used by the various threads, if the markers are set to "false" the thread execution is stopped
|
|
@@ -13643,441 +14279,81 @@ string RelationTypeToString(RelationType type);
|
|
|
13643
14279
|
|
|
13644
14280
|
|
|
13645
14281
|
|
|
13646
|
-
//===----------------------------------------------------------------------===//
|
|
13647
|
-
// DuckDB
|
|
13648
|
-
//
|
|
13649
|
-
// duckdb/catalog/default/default_generator.hpp
|
|
13650
|
-
//
|
|
13651
|
-
//
|
|
13652
|
-
//===----------------------------------------------------------------------===//
|
|
13653
|
-
|
|
13654
|
-
|
|
13655
|
-
|
|
13656
|
-
|
|
13657
|
-
|
|
13658
|
-
|
|
13659
|
-
namespace duckdb {
|
|
13660
|
-
class ClientContext;
|
|
13661
|
-
|
|
13662
|
-
class DefaultGenerator {
|
|
13663
|
-
public:
|
|
13664
|
-
explicit DefaultGenerator(Catalog &catalog) : catalog(catalog), created_all_entries(false) {
|
|
13665
|
-
}
|
|
13666
|
-
virtual ~DefaultGenerator() {
|
|
13667
|
-
}
|
|
13668
|
-
|
|
13669
|
-
Catalog &catalog;
|
|
13670
|
-
atomic<bool> created_all_entries;
|
|
13671
|
-
|
|
13672
|
-
public:
|
|
13673
|
-
//! Creates a default entry with the specified name, or returns nullptr if no such entry can be generated
|
|
13674
|
-
virtual unique_ptr<CatalogEntry> CreateDefaultEntry(ClientContext &context, const string &entry_name) = 0;
|
|
13675
|
-
//! Get a list of all default entries in the generator
|
|
13676
|
-
virtual vector<string> GetDefaultEntries() = 0;
|
|
13677
|
-
};
|
|
13678
|
-
|
|
13679
|
-
} // namespace duckdb
|
|
13680
|
-
|
|
13681
|
-
|
|
13682
|
-
|
|
13683
|
-
|
|
13684
|
-
|
|
13685
|
-
|
|
13686
|
-
|
|
13687
|
-
|
|
13688
|
-
//===----------------------------------------------------------------------===//
|
|
13689
|
-
// DuckDB
|
|
13690
|
-
//
|
|
13691
|
-
// duckdb/catalog/catalog_entry/sequence_catalog_entry.hpp
|
|
13692
|
-
//
|
|
13693
|
-
//
|
|
13694
|
-
//===----------------------------------------------------------------------===//
|
|
13695
|
-
|
|
13696
|
-
|
|
13697
|
-
|
|
13698
|
-
|
|
13699
|
-
|
|
13700
|
-
//===----------------------------------------------------------------------===//
|
|
13701
|
-
// DuckDB
|
|
13702
|
-
//
|
|
13703
|
-
// duckdb/parser/parsed_data/create_sequence_info.hpp
|
|
13704
|
-
//
|
|
13705
|
-
//
|
|
13706
|
-
//===----------------------------------------------------------------------===//
|
|
13707
|
-
|
|
13708
|
-
|
|
13709
|
-
|
|
13710
|
-
//===----------------------------------------------------------------------===//
|
|
13711
|
-
// DuckDB
|
|
13712
|
-
//
|
|
13713
|
-
// duckdb/parser/parsed_data/create_info.hpp
|
|
13714
|
-
//
|
|
13715
|
-
//
|
|
13716
|
-
//===----------------------------------------------------------------------===//
|
|
13717
|
-
|
|
13718
|
-
|
|
13719
|
-
|
|
13720
|
-
|
|
13721
|
-
//===----------------------------------------------------------------------===//
|
|
13722
|
-
// DuckDB
|
|
13723
|
-
//
|
|
13724
|
-
// duckdb/common/field_writer.hpp
|
|
13725
|
-
//
|
|
13726
|
-
//
|
|
13727
|
-
//===----------------------------------------------------------------------===//
|
|
13728
|
-
|
|
13729
|
-
|
|
13730
|
-
|
|
13731
|
-
|
|
13732
|
-
|
|
13733
|
-
//===----------------------------------------------------------------------===//
|
|
13734
|
-
// DuckDB
|
|
13735
|
-
//
|
|
13736
|
-
// duckdb/common/serializer/buffered_serializer.hpp
|
|
13737
|
-
//
|
|
13738
|
-
//
|
|
13739
|
-
//===----------------------------------------------------------------------===//
|
|
13740
|
-
|
|
13741
|
-
|
|
13742
|
-
|
|
13743
|
-
|
|
13744
|
-
|
|
13745
|
-
namespace duckdb {
|
|
13746
|
-
|
|
13747
|
-
#define SERIALIZER_DEFAULT_SIZE 1024
|
|
13748
|
-
|
|
13749
|
-
struct BinaryData {
|
|
13750
|
-
unique_ptr<data_t[]> data;
|
|
13751
|
-
idx_t size;
|
|
13752
|
-
};
|
|
13753
|
-
|
|
13754
|
-
class BufferedSerializer : public Serializer {
|
|
13755
|
-
public:
|
|
13756
|
-
//! Serializes to a buffer allocated by the serializer, will expand when
|
|
13757
|
-
//! writing past the initial threshold
|
|
13758
|
-
DUCKDB_API explicit BufferedSerializer(idx_t maximum_size = SERIALIZER_DEFAULT_SIZE);
|
|
13759
|
-
//! Serializes to a provided (owned) data pointer
|
|
13760
|
-
BufferedSerializer(unique_ptr<data_t[]> data, idx_t size);
|
|
13761
|
-
BufferedSerializer(data_ptr_t data, idx_t size);
|
|
13762
|
-
|
|
13763
|
-
idx_t maximum_size;
|
|
13764
|
-
data_ptr_t data;
|
|
13765
|
-
|
|
13766
|
-
BinaryData blob;
|
|
13767
|
-
|
|
13768
|
-
public:
|
|
13769
|
-
void WriteData(const_data_ptr_t buffer, uint64_t write_size) override;
|
|
13770
|
-
|
|
13771
|
-
//! Retrieves the data after the writing has been completed
|
|
13772
|
-
BinaryData GetData() {
|
|
13773
|
-
return std::move(blob);
|
|
13774
|
-
}
|
|
13775
|
-
|
|
13776
|
-
void Reset() {
|
|
13777
|
-
blob.size = 0;
|
|
13778
|
-
}
|
|
13779
|
-
};
|
|
13780
|
-
|
|
13781
|
-
} // namespace duckdb
|
|
13782
|
-
|
|
13783
|
-
#include <type_traits>
|
|
13784
|
-
|
|
13785
|
-
namespace duckdb {
|
|
13786
|
-
class BufferedSerializer;
|
|
13787
|
-
|
|
13788
|
-
class FieldWriter {
|
|
13789
|
-
public:
|
|
13790
|
-
DUCKDB_API FieldWriter(Serializer &serializer);
|
|
13791
|
-
DUCKDB_API ~FieldWriter();
|
|
13792
|
-
|
|
13793
|
-
public:
|
|
13794
|
-
template <class T>
|
|
13795
|
-
void WriteField(const T &element) {
|
|
13796
|
-
static_assert(std::is_trivially_destructible<T>(), "WriteField object must be trivially destructible");
|
|
13797
|
-
|
|
13798
|
-
AddField();
|
|
13799
|
-
WriteData((const_data_ptr_t)&element, sizeof(T));
|
|
13800
|
-
}
|
|
13801
|
-
|
|
13802
|
-
//! Write a string with a length prefix
|
|
13803
|
-
void WriteString(const string &val) {
|
|
13804
|
-
WriteStringLen((const_data_ptr_t)val.c_str(), val.size());
|
|
13805
|
-
}
|
|
13806
|
-
void WriteStringLen(const_data_ptr_t val, idx_t len) {
|
|
13807
|
-
AddField();
|
|
13808
|
-
Write<uint32_t>((uint32_t)len);
|
|
13809
|
-
if (len > 0) {
|
|
13810
|
-
WriteData(val, len);
|
|
13811
|
-
}
|
|
13812
|
-
}
|
|
13813
|
-
void WriteBlob(const_data_ptr_t val, idx_t len) {
|
|
13814
|
-
AddField();
|
|
13815
|
-
if (len > 0) {
|
|
13816
|
-
WriteData(val, len);
|
|
13817
|
-
}
|
|
13818
|
-
}
|
|
13819
|
-
|
|
13820
|
-
template <class T, class CONTAINER_TYPE = vector<T>>
|
|
13821
|
-
void WriteList(const CONTAINER_TYPE &elements) {
|
|
13822
|
-
AddField();
|
|
13823
|
-
Write<uint32_t>(elements.size());
|
|
13824
|
-
for (auto &element : elements) {
|
|
13825
|
-
Write<T>(element);
|
|
13826
|
-
}
|
|
13827
|
-
}
|
|
13828
|
-
|
|
13829
|
-
// vector<bool> yay
|
|
13830
|
-
template <class T, class CONTAINER_TYPE = vector<T>>
|
|
13831
|
-
void WriteListNoReference(const CONTAINER_TYPE &elements) {
|
|
13832
|
-
AddField();
|
|
13833
|
-
Write<uint32_t>(elements.size());
|
|
13834
|
-
for (auto element : elements) {
|
|
13835
|
-
Write<T>(element);
|
|
13836
|
-
}
|
|
13837
|
-
}
|
|
13838
|
-
|
|
13839
|
-
template <class T>
|
|
13840
|
-
void WriteSerializable(const T &element) {
|
|
13841
|
-
AddField();
|
|
13842
|
-
element.Serialize(*buffer);
|
|
13843
|
-
}
|
|
13844
|
-
|
|
13845
|
-
template <class T>
|
|
13846
|
-
void WriteSerializableList(const vector<unique_ptr<T>> &elements) {
|
|
13847
|
-
AddField();
|
|
13848
|
-
Write<uint32_t>(elements.size());
|
|
13849
|
-
for (idx_t i = 0; i < elements.size(); i++) {
|
|
13850
|
-
elements[i]->Serialize(*buffer);
|
|
13851
|
-
}
|
|
13852
|
-
}
|
|
13853
|
-
|
|
13854
|
-
template <class T>
|
|
13855
|
-
void WriteRegularSerializableList(const vector<T> &elements) {
|
|
13856
|
-
AddField();
|
|
13857
|
-
Write<uint32_t>(elements.size());
|
|
13858
|
-
for (idx_t i = 0; i < elements.size(); i++) {
|
|
13859
|
-
elements[i].Serialize(*buffer);
|
|
13860
|
-
}
|
|
13861
|
-
}
|
|
13862
|
-
|
|
13863
|
-
template <class T>
|
|
13864
|
-
void WriteOptional(const unique_ptr<T> &element) {
|
|
13865
|
-
AddField();
|
|
13866
|
-
Write<bool>(element ? true : false);
|
|
13867
|
-
if (element) {
|
|
13868
|
-
element->Serialize(*buffer);
|
|
13869
|
-
}
|
|
13870
|
-
}
|
|
13871
|
-
|
|
13872
|
-
// Called after all fields have been written. Should always be called.
|
|
13873
|
-
DUCKDB_API void Finalize();
|
|
13874
|
-
|
|
13875
|
-
Serializer &GetSerializer() {
|
|
13876
|
-
return *buffer;
|
|
13877
|
-
}
|
|
13878
|
-
|
|
13879
|
-
private:
|
|
13880
|
-
void AddField() {
|
|
13881
|
-
field_count++;
|
|
13882
|
-
}
|
|
14282
|
+
//===----------------------------------------------------------------------===//
|
|
14283
|
+
// DuckDB
|
|
14284
|
+
//
|
|
14285
|
+
// duckdb/catalog/default/default_generator.hpp
|
|
14286
|
+
//
|
|
14287
|
+
//
|
|
14288
|
+
//===----------------------------------------------------------------------===//
|
|
13883
14289
|
|
|
13884
|
-
template <class T>
|
|
13885
|
-
void Write(const T &element) {
|
|
13886
|
-
WriteData((const_data_ptr_t)&element, sizeof(T));
|
|
13887
|
-
}
|
|
13888
14290
|
|
|
13889
|
-
DUCKDB_API void WriteData(const_data_ptr_t buffer, idx_t write_size);
|
|
13890
14291
|
|
|
13891
|
-
private:
|
|
13892
|
-
Serializer &serializer;
|
|
13893
|
-
unique_ptr<BufferedSerializer> buffer;
|
|
13894
|
-
idx_t field_count;
|
|
13895
|
-
bool finalized;
|
|
13896
|
-
};
|
|
13897
14292
|
|
|
13898
|
-
template <>
|
|
13899
|
-
DUCKDB_API void FieldWriter::Write(const string &val);
|
|
13900
14293
|
|
|
13901
|
-
class FieldDeserializer : public Deserializer {
|
|
13902
|
-
public:
|
|
13903
|
-
FieldDeserializer(Deserializer &root);
|
|
13904
14294
|
|
|
13905
|
-
|
|
13906
|
-
|
|
14295
|
+
namespace duckdb {
|
|
14296
|
+
class ClientContext;
|
|
13907
14297
|
|
|
13908
|
-
|
|
13909
|
-
|
|
13910
|
-
|
|
13911
|
-
|
|
14298
|
+
class DefaultGenerator {
|
|
14299
|
+
public:
|
|
14300
|
+
explicit DefaultGenerator(Catalog &catalog) : catalog(catalog), created_all_entries(false) {
|
|
14301
|
+
}
|
|
14302
|
+
virtual ~DefaultGenerator() {
|
|
13912
14303
|
}
|
|
13913
14304
|
|
|
13914
|
-
|
|
13915
|
-
|
|
13916
|
-
idx_t remaining_data;
|
|
13917
|
-
};
|
|
14305
|
+
Catalog &catalog;
|
|
14306
|
+
atomic<bool> created_all_entries;
|
|
13918
14307
|
|
|
13919
|
-
class FieldReader {
|
|
13920
14308
|
public:
|
|
13921
|
-
|
|
13922
|
-
|
|
14309
|
+
//! Creates a default entry with the specified name, or returns nullptr if no such entry can be generated
|
|
14310
|
+
virtual unique_ptr<CatalogEntry> CreateDefaultEntry(ClientContext &context, const string &entry_name) = 0;
|
|
14311
|
+
//! Get a list of all default entries in the generator
|
|
14312
|
+
virtual vector<string> GetDefaultEntries() = 0;
|
|
14313
|
+
};
|
|
13923
14314
|
|
|
13924
|
-
|
|
13925
|
-
template <class T>
|
|
13926
|
-
T ReadRequired() {
|
|
13927
|
-
if (field_count >= max_field_count) {
|
|
13928
|
-
// field is not there, throw an exception
|
|
13929
|
-
throw SerializationException("Attempting to read a required field, but field is missing");
|
|
13930
|
-
}
|
|
13931
|
-
// field is there, read the actual value
|
|
13932
|
-
AddField();
|
|
13933
|
-
return source.Read<T>();
|
|
13934
|
-
}
|
|
14315
|
+
} // namespace duckdb
|
|
13935
14316
|
|
|
13936
|
-
template <class T>
|
|
13937
|
-
T ReadField(T default_value) {
|
|
13938
|
-
if (field_count >= max_field_count) {
|
|
13939
|
-
// field is not there, read the default value
|
|
13940
|
-
return default_value;
|
|
13941
|
-
}
|
|
13942
|
-
// field is there, read the actual value
|
|
13943
|
-
AddField();
|
|
13944
|
-
return source.Read<T>();
|
|
13945
|
-
}
|
|
13946
14317
|
|
|
13947
|
-
template <class T>
|
|
13948
|
-
vector<T> ReadRequiredList() {
|
|
13949
|
-
if (field_count >= max_field_count) {
|
|
13950
|
-
// field is not there, throw an exception
|
|
13951
|
-
throw SerializationException("Attempting to read a required field, but field is missing");
|
|
13952
|
-
}
|
|
13953
|
-
AddField();
|
|
13954
|
-
auto result_count = source.Read<uint32_t>();
|
|
13955
|
-
vector<T> result;
|
|
13956
|
-
result.reserve(result_count);
|
|
13957
|
-
for (idx_t i = 0; i < result_count; i++) {
|
|
13958
|
-
result.push_back(source.Read<T>());
|
|
13959
|
-
}
|
|
13960
|
-
return result;
|
|
13961
|
-
}
|
|
13962
14318
|
|
|
13963
|
-
template <class T>
|
|
13964
|
-
set<T> ReadRequiredSet() {
|
|
13965
|
-
if (field_count >= max_field_count) {
|
|
13966
|
-
// field is not there, throw an exception
|
|
13967
|
-
throw SerializationException("Attempting to read a required field, but field is missing");
|
|
13968
|
-
}
|
|
13969
|
-
AddField();
|
|
13970
|
-
auto result_count = source.Read<uint32_t>();
|
|
13971
|
-
set<T> result;
|
|
13972
|
-
for (idx_t i = 0; i < result_count; i++) {
|
|
13973
|
-
result.insert(source.Read<T>());
|
|
13974
|
-
}
|
|
13975
|
-
return result;
|
|
13976
|
-
}
|
|
13977
14319
|
|
|
13978
|
-
template <class T, typename... ARGS>
|
|
13979
|
-
unique_ptr<T> ReadOptional(unique_ptr<T> default_value, ARGS &&...args) {
|
|
13980
|
-
if (field_count >= max_field_count) {
|
|
13981
|
-
// field is not there, read the default value
|
|
13982
|
-
return default_value;
|
|
13983
|
-
}
|
|
13984
|
-
// field is there, read the actual value
|
|
13985
|
-
AddField();
|
|
13986
|
-
return source.template ReadOptional<T>(std::forward<ARGS>(args)...);
|
|
13987
|
-
}
|
|
13988
14320
|
|
|
13989
|
-
template <class T, class RETURN_TYPE = unique_ptr<T>>
|
|
13990
|
-
RETURN_TYPE ReadSerializable(RETURN_TYPE default_value) {
|
|
13991
|
-
if (field_count >= max_field_count) {
|
|
13992
|
-
// field is not there, read the default value
|
|
13993
|
-
return default_value;
|
|
13994
|
-
}
|
|
13995
|
-
// field is there, read the actual value
|
|
13996
|
-
AddField();
|
|
13997
|
-
return T::Deserialize(source);
|
|
13998
|
-
}
|
|
13999
14321
|
|
|
14000
|
-
template <class T, class RETURN_TYPE = unique_ptr<T>, typename... ARGS>
|
|
14001
|
-
RETURN_TYPE ReadSerializable(RETURN_TYPE default_value, ARGS &&...args) {
|
|
14002
|
-
if (field_count >= max_field_count) {
|
|
14003
|
-
// field is not there, read the default value
|
|
14004
|
-
return default_value;
|
|
14005
|
-
}
|
|
14006
|
-
// field is there, read the actual value
|
|
14007
|
-
AddField();
|
|
14008
|
-
return T::Deserialize(source, std::forward<ARGS>(args)...);
|
|
14009
|
-
}
|
|
14010
14322
|
|
|
14011
|
-
template <class T, class RETURN_TYPE = unique_ptr<T>>
|
|
14012
|
-
RETURN_TYPE ReadRequiredSerializable() {
|
|
14013
|
-
if (field_count >= max_field_count) {
|
|
14014
|
-
// field is not there, throw an exception
|
|
14015
|
-
throw SerializationException("Attempting to read mandatory field, but field is missing");
|
|
14016
|
-
}
|
|
14017
|
-
// field is there, read the actual value
|
|
14018
|
-
AddField();
|
|
14019
|
-
return T::Deserialize(source);
|
|
14020
|
-
}
|
|
14021
14323
|
|
|
14022
|
-
|
|
14023
|
-
|
|
14024
|
-
|
|
14025
|
-
|
|
14026
|
-
|
|
14027
|
-
|
|
14028
|
-
|
|
14029
|
-
AddField();
|
|
14030
|
-
return T::Deserialize(source, std::forward<ARGS>(args)...);
|
|
14031
|
-
}
|
|
14324
|
+
//===----------------------------------------------------------------------===//
|
|
14325
|
+
// DuckDB
|
|
14326
|
+
//
|
|
14327
|
+
// duckdb/catalog/catalog_entry/sequence_catalog_entry.hpp
|
|
14328
|
+
//
|
|
14329
|
+
//
|
|
14330
|
+
//===----------------------------------------------------------------------===//
|
|
14032
14331
|
|
|
14033
|
-
template <class T, class RETURN_TYPE = unique_ptr<T>, typename... ARGS>
|
|
14034
|
-
vector<RETURN_TYPE> ReadRequiredSerializableList(ARGS &&...args) {
|
|
14035
|
-
if (field_count >= max_field_count) {
|
|
14036
|
-
// field is not there, throw an exception
|
|
14037
|
-
throw SerializationException("Attempting to read mandatory field, but field is missing");
|
|
14038
|
-
}
|
|
14039
|
-
// field is there, read the actual value
|
|
14040
|
-
AddField();
|
|
14041
|
-
auto result_count = source.Read<uint32_t>();
|
|
14042
14332
|
|
|
14043
|
-
vector<RETURN_TYPE> result;
|
|
14044
|
-
for (idx_t i = 0; i < result_count; i++) {
|
|
14045
|
-
result.push_back(T::Deserialize(source, std::forward<ARGS>(args)...));
|
|
14046
|
-
}
|
|
14047
|
-
return result;
|
|
14048
|
-
}
|
|
14049
14333
|
|
|
14050
|
-
void ReadBlob(data_ptr_t result, idx_t read_size) {
|
|
14051
|
-
if (field_count >= max_field_count) {
|
|
14052
|
-
// field is not there, throw an exception
|
|
14053
|
-
throw SerializationException("Attempting to read a required field, but field is missing");
|
|
14054
|
-
}
|
|
14055
|
-
// field is there, read the actual value
|
|
14056
|
-
AddField();
|
|
14057
|
-
source.ReadData(result, read_size);
|
|
14058
|
-
}
|
|
14059
14334
|
|
|
14060
|
-
//! Called after all fields have been read. Should always be called.
|
|
14061
|
-
DUCKDB_API void Finalize();
|
|
14062
14335
|
|
|
14063
|
-
|
|
14064
|
-
|
|
14065
|
-
|
|
14336
|
+
//===----------------------------------------------------------------------===//
|
|
14337
|
+
// DuckDB
|
|
14338
|
+
//
|
|
14339
|
+
// duckdb/parser/parsed_data/create_sequence_info.hpp
|
|
14340
|
+
//
|
|
14341
|
+
//
|
|
14342
|
+
//===----------------------------------------------------------------------===//
|
|
14343
|
+
|
|
14344
|
+
|
|
14345
|
+
|
|
14346
|
+
//===----------------------------------------------------------------------===//
|
|
14347
|
+
// DuckDB
|
|
14348
|
+
//
|
|
14349
|
+
// duckdb/parser/parsed_data/create_info.hpp
|
|
14350
|
+
//
|
|
14351
|
+
//
|
|
14352
|
+
//===----------------------------------------------------------------------===//
|
|
14353
|
+
|
|
14066
14354
|
|
|
14067
|
-
private:
|
|
14068
|
-
void AddField() {
|
|
14069
|
-
field_count++;
|
|
14070
|
-
}
|
|
14071
14355
|
|
|
14072
|
-
private:
|
|
14073
|
-
FieldDeserializer source;
|
|
14074
|
-
idx_t field_count;
|
|
14075
|
-
idx_t max_field_count;
|
|
14076
|
-
idx_t total_size;
|
|
14077
|
-
bool finalized;
|
|
14078
|
-
};
|
|
14079
14356
|
|
|
14080
|
-
} // namespace duckdb
|
|
14081
14357
|
|
|
14082
14358
|
//===----------------------------------------------------------------------===//
|
|
14083
14359
|
// DuckDB
|
|
@@ -14451,15 +14727,15 @@ public:
|
|
|
14451
14727
|
//===--------------------------------------------------------------------===//
|
|
14452
14728
|
struct AlterForeignKeyInfo : public AlterTableInfo {
|
|
14453
14729
|
AlterForeignKeyInfo(string schema, string table, bool if_exists, string fk_table, vector<string> pk_columns,
|
|
14454
|
-
vector<string> fk_columns, vector<
|
|
14730
|
+
vector<string> fk_columns, vector<PhysicalIndex> pk_keys, vector<PhysicalIndex> fk_keys,
|
|
14455
14731
|
AlterForeignKeyType type);
|
|
14456
14732
|
~AlterForeignKeyInfo() override;
|
|
14457
14733
|
|
|
14458
14734
|
string fk_table;
|
|
14459
14735
|
vector<string> pk_columns;
|
|
14460
14736
|
vector<string> fk_columns;
|
|
14461
|
-
vector<
|
|
14462
|
-
vector<
|
|
14737
|
+
vector<PhysicalIndex> pk_keys;
|
|
14738
|
+
vector<PhysicalIndex> fk_keys;
|
|
14463
14739
|
AlterForeignKeyType type;
|
|
14464
14740
|
|
|
14465
14741
|
public:
|
|
@@ -14770,6 +15046,7 @@ private:
|
|
|
14770
15046
|
|
|
14771
15047
|
namespace duckdb {
|
|
14772
15048
|
class SequenceCatalogEntry;
|
|
15049
|
+
class SchemaCatalogEntry;
|
|
14773
15050
|
|
|
14774
15051
|
class ColumnData;
|
|
14775
15052
|
class ClientContext;
|
|
@@ -14788,7 +15065,7 @@ struct UpdateInfo;
|
|
|
14788
15065
|
//! transaction
|
|
14789
15066
|
class Transaction {
|
|
14790
15067
|
public:
|
|
14791
|
-
Transaction(
|
|
15068
|
+
Transaction(ClientContext &context, transaction_t start_time, transaction_t transaction_id,
|
|
14792
15069
|
timestamp_t start_timestamp, idx_t catalog_version);
|
|
14793
15070
|
~Transaction();
|
|
14794
15071
|
|
|
@@ -14812,6 +15089,8 @@ public:
|
|
|
14812
15089
|
unordered_map<SequenceCatalogEntry *, SequenceValue> sequence_usage;
|
|
14813
15090
|
//! The validity checker of the transaction
|
|
14814
15091
|
ValidChecker transaction_validity;
|
|
15092
|
+
//! A pointer to the temporary objects of the client context
|
|
15093
|
+
shared_ptr<SchemaCatalogEntry> temporary_objects;
|
|
14815
15094
|
|
|
14816
15095
|
public:
|
|
14817
15096
|
static Transaction &GetTransaction(ClientContext &context);
|
|
@@ -15020,6 +15299,8 @@ private:
|
|
|
15020
15299
|
CatalogSet types;
|
|
15021
15300
|
|
|
15022
15301
|
public:
|
|
15302
|
+
static SchemaCatalogEntry *GetTemporaryObjects(ClientContext &context);
|
|
15303
|
+
|
|
15023
15304
|
//! Scan the specified catalog set, invoking the callback method for every entry
|
|
15024
15305
|
void Scan(ClientContext &context, CatalogType type, const std::function<void(CatalogEntry *)> &callback);
|
|
15025
15306
|
//! Scan the specified catalog set, invoking the callback method for every committed entry
|
|
@@ -16625,6 +16906,7 @@ public:
|
|
|
16625
16906
|
DUCKDB_API DBConfig(std::unordered_map<string, string> &config_dict, bool read_only);
|
|
16626
16907
|
DUCKDB_API ~DBConfig();
|
|
16627
16908
|
|
|
16909
|
+
mutex config_lock;
|
|
16628
16910
|
//! Replacement table scans are automatically attempted when a table name cannot be found in the schema
|
|
16629
16911
|
vector<ReplacementScan> replacement_scans;
|
|
16630
16912
|
|
|
@@ -16647,9 +16929,6 @@ public:
|
|
|
16647
16929
|
//! Error manager
|
|
16648
16930
|
unique_ptr<ErrorManager> error_manager;
|
|
16649
16931
|
|
|
16650
|
-
DUCKDB_API void AddExtensionOption(string name, string description, LogicalType parameter,
|
|
16651
|
-
set_option_callback_t function = nullptr);
|
|
16652
|
-
|
|
16653
16932
|
public:
|
|
16654
16933
|
DUCKDB_API static DBConfig &GetConfig(ClientContext &context);
|
|
16655
16934
|
DUCKDB_API static DBConfig &GetConfig(DatabaseInstance &db);
|
|
@@ -16659,12 +16938,16 @@ public:
|
|
|
16659
16938
|
DUCKDB_API static idx_t GetOptionCount();
|
|
16660
16939
|
DUCKDB_API static vector<string> GetOptionNames();
|
|
16661
16940
|
|
|
16941
|
+
DUCKDB_API void AddExtensionOption(string name, string description, LogicalType parameter,
|
|
16942
|
+
set_option_callback_t function = nullptr);
|
|
16662
16943
|
//! Fetch an option by index. Returns a pointer to the option, or nullptr if out of range
|
|
16663
16944
|
DUCKDB_API static ConfigurationOption *GetOptionByIndex(idx_t index);
|
|
16664
16945
|
//! Fetch an option by name. Returns a pointer to the option, or nullptr if none exists.
|
|
16665
16946
|
DUCKDB_API static ConfigurationOption *GetOptionByName(const string &name);
|
|
16666
16947
|
|
|
16667
16948
|
DUCKDB_API void SetOption(const ConfigurationOption &option, const Value &value);
|
|
16949
|
+
DUCKDB_API void SetOption(DatabaseInstance *db, const ConfigurationOption &option, const Value &value);
|
|
16950
|
+
DUCKDB_API void SetOption(const string &name, Value value);
|
|
16668
16951
|
|
|
16669
16952
|
DUCKDB_API static idx_t ParseMemoryLimit(const string &arg);
|
|
16670
16953
|
|
|
@@ -20336,6 +20619,9 @@ public:
|
|
|
20336
20619
|
|
|
20337
20620
|
string ResultModifiersToString() const;
|
|
20338
20621
|
|
|
20622
|
+
//! Adds a distinct modifier to the query node
|
|
20623
|
+
void AddDistinct();
|
|
20624
|
+
|
|
20339
20625
|
protected:
|
|
20340
20626
|
//! Copy base QueryNode properties from another expression to this one,
|
|
20341
20627
|
//! used in Copy method
|
|
@@ -20499,6 +20785,7 @@ public:
|
|
|
20499
20785
|
|
|
20500
20786
|
|
|
20501
20787
|
|
|
20788
|
+
|
|
20502
20789
|
namespace duckdb {
|
|
20503
20790
|
|
|
20504
20791
|
struct CreateTableInfo : public CreateInfo {
|
|
@@ -20508,7 +20795,7 @@ struct CreateTableInfo : public CreateInfo {
|
|
|
20508
20795
|
//! Table name to insert to
|
|
20509
20796
|
string table;
|
|
20510
20797
|
//! List of columns of the table
|
|
20511
|
-
|
|
20798
|
+
ColumnList columns;
|
|
20512
20799
|
//! List of constraints on the table
|
|
20513
20800
|
vector<unique_ptr<Constraint>> constraints;
|
|
20514
20801
|
//! CREATE TABLE from QUERY
|
|
@@ -22848,7 +23135,7 @@ private:
|
|
|
22848
23135
|
//! Bind the expressions of generated columns to check for errors
|
|
22849
23136
|
void BindGeneratedColumns(BoundCreateTableInfo &info);
|
|
22850
23137
|
//! Bind the default values of the columns of a table
|
|
22851
|
-
void BindDefaultValues(
|
|
23138
|
+
void BindDefaultValues(ColumnList &columns, vector<unique_ptr<Expression>> &bound_defaults);
|
|
22852
23139
|
//! Bind a limit value (LIMIT or OFFSET)
|
|
22853
23140
|
unique_ptr<Expression> BindDelimiter(ClientContext &context, OrderBinder &order_binder,
|
|
22854
23141
|
unique_ptr<ParsedExpression> delimiter, const LogicalType &type,
|
|
@@ -23595,6 +23882,7 @@ public:
|
|
|
23595
23882
|
|
|
23596
23883
|
|
|
23597
23884
|
|
|
23885
|
+
|
|
23598
23886
|
namespace duckdb {
|
|
23599
23887
|
class BlockManager;
|
|
23600
23888
|
class ColumnData;
|
|
@@ -23711,13 +23999,13 @@ public:
|
|
|
23711
23999
|
RowGroupWriteData WriteToDisk(PartialBlockManager &manager, const vector<CompressionType> &compression_types);
|
|
23712
24000
|
RowGroupPointer Checkpoint(RowGroupWriter &writer, vector<unique_ptr<BaseStatistics>> &global_stats);
|
|
23713
24001
|
static void Serialize(RowGroupPointer &pointer, Serializer &serializer);
|
|
23714
|
-
static RowGroupPointer Deserialize(Deserializer &source, const
|
|
24002
|
+
static RowGroupPointer Deserialize(Deserializer &source, const ColumnList &columns);
|
|
23715
24003
|
|
|
23716
24004
|
void InitializeAppend(RowGroupAppendState &append_state);
|
|
23717
24005
|
void Append(RowGroupAppendState &append_state, DataChunk &chunk, idx_t append_count);
|
|
23718
24006
|
|
|
23719
24007
|
void Update(TransactionData transaction, DataChunk &updates, row_t *ids, idx_t offset, idx_t count,
|
|
23720
|
-
const vector<
|
|
24008
|
+
const vector<PhysicalIndex> &column_ids);
|
|
23721
24009
|
//! Update a single column; corresponds to DataTable::UpdateColumn
|
|
23722
24010
|
//! This method should only be called from the WAL
|
|
23723
24011
|
void UpdateColumn(TransactionData transaction, DataChunk &updates, Vector &row_ids,
|
|
@@ -23920,14 +24208,16 @@ class ExecutionContext;
|
|
|
23920
24208
|
|
|
23921
24209
|
//! ExpressionExecutor is responsible for executing a set of expressions and storing the result in a data chunk
|
|
23922
24210
|
class ExpressionExecutor {
|
|
24211
|
+
friend class Index;
|
|
24212
|
+
friend class CreateIndexLocalSinkState;
|
|
24213
|
+
|
|
23923
24214
|
public:
|
|
23924
|
-
DUCKDB_API ExpressionExecutor(ClientContext &
|
|
23925
|
-
DUCKDB_API ExpressionExecutor(
|
|
23926
|
-
DUCKDB_API
|
|
23927
|
-
DUCKDB_API
|
|
23928
|
-
|
|
24215
|
+
DUCKDB_API explicit ExpressionExecutor(ClientContext &context);
|
|
24216
|
+
DUCKDB_API ExpressionExecutor(ClientContext &context, const Expression *expression);
|
|
24217
|
+
DUCKDB_API ExpressionExecutor(ClientContext &context, const Expression &expression);
|
|
24218
|
+
DUCKDB_API ExpressionExecutor(ClientContext &context, const vector<unique_ptr<Expression>> &expressions);
|
|
24219
|
+
ExpressionExecutor(ExpressionExecutor &&) = delete;
|
|
23929
24220
|
|
|
23930
|
-
Allocator &allocator;
|
|
23931
24221
|
//! The expressions of the executor
|
|
23932
24222
|
vector<const Expression *> expressions;
|
|
23933
24223
|
//! The data chunk of the current physical operator, used to resolve
|
|
@@ -23935,6 +24225,10 @@ public:
|
|
|
23935
24225
|
DataChunk *chunk = nullptr;
|
|
23936
24226
|
|
|
23937
24227
|
public:
|
|
24228
|
+
bool HasContext();
|
|
24229
|
+
ClientContext &GetContext();
|
|
24230
|
+
Allocator &GetAllocator();
|
|
24231
|
+
|
|
23938
24232
|
//! Add an expression to the set of to-be-executed expressions of the executor
|
|
23939
24233
|
DUCKDB_API void AddExpression(const Expression &expr);
|
|
23940
24234
|
|
|
@@ -23960,9 +24254,10 @@ public:
|
|
|
23960
24254
|
//! Execute the expression with index `expr_idx` and store the result in the result vector
|
|
23961
24255
|
DUCKDB_API void ExecuteExpression(idx_t expr_idx, Vector &result);
|
|
23962
24256
|
//! Evaluate a scalar expression and fold it into a single value
|
|
23963
|
-
DUCKDB_API static Value EvaluateScalar(const Expression &expr,
|
|
24257
|
+
DUCKDB_API static Value EvaluateScalar(ClientContext &context, const Expression &expr,
|
|
24258
|
+
bool allow_unfoldable = false);
|
|
23964
24259
|
//! Try to evaluate a scalar expression and fold it into a single value, returns false if an exception is thrown
|
|
23965
|
-
DUCKDB_API static bool TryEvaluateScalar(const Expression &expr, Value &result);
|
|
24260
|
+
DUCKDB_API static bool TryEvaluateScalar(ClientContext &context, const Expression &expr, Value &result);
|
|
23966
24261
|
|
|
23967
24262
|
//! Initialize the state of a given expression
|
|
23968
24263
|
static unique_ptr<ExpressionState> InitializeState(const Expression &expr, ExpressionExecutorState &state);
|
|
@@ -24043,8 +24338,15 @@ protected:
|
|
|
24043
24338
|
void FillSwitch(Vector &vector, Vector &result, const SelectionVector &sel, sel_t count);
|
|
24044
24339
|
|
|
24045
24340
|
private:
|
|
24341
|
+
//! Client context
|
|
24342
|
+
ClientContext *context;
|
|
24046
24343
|
//! The states of the expression executor; this holds any intermediates and temporary states of expressions
|
|
24047
24344
|
vector<unique_ptr<ExpressionExecutorState>> states;
|
|
24345
|
+
|
|
24346
|
+
private:
|
|
24347
|
+
// it is possible to create an expression executor without a ClientContext - but it should be avoided
|
|
24348
|
+
DUCKDB_API ExpressionExecutor();
|
|
24349
|
+
DUCKDB_API ExpressionExecutor(const vector<unique_ptr<Expression>> &exprs);
|
|
24048
24350
|
};
|
|
24049
24351
|
} // namespace duckdb
|
|
24050
24352
|
|
|
@@ -24075,7 +24377,7 @@ public:
|
|
|
24075
24377
|
};
|
|
24076
24378
|
|
|
24077
24379
|
struct AggregateFilterData {
|
|
24078
|
-
AggregateFilterData(
|
|
24380
|
+
AggregateFilterData(ClientContext &context, Expression &filter_expr, const vector<LogicalType> &payload_types);
|
|
24079
24381
|
|
|
24080
24382
|
idx_t ApplyFilter(DataChunk &payload);
|
|
24081
24383
|
|
|
@@ -24090,7 +24392,7 @@ struct AggregateFilterDataSet {
|
|
|
24090
24392
|
vector<unique_ptr<AggregateFilterData>> filter_data;
|
|
24091
24393
|
|
|
24092
24394
|
public:
|
|
24093
|
-
void Initialize(
|
|
24395
|
+
void Initialize(ClientContext &context, const vector<AggregateObject> &aggregates,
|
|
24094
24396
|
const vector<LogicalType> &payload_types);
|
|
24095
24397
|
|
|
24096
24398
|
AggregateFilterData &GetFilterData(idx_t aggr_idx);
|
|
@@ -25996,7 +26298,7 @@ public:
|
|
|
25996
26298
|
virtual string ToString() = 0;
|
|
25997
26299
|
|
|
25998
26300
|
//! Returns true if the index is affected by updates on the specified column ids, and false otherwise
|
|
25999
|
-
bool IndexIsUpdated(const vector<
|
|
26301
|
+
bool IndexIsUpdated(const vector<PhysicalIndex> &column_ids) const;
|
|
26000
26302
|
|
|
26001
26303
|
//! Returns unique flag
|
|
26002
26304
|
bool IsUnique() {
|
|
@@ -26064,8 +26366,9 @@ public:
|
|
|
26064
26366
|
|
|
26065
26367
|
void Move(TableIndexList &other);
|
|
26066
26368
|
|
|
26067
|
-
Index *FindForeignKeyIndex(const vector<
|
|
26068
|
-
void VerifyForeignKey(const vector<
|
|
26369
|
+
Index *FindForeignKeyIndex(const vector<PhysicalIndex> &fk_keys, ForeignKeyType fk_type);
|
|
26370
|
+
void VerifyForeignKey(const vector<PhysicalIndex> &fk_keys, bool is_append, DataChunk &chunk,
|
|
26371
|
+
vector<string> &err_msg);
|
|
26069
26372
|
|
|
26070
26373
|
//! Serialize all indexes owned by this table, returns a vector of block info of all indexes
|
|
26071
26374
|
vector<BlockPointer> SerializeIndexes(duckdb::MetaBlockWriter &writer);
|
|
@@ -26092,8 +26395,6 @@ struct BoundCreateTableInfo {
|
|
|
26092
26395
|
SchemaCatalogEntry *schema;
|
|
26093
26396
|
//! The base CreateInfo object
|
|
26094
26397
|
unique_ptr<CreateInfo> base;
|
|
26095
|
-
//! The map of column names -> column index, used during binding
|
|
26096
|
-
case_insensitive_map_t<column_t> name_map;
|
|
26097
26398
|
//! Column dependency manager of the table
|
|
26098
26399
|
ColumnDependencyManager column_dependency_manager;
|
|
26099
26400
|
//! List of constraints on the table
|
|
@@ -26139,11 +26440,11 @@ namespace duckdb {
|
|
|
26139
26440
|
|
|
26140
26441
|
class NotNullConstraint : public Constraint {
|
|
26141
26442
|
public:
|
|
26142
|
-
DUCKDB_API explicit NotNullConstraint(
|
|
26443
|
+
DUCKDB_API explicit NotNullConstraint(LogicalIndex index);
|
|
26143
26444
|
DUCKDB_API ~NotNullConstraint() override;
|
|
26144
26445
|
|
|
26145
26446
|
//! Column index this constraint pertains to
|
|
26146
|
-
|
|
26447
|
+
LogicalIndex index;
|
|
26147
26448
|
|
|
26148
26449
|
public:
|
|
26149
26450
|
DUCKDB_API string ToString() const override;
|
|
@@ -26477,7 +26778,7 @@ public:
|
|
|
26477
26778
|
void RemoveFromIndexes(TableIndexList &indexes, Vector &row_identifiers, idx_t count);
|
|
26478
26779
|
|
|
26479
26780
|
idx_t Delete(TransactionData transaction, DataTable *table, row_t *ids, idx_t count);
|
|
26480
|
-
void Update(TransactionData transaction, row_t *ids, const vector<
|
|
26781
|
+
void Update(TransactionData transaction, row_t *ids, const vector<PhysicalIndex> &column_ids, DataChunk &updates);
|
|
26481
26782
|
void UpdateColumn(TransactionData transaction, Vector &row_ids, const vector<column_t> &column_path,
|
|
26482
26783
|
DataChunk &updates);
|
|
26483
26784
|
|
|
@@ -26489,9 +26790,10 @@ public:
|
|
|
26489
26790
|
vector<vector<Value>> GetStorageInfo();
|
|
26490
26791
|
const vector<LogicalType> &GetTypes() const;
|
|
26491
26792
|
|
|
26492
|
-
shared_ptr<RowGroupCollection> AddColumn(ColumnDefinition &new_column,
|
|
26793
|
+
shared_ptr<RowGroupCollection> AddColumn(ClientContext &context, ColumnDefinition &new_column,
|
|
26794
|
+
Expression *default_value);
|
|
26493
26795
|
shared_ptr<RowGroupCollection> RemoveColumn(idx_t col_idx);
|
|
26494
|
-
shared_ptr<RowGroupCollection> AlterType(idx_t changed_idx, const LogicalType &target_type,
|
|
26796
|
+
shared_ptr<RowGroupCollection> AlterType(ClientContext &context, idx_t changed_idx, const LogicalType &target_type,
|
|
26495
26797
|
vector<column_t> bound_columns, Expression &cast_expr);
|
|
26496
26798
|
void VerifyNewConstraint(DataTable &parent, const BoundConstraint &constraint);
|
|
26497
26799
|
|
|
@@ -26572,12 +26874,12 @@ public:
|
|
|
26572
26874
|
// Create a new LocalTableStorage
|
|
26573
26875
|
explicit LocalTableStorage(DataTable &table);
|
|
26574
26876
|
// Create a LocalTableStorage from an ALTER TYPE
|
|
26575
|
-
LocalTableStorage(DataTable &table, LocalTableStorage &parent, idx_t changed_idx,
|
|
26576
|
-
const vector<column_t> &bound_columns, Expression &cast_expr);
|
|
26877
|
+
LocalTableStorage(ClientContext &context, DataTable &table, LocalTableStorage &parent, idx_t changed_idx,
|
|
26878
|
+
const LogicalType &target_type, const vector<column_t> &bound_columns, Expression &cast_expr);
|
|
26577
26879
|
// Create a LocalTableStorage from a DROP COLUMN
|
|
26578
26880
|
LocalTableStorage(DataTable &table, LocalTableStorage &parent, idx_t drop_idx);
|
|
26579
26881
|
// Create a LocalTableStorage from an ADD COLUMN
|
|
26580
|
-
LocalTableStorage(DataTable &table, LocalTableStorage &parent, ColumnDefinition &new_column,
|
|
26882
|
+
LocalTableStorage(ClientContext &context, DataTable &table, LocalTableStorage &parent, ColumnDefinition &new_column,
|
|
26581
26883
|
Expression *default_value);
|
|
26582
26884
|
~LocalTableStorage();
|
|
26583
26885
|
|
|
@@ -26640,7 +26942,7 @@ public:
|
|
|
26640
26942
|
};
|
|
26641
26943
|
|
|
26642
26944
|
public:
|
|
26643
|
-
explicit LocalStorage(Transaction &transaction);
|
|
26945
|
+
explicit LocalStorage(ClientContext &context, Transaction &transaction);
|
|
26644
26946
|
|
|
26645
26947
|
static LocalStorage &Get(Transaction &transaction);
|
|
26646
26948
|
static LocalStorage &Get(ClientContext &context);
|
|
@@ -26668,7 +26970,7 @@ public:
|
|
|
26668
26970
|
//! Delete a set of rows from the local storage
|
|
26669
26971
|
idx_t Delete(DataTable *table, Vector &row_ids, idx_t count);
|
|
26670
26972
|
//! Update a set of rows in the local storage
|
|
26671
|
-
void Update(DataTable *table, Vector &row_ids, const vector<
|
|
26973
|
+
void Update(DataTable *table, Vector &row_ids, const vector<PhysicalIndex> &column_ids, DataChunk &data);
|
|
26672
26974
|
|
|
26673
26975
|
//! Commits the local storage, writing it to the WAL and completing the commit
|
|
26674
26976
|
void Commit(LocalStorage::CommitState &commit_state, Transaction &transaction);
|
|
@@ -26694,6 +26996,7 @@ public:
|
|
|
26694
26996
|
void VerifyNewConstraint(DataTable &parent, const BoundConstraint &constraint);
|
|
26695
26997
|
|
|
26696
26998
|
private:
|
|
26999
|
+
ClientContext &context;
|
|
26697
27000
|
Transaction &transaction;
|
|
26698
27001
|
LocalTableManager table_manager;
|
|
26699
27002
|
|
|
@@ -26827,8 +27130,8 @@ public:
|
|
|
26827
27130
|
//! Delete the entries with the specified row identifier from the table
|
|
26828
27131
|
idx_t Delete(TableCatalogEntry &table, ClientContext &context, Vector &row_ids, idx_t count);
|
|
26829
27132
|
//! Update the entries with the specified row identifier from the table
|
|
26830
|
-
void Update(TableCatalogEntry &table, ClientContext &context, Vector &row_ids,
|
|
26831
|
-
DataChunk &data);
|
|
27133
|
+
void Update(TableCatalogEntry &table, ClientContext &context, Vector &row_ids,
|
|
27134
|
+
const vector<PhysicalIndex> &column_ids, DataChunk &data);
|
|
26832
27135
|
//! Update a single (sub-)column along a column path
|
|
26833
27136
|
//! The column_path vector is a *path* towards a column within the table
|
|
26834
27137
|
//! i.e. if we have a table with a single column S STRUCT(A INT, B INT)
|
|
@@ -26892,7 +27195,7 @@ public:
|
|
|
26892
27195
|
idx_t GetTotalRows();
|
|
26893
27196
|
|
|
26894
27197
|
vector<vector<Value>> GetStorageInfo();
|
|
26895
|
-
static bool IsForeignKeyIndex(const vector<
|
|
27198
|
+
static bool IsForeignKeyIndex(const vector<PhysicalIndex> &fk_keys, Index &index, ForeignKeyType fk_type);
|
|
26896
27199
|
|
|
26897
27200
|
//! Initializes a special scan that is used to create an index on the table, it keeps locks on the table
|
|
26898
27201
|
void InitializeCreateIndexScan(CreateIndexScanState &state, const vector<column_t> &column_ids);
|
|
@@ -26906,7 +27209,8 @@ private:
|
|
|
26906
27209
|
//! Verify the new added constraints against current persistent&local data
|
|
26907
27210
|
void VerifyNewConstraint(ClientContext &context, DataTable &parent, const BoundConstraint *constraint);
|
|
26908
27211
|
//! Verify constraints with a chunk from the Update containing only the specified column_ids
|
|
26909
|
-
void VerifyUpdateConstraints(TableCatalogEntry &table, DataChunk &chunk,
|
|
27212
|
+
void VerifyUpdateConstraints(ClientContext &context, TableCatalogEntry &table, DataChunk &chunk,
|
|
27213
|
+
const vector<PhysicalIndex> &column_ids);
|
|
26910
27214
|
//! Verify constraints with a chunk from the Delete containing all columns of the table
|
|
26911
27215
|
void VerifyDeleteConstraints(TableCatalogEntry &table, ClientContext &context, DataChunk &chunk);
|
|
26912
27216
|
|
|
@@ -27029,7 +27333,7 @@ public:
|
|
|
27029
27333
|
static vector<vector<unique_ptr<ParsedExpression>>> ParseValuesList(const string &value_list,
|
|
27030
27334
|
ParserOptions options = ParserOptions());
|
|
27031
27335
|
//! Parses a column list (i.e. as found in a CREATE TABLE statement)
|
|
27032
|
-
static
|
|
27336
|
+
static ColumnList ParseColumnList(const string &column_list, ParserOptions options = ParserOptions());
|
|
27033
27337
|
|
|
27034
27338
|
private:
|
|
27035
27339
|
ParserOptions options;
|
|
@@ -28574,6 +28878,7 @@ private:
|
|
|
28574
28878
|
#include <map>
|
|
28575
28879
|
|
|
28576
28880
|
namespace duckdb {
|
|
28881
|
+
class Optimizer;
|
|
28577
28882
|
|
|
28578
28883
|
enum class ValueComparisonResult { PRUNE_LEFT, PRUNE_RIGHT, UNSATISFIABLE_CONDITION, PRUNE_NOTHING };
|
|
28579
28884
|
enum class FilterResult { UNSATISFIABLE, SUCCESS, UNSUPPORTED };
|
|
@@ -28584,6 +28889,12 @@ enum class FilterResult { UNSATISFIABLE, SUCCESS, UNSUPPORTED };
|
|
|
28584
28889
|
//! (2) it generates new filters for expressions in the same equivalence set: i.e. [X = Y and X = 500] => [Y = 500]
|
|
28585
28890
|
//! (3) it prunes branches that have unsatisfiable filters: i.e. [X = 5 AND X > 6] => FALSE, prune branch
|
|
28586
28891
|
class FilterCombiner {
|
|
28892
|
+
public:
|
|
28893
|
+
explicit FilterCombiner(ClientContext &context);
|
|
28894
|
+
explicit FilterCombiner(Optimizer &optimizer);
|
|
28895
|
+
|
|
28896
|
+
ClientContext &context;
|
|
28897
|
+
|
|
28587
28898
|
public:
|
|
28588
28899
|
struct ExpressionValueInformation {
|
|
28589
28900
|
Value constant;
|
|
@@ -29906,7 +30217,8 @@ public:
|
|
|
29906
30217
|
//! Prunes a list of filenames based on a set of filters, can be used by TableFunctions in the
|
|
29907
30218
|
//! pushdown_complex_filter function to skip files with filename-based filters. Also removes the filters that always
|
|
29908
30219
|
//! evaluate to true.
|
|
29909
|
-
DUCKDB_API static void ApplyFiltersToFileList(
|
|
30220
|
+
DUCKDB_API static void ApplyFiltersToFileList(ClientContext &context, vector<string> &files,
|
|
30221
|
+
vector<unique_ptr<Expression>> &filters,
|
|
29910
30222
|
unordered_map<string, column_t> &column_map, idx_t table_index,
|
|
29911
30223
|
bool hive_enabled, bool filename_enabled);
|
|
29912
30224
|
|