duckdb 0.5.2-dev1040.0 → 0.5.2-dev1083.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 +893 -663
- package/src/duckdb.hpp +833 -722
- package/src/parquet-amalgamation.cpp +36696 -36696
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 "2c8cbc4c0"
|
|
15
|
+
#define DUCKDB_VERSION "v0.5.2-dev1083"
|
|
16
16
|
//===----------------------------------------------------------------------===//
|
|
17
17
|
// DuckDB
|
|
18
18
|
//
|
|
@@ -1512,6 +1512,8 @@ public:
|
|
|
1512
1512
|
|
|
1513
1513
|
DUCKDB_API static bool UncaughtException();
|
|
1514
1514
|
|
|
1515
|
+
DUCKDB_API static string GetStackTrace(int max_depth = 120);
|
|
1516
|
+
|
|
1515
1517
|
private:
|
|
1516
1518
|
string exception_message_;
|
|
1517
1519
|
string raw_message_;
|
|
@@ -3818,11 +3820,21 @@ private:
|
|
|
3818
3820
|
|
|
3819
3821
|
|
|
3820
3822
|
|
|
3823
|
+
|
|
3821
3824
|
namespace duckdb {
|
|
3822
3825
|
class Serializer;
|
|
3823
3826
|
class Deserializer;
|
|
3824
3827
|
struct FileHandle;
|
|
3825
3828
|
|
|
3829
|
+
#define STANDARD_ROW_GROUPS_SIZE 122880
|
|
3830
|
+
#if STANDARD_ROW_GROUPS_SIZE < STANDARD_VECTOR_SIZE
|
|
3831
|
+
#error Row groups should be able to hold at least one vector
|
|
3832
|
+
#endif
|
|
3833
|
+
|
|
3834
|
+
#if ((STANDARD_ROW_GROUPS_SIZE % STANDARD_VECTOR_SIZE) != 0)
|
|
3835
|
+
#error Row group size should be cleanly divisible by vector size
|
|
3836
|
+
#endif
|
|
3837
|
+
|
|
3826
3838
|
//! The version number of the database storage format
|
|
3827
3839
|
extern const uint64_t VERSION_NUMBER;
|
|
3828
3840
|
|
|
@@ -20415,13 +20427,13 @@ namespace duckdb {
|
|
|
20415
20427
|
|
|
20416
20428
|
class SegmentBase {
|
|
20417
20429
|
public:
|
|
20418
|
-
SegmentBase(idx_t start, idx_t count) : start(start), count(count) {
|
|
20430
|
+
SegmentBase(idx_t start, idx_t count) : start(start), count(count), next(nullptr) {
|
|
20419
20431
|
}
|
|
20420
20432
|
virtual ~SegmentBase() {
|
|
20421
|
-
|
|
20422
|
-
|
|
20423
|
-
|
|
20424
|
-
|
|
20433
|
+
}
|
|
20434
|
+
|
|
20435
|
+
SegmentBase *Next() {
|
|
20436
|
+
return next.load();
|
|
20425
20437
|
}
|
|
20426
20438
|
|
|
20427
20439
|
//! The start row id of this chunk
|
|
@@ -20429,7 +20441,46 @@ public:
|
|
|
20429
20441
|
//! The amount of entries in this storage chunk
|
|
20430
20442
|
atomic<idx_t> count;
|
|
20431
20443
|
//! The next segment after this one
|
|
20432
|
-
|
|
20444
|
+
atomic<SegmentBase *> next;
|
|
20445
|
+
};
|
|
20446
|
+
|
|
20447
|
+
} // namespace duckdb
|
|
20448
|
+
|
|
20449
|
+
//===----------------------------------------------------------------------===//
|
|
20450
|
+
// DuckDB
|
|
20451
|
+
//
|
|
20452
|
+
// duckdb/storage/table/segment_lock.hpp
|
|
20453
|
+
//
|
|
20454
|
+
//
|
|
20455
|
+
//===----------------------------------------------------------------------===//
|
|
20456
|
+
|
|
20457
|
+
|
|
20458
|
+
|
|
20459
|
+
|
|
20460
|
+
|
|
20461
|
+
|
|
20462
|
+
namespace duckdb {
|
|
20463
|
+
|
|
20464
|
+
struct SegmentLock {
|
|
20465
|
+
public:
|
|
20466
|
+
SegmentLock() {
|
|
20467
|
+
}
|
|
20468
|
+
SegmentLock(mutex &lock) : lock(lock) {
|
|
20469
|
+
}
|
|
20470
|
+
// disable copy constructors
|
|
20471
|
+
SegmentLock(const SegmentLock &other) = delete;
|
|
20472
|
+
SegmentLock &operator=(const SegmentLock &) = delete;
|
|
20473
|
+
//! enable move constructors
|
|
20474
|
+
SegmentLock(SegmentLock &&other) noexcept {
|
|
20475
|
+
std::swap(lock, other.lock);
|
|
20476
|
+
}
|
|
20477
|
+
SegmentLock &operator=(SegmentLock &&other) noexcept {
|
|
20478
|
+
std::swap(lock, other.lock);
|
|
20479
|
+
return *this;
|
|
20480
|
+
}
|
|
20481
|
+
|
|
20482
|
+
private:
|
|
20483
|
+
unique_lock<mutex> lock;
|
|
20433
20484
|
};
|
|
20434
20485
|
|
|
20435
20486
|
} // namespace duckdb
|
|
@@ -20441,39 +20492,62 @@ namespace duckdb {
|
|
|
20441
20492
|
|
|
20442
20493
|
struct SegmentNode {
|
|
20443
20494
|
idx_t row_start;
|
|
20444
|
-
SegmentBase
|
|
20495
|
+
unique_ptr<SegmentBase> node;
|
|
20445
20496
|
};
|
|
20446
20497
|
|
|
20447
20498
|
//! The SegmentTree maintains a list of all segments of a specific column in a table, and allows searching for a segment
|
|
20448
20499
|
//! by row number
|
|
20449
20500
|
class SegmentTree {
|
|
20450
20501
|
public:
|
|
20451
|
-
//!
|
|
20452
|
-
|
|
20453
|
-
|
|
20454
|
-
|
|
20455
|
-
|
|
20456
|
-
mutex node_lock;
|
|
20502
|
+
//! Locks the segment tree. All methods to the segment tree either lock the segment tree, or take an already
|
|
20503
|
+
//! obtained lock.
|
|
20504
|
+
SegmentLock Lock();
|
|
20505
|
+
|
|
20506
|
+
bool IsEmpty(SegmentLock &);
|
|
20457
20507
|
|
|
20458
|
-
public:
|
|
20459
20508
|
//! Gets a pointer to the first segment. Useful for scans.
|
|
20460
20509
|
SegmentBase *GetRootSegment();
|
|
20510
|
+
SegmentBase *GetRootSegment(SegmentLock &);
|
|
20511
|
+
//! Obtains ownership of the data of the segment tree
|
|
20512
|
+
vector<SegmentNode> MoveSegments(SegmentLock &);
|
|
20461
20513
|
//! Gets a pointer to the nth segment. Negative numbers start from the back.
|
|
20462
20514
|
SegmentBase *GetSegmentByIndex(int64_t index);
|
|
20515
|
+
SegmentBase *GetSegmentByIndex(SegmentLock &, int64_t index);
|
|
20516
|
+
|
|
20463
20517
|
//! Gets a pointer to the last segment. Useful for appends.
|
|
20464
20518
|
SegmentBase *GetLastSegment();
|
|
20519
|
+
SegmentBase *GetLastSegment(SegmentLock &);
|
|
20465
20520
|
//! Gets a pointer to a specific column segment for the given row
|
|
20466
20521
|
SegmentBase *GetSegment(idx_t row_number);
|
|
20522
|
+
SegmentBase *GetSegment(SegmentLock &, idx_t row_number);
|
|
20523
|
+
|
|
20467
20524
|
//! Append a column segment to the tree
|
|
20468
20525
|
void AppendSegment(unique_ptr<SegmentBase> segment);
|
|
20526
|
+
void AppendSegment(SegmentLock &, unique_ptr<SegmentBase> segment);
|
|
20469
20527
|
//! Debug method, check whether the segment is in the segment tree
|
|
20470
20528
|
bool HasSegment(SegmentBase *segment);
|
|
20529
|
+
bool HasSegment(SegmentLock &, SegmentBase *segment);
|
|
20471
20530
|
|
|
20472
20531
|
//! Replace this tree with another tree, taking over its nodes in-place
|
|
20473
20532
|
void Replace(SegmentTree &other);
|
|
20533
|
+
void Replace(SegmentLock &, SegmentTree &other);
|
|
20534
|
+
|
|
20535
|
+
//! Erase all segments after a specific segment
|
|
20536
|
+
void EraseSegments(SegmentLock &, idx_t segment_start);
|
|
20474
20537
|
|
|
20475
|
-
//! Get the segment index of the column segment for the given row
|
|
20538
|
+
//! Get the segment index of the column segment for the given row
|
|
20476
20539
|
idx_t GetSegmentIndex(idx_t row_number);
|
|
20540
|
+
idx_t GetSegmentIndex(SegmentLock &, idx_t row_number);
|
|
20541
|
+
bool TryGetSegmentIndex(SegmentLock &, idx_t row_number, idx_t &);
|
|
20542
|
+
|
|
20543
|
+
void Verify(SegmentLock &);
|
|
20544
|
+
void Verify();
|
|
20545
|
+
|
|
20546
|
+
private:
|
|
20547
|
+
//! The nodes in the tree, can be binary searched
|
|
20548
|
+
vector<SegmentNode> nodes;
|
|
20549
|
+
//! Lock to access or modify the nodes
|
|
20550
|
+
mutex node_lock;
|
|
20477
20551
|
};
|
|
20478
20552
|
|
|
20479
20553
|
} // namespace duckdb
|
|
@@ -23107,6 +23181,7 @@ private:
|
|
|
23107
23181
|
} // namespace duckdb
|
|
23108
23182
|
|
|
23109
23183
|
|
|
23184
|
+
|
|
23110
23185
|
namespace duckdb {
|
|
23111
23186
|
class ColumnSegment;
|
|
23112
23187
|
class LocalTableStorage;
|
|
@@ -23261,7 +23336,7 @@ class CreateIndexScanState : public TableScanState {
|
|
|
23261
23336
|
public:
|
|
23262
23337
|
vector<unique_ptr<StorageLockKey>> locks;
|
|
23263
23338
|
unique_lock<mutex> append_lock;
|
|
23264
|
-
|
|
23339
|
+
SegmentLock segment_lock;
|
|
23265
23340
|
};
|
|
23266
23341
|
|
|
23267
23342
|
} // namespace duckdb
|
|
@@ -23328,8 +23403,8 @@ public:
|
|
|
23328
23403
|
friend class VersionDeleteState;
|
|
23329
23404
|
|
|
23330
23405
|
public:
|
|
23331
|
-
static constexpr const idx_t
|
|
23332
|
-
static constexpr const idx_t
|
|
23406
|
+
static constexpr const idx_t ROW_GROUP_SIZE = STANDARD_ROW_GROUPS_SIZE;
|
|
23407
|
+
static constexpr const idx_t ROW_GROUP_VECTOR_COUNT = ROW_GROUP_SIZE / STANDARD_VECTOR_SIZE;
|
|
23333
23408
|
|
|
23334
23409
|
public:
|
|
23335
23410
|
RowGroup(DatabaseInstance &db, BlockManager &block_manager, DataTableInfo &table_info, idx_t start, idx_t count);
|
|
@@ -25060,7 +25135,7 @@ private:
|
|
|
25060
25135
|
//! The block-level lock
|
|
25061
25136
|
mutex lock;
|
|
25062
25137
|
//! Whether or not the block is loaded/unloaded
|
|
25063
|
-
BlockState state;
|
|
25138
|
+
atomic<BlockState> state;
|
|
25064
25139
|
//! Amount of concurrent readers
|
|
25065
25140
|
atomic<int32_t> readers;
|
|
25066
25141
|
//! The block id of the block
|
|
@@ -26048,6 +26123,7 @@ private:
|
|
|
26048
26123
|
|
|
26049
26124
|
|
|
26050
26125
|
|
|
26126
|
+
|
|
26051
26127
|
namespace duckdb {
|
|
26052
26128
|
struct ParallelTableScanState;
|
|
26053
26129
|
|
|
@@ -26066,11 +26142,11 @@ public:
|
|
|
26066
26142
|
Allocator &GetAllocator() const;
|
|
26067
26143
|
|
|
26068
26144
|
void Initialize(PersistentTableData &data);
|
|
26145
|
+
void InitializeEmpty();
|
|
26069
26146
|
|
|
26070
26147
|
bool IsEmpty() const;
|
|
26071
26148
|
|
|
26072
|
-
|
|
26073
|
-
void AppendRowGroup(idx_t start_row);
|
|
26149
|
+
void AppendRowGroup(SegmentLock &l, idx_t start_row);
|
|
26074
26150
|
//! Get the nth row-group, negative numbers start from the back (so -1 is the last row group, etc)
|
|
26075
26151
|
RowGroup *GetRowGroup(int64_t index);
|
|
26076
26152
|
void Verify();
|
|
@@ -26084,6 +26160,10 @@ public:
|
|
|
26084
26160
|
void InitializeParallelScan(ParallelCollectionScanState &state);
|
|
26085
26161
|
bool NextParallelScan(ClientContext &context, ParallelCollectionScanState &state, CollectionScanState &scan_state);
|
|
26086
26162
|
|
|
26163
|
+
bool Scan(Transaction &transaction, const vector<column_t> &column_ids,
|
|
26164
|
+
const std::function<bool(DataChunk &chunk)> &fun);
|
|
26165
|
+
bool Scan(Transaction &transaction, const std::function<bool(DataChunk &chunk)> &fun);
|
|
26166
|
+
|
|
26087
26167
|
void Fetch(TransactionData transaction, DataChunk &result, const vector<column_t> &column_ids,
|
|
26088
26168
|
Vector &row_identifiers, idx_t fetch_count, ColumnFetchState &state);
|
|
26089
26169
|
|
|
@@ -26092,7 +26172,7 @@ public:
|
|
|
26092
26172
|
//! Initialize an append with a known number of rows. FinalizeAppend should not be called after appending is done.
|
|
26093
26173
|
void InitializeAppend(TransactionData transaction, TableAppendState &state, idx_t append_count);
|
|
26094
26174
|
//! Appends to the row group collection. Returns true if a new row group has been created to append to
|
|
26095
|
-
bool Append(DataChunk &chunk, TableAppendState &state
|
|
26175
|
+
bool Append(DataChunk &chunk, TableAppendState &state);
|
|
26096
26176
|
//! FinalizeAppend flushes an append with a variable number of rows.
|
|
26097
26177
|
void FinalizeAppend(TransactionData transaction, TableAppendState &state);
|
|
26098
26178
|
void CommitAppend(transaction_t commit_id, idx_t row_start, idx_t count);
|
|
@@ -26103,10 +26183,9 @@ public:
|
|
|
26103
26183
|
void RemoveFromIndexes(TableIndexList &indexes, Vector &row_identifiers, idx_t count);
|
|
26104
26184
|
|
|
26105
26185
|
idx_t Delete(TransactionData transaction, DataTable *table, row_t *ids, idx_t count);
|
|
26106
|
-
void Update(TransactionData transaction, row_t *ids, const vector<column_t> &column_ids, DataChunk &updates
|
|
26107
|
-
TableStatistics &stats);
|
|
26186
|
+
void Update(TransactionData transaction, row_t *ids, const vector<column_t> &column_ids, DataChunk &updates);
|
|
26108
26187
|
void UpdateColumn(TransactionData transaction, Vector &row_ids, const vector<column_t> &column_path,
|
|
26109
|
-
DataChunk &updates
|
|
26188
|
+
DataChunk &updates);
|
|
26110
26189
|
|
|
26111
26190
|
void Checkpoint(TableDataWriter &writer, vector<unique_ptr<BaseStatistics>> &global_stats);
|
|
26112
26191
|
|
|
@@ -26116,14 +26195,18 @@ public:
|
|
|
26116
26195
|
vector<vector<Value>> GetStorageInfo();
|
|
26117
26196
|
const vector<LogicalType> &GetTypes() const;
|
|
26118
26197
|
|
|
26119
|
-
shared_ptr<RowGroupCollection> AddColumn(ColumnDefinition &new_column, Expression *default_value
|
|
26120
|
-
ColumnStatistics &stats);
|
|
26198
|
+
shared_ptr<RowGroupCollection> AddColumn(ColumnDefinition &new_column, Expression *default_value);
|
|
26121
26199
|
shared_ptr<RowGroupCollection> RemoveColumn(idx_t col_idx);
|
|
26122
26200
|
shared_ptr<RowGroupCollection> AlterType(idx_t changed_idx, const LogicalType &target_type,
|
|
26123
|
-
vector<column_t> bound_columns, Expression &cast_expr
|
|
26124
|
-
ColumnStatistics &stats);
|
|
26201
|
+
vector<column_t> bound_columns, Expression &cast_expr);
|
|
26125
26202
|
void VerifyNewConstraint(DataTable &parent, const BoundConstraint &constraint);
|
|
26126
26203
|
|
|
26204
|
+
unique_ptr<BaseStatistics> CopyStats(column_t column_id);
|
|
26205
|
+
void SetStatistics(column_t column_id, const std::function<void(BaseStatistics &)> &set_fun);
|
|
26206
|
+
|
|
26207
|
+
private:
|
|
26208
|
+
bool IsEmpty(SegmentLock &) const;
|
|
26209
|
+
|
|
26127
26210
|
private:
|
|
26128
26211
|
//! BlockManager
|
|
26129
26212
|
BlockManager &block_manager;
|
|
@@ -26134,6 +26217,8 @@ private:
|
|
|
26134
26217
|
idx_t row_start;
|
|
26135
26218
|
//! The segment trees holding the various row_groups of the table
|
|
26136
26219
|
shared_ptr<SegmentTree> row_groups;
|
|
26220
|
+
//! Table statistics
|
|
26221
|
+
TableStatistics stats;
|
|
26137
26222
|
};
|
|
26138
26223
|
|
|
26139
26224
|
} // namespace duckdb
|
|
@@ -26159,6 +26244,31 @@ class DataTable;
|
|
|
26159
26244
|
class WriteAheadLog;
|
|
26160
26245
|
struct TableAppendState;
|
|
26161
26246
|
|
|
26247
|
+
class OptimisticDataWriter {
|
|
26248
|
+
public:
|
|
26249
|
+
OptimisticDataWriter(DataTable *table);
|
|
26250
|
+
OptimisticDataWriter(DataTable *table, OptimisticDataWriter &parent);
|
|
26251
|
+
~OptimisticDataWriter();
|
|
26252
|
+
|
|
26253
|
+
void CheckFlushToDisk(RowGroupCollection &row_groups);
|
|
26254
|
+
//! Flushes a specific row group to disk
|
|
26255
|
+
void FlushToDisk(RowGroup *row_group);
|
|
26256
|
+
//! Flushes the final row group to disk (if any)
|
|
26257
|
+
void FlushToDisk(RowGroupCollection &row_groups);
|
|
26258
|
+
//! Final flush: flush the partial block manager to disk
|
|
26259
|
+
void FinalFlush();
|
|
26260
|
+
|
|
26261
|
+
void Rollback();
|
|
26262
|
+
|
|
26263
|
+
private:
|
|
26264
|
+
//! The table
|
|
26265
|
+
DataTable *table;
|
|
26266
|
+
//! The partial block manager (if we created one yet)
|
|
26267
|
+
unique_ptr<PartialBlockManager> partial_manager;
|
|
26268
|
+
//! The set of blocks that have been pre-emptively written to disk
|
|
26269
|
+
unordered_set<block_id_t> written_blocks;
|
|
26270
|
+
};
|
|
26271
|
+
|
|
26162
26272
|
class LocalTableStorage : public std::enable_shared_from_this<LocalTableStorage> {
|
|
26163
26273
|
public:
|
|
26164
26274
|
// Create a new LocalTableStorage
|
|
@@ -26180,40 +26290,45 @@ public:
|
|
|
26180
26290
|
shared_ptr<RowGroupCollection> row_groups;
|
|
26181
26291
|
//! The set of unique indexes
|
|
26182
26292
|
TableIndexList indexes;
|
|
26183
|
-
//! Stats
|
|
26184
|
-
TableStatistics stats;
|
|
26185
26293
|
//! The number of deleted rows
|
|
26186
26294
|
idx_t deleted_rows;
|
|
26187
|
-
//! The
|
|
26188
|
-
|
|
26189
|
-
//! The set of blocks that have been pre-emptively written to disk
|
|
26190
|
-
unordered_set<block_id_t> written_blocks;
|
|
26295
|
+
//! The optimistic data writer
|
|
26296
|
+
OptimisticDataWriter optimistic_writer;
|
|
26191
26297
|
|
|
26192
26298
|
public:
|
|
26193
26299
|
void InitializeScan(CollectionScanState &state, TableFilterSet *table_filters = nullptr);
|
|
26194
26300
|
//! Check if we should flush the previously written row-group to disk
|
|
26195
26301
|
void CheckFlushToDisk();
|
|
26196
|
-
//! Flushes a specific row group to disk
|
|
26197
|
-
void FlushToDisk(RowGroup *row_group);
|
|
26198
26302
|
//! Flushes the final row group to disk (if any)
|
|
26199
26303
|
void FlushToDisk();
|
|
26200
|
-
//! Whether or not the local table storag ehas optimistically written blocks
|
|
26201
|
-
bool HasWrittenBlocks();
|
|
26202
26304
|
void Rollback();
|
|
26203
26305
|
idx_t EstimatedSize();
|
|
26204
26306
|
|
|
26205
26307
|
void AppendToIndexes(Transaction &transaction, TableAppendState &append_state, idx_t append_count,
|
|
26206
26308
|
bool append_to_table);
|
|
26309
|
+
};
|
|
26310
|
+
|
|
26311
|
+
class LocalTableManager {
|
|
26312
|
+
public:
|
|
26313
|
+
shared_ptr<LocalTableStorage> MoveEntry(DataTable *table);
|
|
26314
|
+
unordered_map<DataTable *, shared_ptr<LocalTableStorage>> MoveEntries();
|
|
26315
|
+
LocalTableStorage *GetStorage(DataTable *table);
|
|
26316
|
+
LocalTableStorage *GetOrCreateStorage(DataTable *table);
|
|
26317
|
+
idx_t EstimatedSize();
|
|
26318
|
+
bool IsEmpty();
|
|
26319
|
+
void InsertEntry(DataTable *table, shared_ptr<LocalTableStorage> entry);
|
|
26207
26320
|
|
|
26208
26321
|
private:
|
|
26209
|
-
|
|
26210
|
-
|
|
26211
|
-
template <class T>
|
|
26212
|
-
bool ScanTableStorage(Transaction &transaction, const vector<column_t> &column_ids, T &&fun);
|
|
26322
|
+
mutex table_storage_lock;
|
|
26323
|
+
unordered_map<DataTable *, shared_ptr<LocalTableStorage>> table_storage;
|
|
26213
26324
|
};
|
|
26214
26325
|
|
|
26215
26326
|
//! The LocalStorage class holds appends that have not been committed yet
|
|
26216
26327
|
class LocalStorage {
|
|
26328
|
+
public:
|
|
26329
|
+
// Threshold to merge row groups instead of appending
|
|
26330
|
+
static constexpr const idx_t MERGE_THRESHOLD = RowGroup::ROW_GROUP_SIZE / 2;
|
|
26331
|
+
|
|
26217
26332
|
public:
|
|
26218
26333
|
struct CommitState {
|
|
26219
26334
|
unordered_map<DataTable *, unique_ptr<TableAppendState>> append_states;
|
|
@@ -26240,6 +26355,9 @@ public:
|
|
|
26240
26355
|
static void Append(LocalAppendState &state, DataChunk &chunk);
|
|
26241
26356
|
//! Finish appending to the local storage
|
|
26242
26357
|
static void FinalizeAppend(LocalAppendState &state);
|
|
26358
|
+
//! Merge a row group collection into the transaction-local storage
|
|
26359
|
+
void LocalMerge(DataTable *table, RowGroupCollection &collection);
|
|
26360
|
+
|
|
26243
26361
|
//! Delete a set of rows from the local storage
|
|
26244
26362
|
idx_t Delete(DataTable *table, Vector &row_ids, idx_t count);
|
|
26245
26363
|
//! Update a set of rows in the local storage
|
|
@@ -26250,14 +26368,10 @@ public:
|
|
|
26250
26368
|
//! Rollback the local storage
|
|
26251
26369
|
void Rollback();
|
|
26252
26370
|
|
|
26253
|
-
bool ChangesMade() noexcept
|
|
26254
|
-
return table_storage.size() > 0;
|
|
26255
|
-
}
|
|
26371
|
+
bool ChangesMade() noexcept;
|
|
26256
26372
|
idx_t EstimatedSize();
|
|
26257
26373
|
|
|
26258
|
-
bool Find(DataTable *table)
|
|
26259
|
-
return table_storage.find(table) != table_storage.end();
|
|
26260
|
-
}
|
|
26374
|
+
bool Find(DataTable *table);
|
|
26261
26375
|
|
|
26262
26376
|
idx_t AddedRows(DataTable *table);
|
|
26263
26377
|
|
|
@@ -26272,12 +26386,9 @@ public:
|
|
|
26272
26386
|
|
|
26273
26387
|
void VerifyNewConstraint(DataTable &parent, const BoundConstraint &constraint);
|
|
26274
26388
|
|
|
26275
|
-
private:
|
|
26276
|
-
LocalTableStorage *GetStorage(DataTable *table);
|
|
26277
|
-
|
|
26278
26389
|
private:
|
|
26279
26390
|
Transaction &transaction;
|
|
26280
|
-
|
|
26391
|
+
LocalTableManager table_manager;
|
|
26281
26392
|
|
|
26282
26393
|
void Flush(DataTable &table, LocalTableStorage &storage);
|
|
26283
26394
|
};
|
|
@@ -26400,6 +26511,8 @@ public:
|
|
|
26400
26511
|
void LocalAppend(TableCatalogEntry &table, ClientContext &context, DataChunk &chunk);
|
|
26401
26512
|
//! Append a column data collection to the transaction-local storage of this table
|
|
26402
26513
|
void LocalAppend(TableCatalogEntry &table, ClientContext &context, ColumnDataCollection &collection);
|
|
26514
|
+
//! Merge a row group collection into the transaction-local storage
|
|
26515
|
+
void LocalMerge(ClientContext &context, RowGroupCollection &collection);
|
|
26403
26516
|
|
|
26404
26517
|
//! Delete the entries with the specified row identifier from the table
|
|
26405
26518
|
idx_t Delete(TableCatalogEntry &table, ClientContext &context, Vector &row_ids, idx_t count);
|
|
@@ -26436,7 +26549,7 @@ public:
|
|
|
26436
26549
|
void ScanTableSegment(idx_t start_row, idx_t count, const std::function<void(DataChunk &chunk)> &function);
|
|
26437
26550
|
|
|
26438
26551
|
//! Merge a row group collection directly into this table - appending it to the end of the table without copying
|
|
26439
|
-
void MergeStorage(RowGroupCollection &data, TableIndexList &indexes
|
|
26552
|
+
void MergeStorage(RowGroupCollection &data, TableIndexList &indexes);
|
|
26440
26553
|
|
|
26441
26554
|
//! Append a chunk with the row ids [row_start, ..., row_start + chunk.size()] to all indexes of the table, returns
|
|
26442
26555
|
//! whether or not the append succeeded
|
|
@@ -26494,8 +26607,6 @@ private:
|
|
|
26494
26607
|
mutex append_lock;
|
|
26495
26608
|
//! The row groups of the table
|
|
26496
26609
|
shared_ptr<RowGroupCollection> row_groups;
|
|
26497
|
-
//! Table statistics
|
|
26498
|
-
TableStatistics stats;
|
|
26499
26610
|
//! Whether or not the data table is the root DataTable for this table; the root DataTable is the newest version
|
|
26500
26611
|
//! that can be appended to
|
|
26501
26612
|
atomic<bool> is_root;
|
|
@@ -29359,7 +29470,7 @@ private:
|
|
|
29359
29470
|
//===----------------------------------------------------------------------===//
|
|
29360
29471
|
// DuckDB
|
|
29361
29472
|
//
|
|
29362
|
-
// duckdb/parser/expression/
|
|
29473
|
+
// duckdb/parser/expression/between_expression.hpp
|
|
29363
29474
|
//
|
|
29364
29475
|
//
|
|
29365
29476
|
//===----------------------------------------------------------------------===//
|
|
@@ -29369,28 +29480,38 @@ private:
|
|
|
29369
29480
|
|
|
29370
29481
|
|
|
29371
29482
|
namespace duckdb {
|
|
29372
|
-
//! Represents the default value of a column
|
|
29373
|
-
class DefaultExpression : public ParsedExpression {
|
|
29374
|
-
public:
|
|
29375
|
-
DefaultExpression();
|
|
29376
29483
|
|
|
29484
|
+
class BetweenExpression : public ParsedExpression {
|
|
29377
29485
|
public:
|
|
29378
|
-
|
|
29379
|
-
|
|
29380
|
-
|
|
29486
|
+
DUCKDB_API BetweenExpression(unique_ptr<ParsedExpression> input, unique_ptr<ParsedExpression> lower,
|
|
29487
|
+
unique_ptr<ParsedExpression> upper);
|
|
29488
|
+
|
|
29489
|
+
unique_ptr<ParsedExpression> input;
|
|
29490
|
+
unique_ptr<ParsedExpression> lower;
|
|
29491
|
+
unique_ptr<ParsedExpression> upper;
|
|
29381
29492
|
|
|
29493
|
+
public:
|
|
29382
29494
|
string ToString() const override;
|
|
29383
29495
|
|
|
29496
|
+
static bool Equals(const BetweenExpression *a, const BetweenExpression *b);
|
|
29497
|
+
|
|
29384
29498
|
unique_ptr<ParsedExpression> Copy() const override;
|
|
29385
29499
|
|
|
29386
29500
|
void Serialize(FieldWriter &writer) const override;
|
|
29387
29501
|
static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
|
|
29502
|
+
|
|
29503
|
+
public:
|
|
29504
|
+
template <class T, class BASE>
|
|
29505
|
+
static string ToString(const T &entry) {
|
|
29506
|
+
return "(" + entry.input->ToString() + " BETWEEN " + entry.lower->ToString() + " AND " +
|
|
29507
|
+
entry.upper->ToString() + ")";
|
|
29508
|
+
}
|
|
29388
29509
|
};
|
|
29389
29510
|
} // namespace duckdb
|
|
29390
29511
|
//===----------------------------------------------------------------------===//
|
|
29391
29512
|
// DuckDB
|
|
29392
29513
|
//
|
|
29393
|
-
// duckdb/parser/expression/
|
|
29514
|
+
// duckdb/parser/expression/positional_reference_expression.hpp
|
|
29394
29515
|
//
|
|
29395
29516
|
//
|
|
29396
29517
|
//===----------------------------------------------------------------------===//
|
|
@@ -29400,24 +29521,20 @@ public:
|
|
|
29400
29521
|
|
|
29401
29522
|
|
|
29402
29523
|
namespace duckdb {
|
|
29403
|
-
class
|
|
29524
|
+
class PositionalReferenceExpression : public ParsedExpression {
|
|
29404
29525
|
public:
|
|
29405
|
-
|
|
29526
|
+
DUCKDB_API PositionalReferenceExpression(idx_t index);
|
|
29406
29527
|
|
|
29407
|
-
idx_t
|
|
29528
|
+
idx_t index;
|
|
29408
29529
|
|
|
29409
29530
|
public:
|
|
29410
29531
|
bool IsScalar() const override {
|
|
29411
|
-
return
|
|
29412
|
-
}
|
|
29413
|
-
bool HasParameter() const override {
|
|
29414
|
-
return true;
|
|
29532
|
+
return false;
|
|
29415
29533
|
}
|
|
29416
29534
|
|
|
29417
29535
|
string ToString() const override;
|
|
29418
29536
|
|
|
29419
|
-
static bool Equals(const
|
|
29420
|
-
|
|
29537
|
+
static bool Equals(const PositionalReferenceExpression *a, const PositionalReferenceExpression *b);
|
|
29421
29538
|
unique_ptr<ParsedExpression> Copy() const override;
|
|
29422
29539
|
hash_t Hash() const override;
|
|
29423
29540
|
|
|
@@ -29428,7 +29545,7 @@ public:
|
|
|
29428
29545
|
//===----------------------------------------------------------------------===//
|
|
29429
29546
|
// DuckDB
|
|
29430
29547
|
//
|
|
29431
|
-
// duckdb/parser/expression/
|
|
29548
|
+
// duckdb/parser/expression/case_expression.hpp
|
|
29432
29549
|
//
|
|
29433
29550
|
//
|
|
29434
29551
|
//===----------------------------------------------------------------------===//
|
|
@@ -29438,117 +29555,52 @@ public:
|
|
|
29438
29555
|
|
|
29439
29556
|
|
|
29440
29557
|
|
|
29441
|
-
|
|
29442
29558
|
namespace duckdb {
|
|
29443
|
-
|
|
29444
|
-
|
|
29559
|
+
|
|
29560
|
+
struct CaseCheck {
|
|
29561
|
+
unique_ptr<ParsedExpression> when_expr;
|
|
29562
|
+
unique_ptr<ParsedExpression> then_expr;
|
|
29563
|
+
};
|
|
29564
|
+
|
|
29565
|
+
//! The CaseExpression represents a CASE expression in the query
|
|
29566
|
+
class CaseExpression : public ParsedExpression {
|
|
29445
29567
|
public:
|
|
29446
|
-
DUCKDB_API
|
|
29447
|
-
vector<unique_ptr<ParsedExpression>> children,
|
|
29448
|
-
unique_ptr<ParsedExpression> filter = nullptr,
|
|
29449
|
-
unique_ptr<OrderModifier> order_bys = nullptr, bool distinct = false,
|
|
29450
|
-
bool is_operator = false, bool export_state = false);
|
|
29451
|
-
DUCKDB_API FunctionExpression(const string &function_name, vector<unique_ptr<ParsedExpression>> children,
|
|
29452
|
-
unique_ptr<ParsedExpression> filter = nullptr,
|
|
29453
|
-
unique_ptr<OrderModifier> order_bys = nullptr, bool distinct = false,
|
|
29454
|
-
bool is_operator = false, bool export_state = false);
|
|
29568
|
+
DUCKDB_API CaseExpression();
|
|
29455
29569
|
|
|
29456
|
-
|
|
29457
|
-
|
|
29458
|
-
//! Function name
|
|
29459
|
-
string function_name;
|
|
29460
|
-
//! Whether or not the function is an operator, only used for rendering
|
|
29461
|
-
bool is_operator;
|
|
29462
|
-
//! List of arguments to the function
|
|
29463
|
-
vector<unique_ptr<ParsedExpression>> children;
|
|
29464
|
-
//! Whether or not the aggregate function is distinct, only used for aggregates
|
|
29465
|
-
bool distinct;
|
|
29466
|
-
//! Expression representing a filter, only used for aggregates
|
|
29467
|
-
unique_ptr<ParsedExpression> filter;
|
|
29468
|
-
//! Modifier representing an ORDER BY, only used for aggregates
|
|
29469
|
-
unique_ptr<OrderModifier> order_bys;
|
|
29470
|
-
//! whether this function should export its state or not
|
|
29471
|
-
bool export_state;
|
|
29570
|
+
vector<CaseCheck> case_checks;
|
|
29571
|
+
unique_ptr<ParsedExpression> else_expr;
|
|
29472
29572
|
|
|
29473
29573
|
public:
|
|
29474
29574
|
string ToString() const override;
|
|
29475
29575
|
|
|
29476
|
-
|
|
29576
|
+
static bool Equals(const CaseExpression *a, const CaseExpression *b);
|
|
29477
29577
|
|
|
29478
|
-
|
|
29479
|
-
hash_t Hash() const override;
|
|
29578
|
+
unique_ptr<ParsedExpression> Copy() const override;
|
|
29480
29579
|
|
|
29481
29580
|
void Serialize(FieldWriter &writer) const override;
|
|
29482
29581
|
static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
|
|
29483
29582
|
|
|
29484
|
-
void Verify() const override;
|
|
29485
|
-
|
|
29486
29583
|
public:
|
|
29487
29584
|
template <class T, class BASE>
|
|
29488
|
-
static string ToString(const T &entry
|
|
29489
|
-
|
|
29490
|
-
|
|
29491
|
-
|
|
29492
|
-
|
|
29493
|
-
D_ASSERT(!distinct);
|
|
29494
|
-
if (entry.children.size() == 1) {
|
|
29495
|
-
if (StringUtil::Contains(function_name, "__postfix")) {
|
|
29496
|
-
return "(" + entry.children[0]->ToString() + ")" +
|
|
29497
|
-
StringUtil::Replace(function_name, "__postfix", "");
|
|
29498
|
-
} else {
|
|
29499
|
-
return function_name + "(" + entry.children[0]->ToString() + ")";
|
|
29500
|
-
}
|
|
29501
|
-
} else if (entry.children.size() == 2) {
|
|
29502
|
-
return StringUtil::Format("(%s %s %s)", entry.children[0]->ToString(), function_name,
|
|
29503
|
-
entry.children[1]->ToString());
|
|
29504
|
-
}
|
|
29505
|
-
}
|
|
29506
|
-
// standard function call
|
|
29507
|
-
string result = schema.empty() ? function_name : schema + "." + function_name;
|
|
29508
|
-
result += "(";
|
|
29509
|
-
if (distinct) {
|
|
29510
|
-
result += "DISTINCT ";
|
|
29511
|
-
}
|
|
29512
|
-
result += StringUtil::Join(entry.children, entry.children.size(), ", ", [&](const unique_ptr<BASE> &child) {
|
|
29513
|
-
return child->alias.empty() || !add_alias
|
|
29514
|
-
? child->ToString()
|
|
29515
|
-
: KeywordHelper::WriteOptionallyQuoted(child->alias) + " := " + child->ToString();
|
|
29516
|
-
});
|
|
29517
|
-
// ordered aggregate
|
|
29518
|
-
if (order_bys && !order_bys->orders.empty()) {
|
|
29519
|
-
if (entry.children.empty()) {
|
|
29520
|
-
result += ") WITHIN GROUP (";
|
|
29521
|
-
}
|
|
29522
|
-
result += " ORDER BY ";
|
|
29523
|
-
for (idx_t i = 0; i < order_bys->orders.size(); i++) {
|
|
29524
|
-
if (i > 0) {
|
|
29525
|
-
result += ", ";
|
|
29526
|
-
}
|
|
29527
|
-
result += order_bys->orders[i].ToString();
|
|
29528
|
-
}
|
|
29585
|
+
static string ToString(const T &entry) {
|
|
29586
|
+
string case_str = "CASE ";
|
|
29587
|
+
for (auto &check : entry.case_checks) {
|
|
29588
|
+
case_str += " WHEN (" + check.when_expr->ToString() + ")";
|
|
29589
|
+
case_str += " THEN (" + check.then_expr->ToString() + ")";
|
|
29529
29590
|
}
|
|
29530
|
-
|
|
29531
|
-
|
|
29532
|
-
|
|
29533
|
-
|
|
29534
|
-
|
|
29535
|
-
|
|
29536
|
-
|
|
29537
|
-
|
|
29538
|
-
|
|
29539
|
-
|
|
29540
|
-
|
|
29541
|
-
|
|
29542
|
-
|
|
29543
|
-
};
|
|
29544
|
-
} // namespace duckdb
|
|
29545
|
-
//===----------------------------------------------------------------------===//
|
|
29546
|
-
// DuckDB
|
|
29547
|
-
//
|
|
29548
|
-
// duckdb/parser/expression/comparison_expression.hpp
|
|
29549
|
-
//
|
|
29550
|
-
//
|
|
29551
|
-
//===----------------------------------------------------------------------===//
|
|
29591
|
+
case_str += " ELSE " + entry.else_expr->ToString();
|
|
29592
|
+
case_str += " END";
|
|
29593
|
+
return case_str;
|
|
29594
|
+
}
|
|
29595
|
+
};
|
|
29596
|
+
} // namespace duckdb
|
|
29597
|
+
//===----------------------------------------------------------------------===//
|
|
29598
|
+
// DuckDB
|
|
29599
|
+
//
|
|
29600
|
+
// duckdb/parser/expression/comparison_expression.hpp
|
|
29601
|
+
//
|
|
29602
|
+
//
|
|
29603
|
+
//===----------------------------------------------------------------------===//
|
|
29552
29604
|
|
|
29553
29605
|
|
|
29554
29606
|
|
|
@@ -29582,6 +29634,42 @@ public:
|
|
|
29582
29634
|
entry.right->ToString());
|
|
29583
29635
|
}
|
|
29584
29636
|
};
|
|
29637
|
+
} // namespace duckdb
|
|
29638
|
+
//===----------------------------------------------------------------------===//
|
|
29639
|
+
// DuckDB
|
|
29640
|
+
//
|
|
29641
|
+
// duckdb/parser/expression/constant_expression.hpp
|
|
29642
|
+
//
|
|
29643
|
+
//
|
|
29644
|
+
//===----------------------------------------------------------------------===//
|
|
29645
|
+
|
|
29646
|
+
|
|
29647
|
+
|
|
29648
|
+
|
|
29649
|
+
|
|
29650
|
+
|
|
29651
|
+
namespace duckdb {
|
|
29652
|
+
|
|
29653
|
+
//! ConstantExpression represents a constant value in the query
|
|
29654
|
+
class ConstantExpression : public ParsedExpression {
|
|
29655
|
+
public:
|
|
29656
|
+
DUCKDB_API explicit ConstantExpression(Value val);
|
|
29657
|
+
|
|
29658
|
+
//! The constant value referenced
|
|
29659
|
+
Value value;
|
|
29660
|
+
|
|
29661
|
+
public:
|
|
29662
|
+
string ToString() const override;
|
|
29663
|
+
|
|
29664
|
+
static bool Equals(const ConstantExpression *a, const ConstantExpression *b);
|
|
29665
|
+
hash_t Hash() const override;
|
|
29666
|
+
|
|
29667
|
+
unique_ptr<ParsedExpression> Copy() const override;
|
|
29668
|
+
|
|
29669
|
+
void Serialize(FieldWriter &writer) const override;
|
|
29670
|
+
static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
|
|
29671
|
+
};
|
|
29672
|
+
|
|
29585
29673
|
} // namespace duckdb
|
|
29586
29674
|
//===----------------------------------------------------------------------===//
|
|
29587
29675
|
// DuckDB
|
|
@@ -29624,6 +29712,37 @@ public:
|
|
|
29624
29712
|
//===----------------------------------------------------------------------===//
|
|
29625
29713
|
// DuckDB
|
|
29626
29714
|
//
|
|
29715
|
+
// duckdb/parser/expression/default_expression.hpp
|
|
29716
|
+
//
|
|
29717
|
+
//
|
|
29718
|
+
//===----------------------------------------------------------------------===//
|
|
29719
|
+
|
|
29720
|
+
|
|
29721
|
+
|
|
29722
|
+
|
|
29723
|
+
|
|
29724
|
+
namespace duckdb {
|
|
29725
|
+
//! Represents the default value of a column
|
|
29726
|
+
class DefaultExpression : public ParsedExpression {
|
|
29727
|
+
public:
|
|
29728
|
+
DefaultExpression();
|
|
29729
|
+
|
|
29730
|
+
public:
|
|
29731
|
+
bool IsScalar() const override {
|
|
29732
|
+
return false;
|
|
29733
|
+
}
|
|
29734
|
+
|
|
29735
|
+
string ToString() const override;
|
|
29736
|
+
|
|
29737
|
+
unique_ptr<ParsedExpression> Copy() const override;
|
|
29738
|
+
|
|
29739
|
+
void Serialize(FieldWriter &writer) const override;
|
|
29740
|
+
static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
|
|
29741
|
+
};
|
|
29742
|
+
} // namespace duckdb
|
|
29743
|
+
//===----------------------------------------------------------------------===//
|
|
29744
|
+
// DuckDB
|
|
29745
|
+
//
|
|
29627
29746
|
// duckdb/parser/expression/operator_expression.hpp
|
|
29628
29747
|
//
|
|
29629
29748
|
//
|
|
@@ -29731,44 +29850,13 @@ public:
|
|
|
29731
29850
|
};
|
|
29732
29851
|
|
|
29733
29852
|
} // namespace duckdb
|
|
29734
|
-
//===----------------------------------------------------------------------===//
|
|
29735
|
-
// DuckDB
|
|
29736
|
-
//
|
|
29737
|
-
// duckdb/parser/expression/positional_reference_expression.hpp
|
|
29738
|
-
//
|
|
29739
|
-
//
|
|
29740
|
-
//===----------------------------------------------------------------------===//
|
|
29741
|
-
|
|
29742
29853
|
|
|
29743
29854
|
|
|
29744
29855
|
|
|
29745
|
-
|
|
29746
|
-
namespace duckdb {
|
|
29747
|
-
class PositionalReferenceExpression : public ParsedExpression {
|
|
29748
|
-
public:
|
|
29749
|
-
DUCKDB_API PositionalReferenceExpression(idx_t index);
|
|
29750
|
-
|
|
29751
|
-
idx_t index;
|
|
29752
|
-
|
|
29753
|
-
public:
|
|
29754
|
-
bool IsScalar() const override {
|
|
29755
|
-
return false;
|
|
29756
|
-
}
|
|
29757
|
-
|
|
29758
|
-
string ToString() const override;
|
|
29759
|
-
|
|
29760
|
-
static bool Equals(const PositionalReferenceExpression *a, const PositionalReferenceExpression *b);
|
|
29761
|
-
unique_ptr<ParsedExpression> Copy() const override;
|
|
29762
|
-
hash_t Hash() const override;
|
|
29763
|
-
|
|
29764
|
-
void Serialize(FieldWriter &writer) const override;
|
|
29765
|
-
static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
|
|
29766
|
-
};
|
|
29767
|
-
} // namespace duckdb
|
|
29768
29856
|
//===----------------------------------------------------------------------===//
|
|
29769
29857
|
// DuckDB
|
|
29770
29858
|
//
|
|
29771
|
-
// duckdb/parser/expression/
|
|
29859
|
+
// duckdb/parser/expression/cast_expression.hpp
|
|
29772
29860
|
//
|
|
29773
29861
|
//
|
|
29774
29862
|
//===----------------------------------------------------------------------===//
|
|
@@ -29780,22 +29868,22 @@ public:
|
|
|
29780
29868
|
|
|
29781
29869
|
namespace duckdb {
|
|
29782
29870
|
|
|
29783
|
-
//!
|
|
29784
|
-
class
|
|
29871
|
+
//! CastExpression represents a type cast from one SQL type to another SQL type
|
|
29872
|
+
class CastExpression : public ParsedExpression {
|
|
29785
29873
|
public:
|
|
29786
|
-
DUCKDB_API
|
|
29787
|
-
DUCKDB_API ConjunctionExpression(ExpressionType type, vector<unique_ptr<ParsedExpression>> children);
|
|
29788
|
-
DUCKDB_API ConjunctionExpression(ExpressionType type, unique_ptr<ParsedExpression> left,
|
|
29789
|
-
unique_ptr<ParsedExpression> right);
|
|
29874
|
+
DUCKDB_API CastExpression(LogicalType target, unique_ptr<ParsedExpression> child, bool try_cast = false);
|
|
29790
29875
|
|
|
29791
|
-
|
|
29876
|
+
//! The child of the cast expression
|
|
29877
|
+
unique_ptr<ParsedExpression> child;
|
|
29878
|
+
//! The type to cast to
|
|
29879
|
+
LogicalType cast_type;
|
|
29880
|
+
//! Whether or not this is a try_cast expression
|
|
29881
|
+
bool try_cast;
|
|
29792
29882
|
|
|
29793
29883
|
public:
|
|
29794
|
-
void AddExpression(unique_ptr<ParsedExpression> expr);
|
|
29795
|
-
|
|
29796
29884
|
string ToString() const override;
|
|
29797
29885
|
|
|
29798
|
-
static bool Equals(const
|
|
29886
|
+
static bool Equals(const CastExpression *a, const CastExpression *b);
|
|
29799
29887
|
|
|
29800
29888
|
unique_ptr<ParsedExpression> Copy() const override;
|
|
29801
29889
|
|
|
@@ -29805,18 +29893,16 @@ public:
|
|
|
29805
29893
|
public:
|
|
29806
29894
|
template <class T, class BASE>
|
|
29807
29895
|
static string ToString(const T &entry) {
|
|
29808
|
-
|
|
29809
|
-
|
|
29810
|
-
result += " " + ExpressionTypeToOperator(entry.type) + " " + entry.children[i]->ToString();
|
|
29811
|
-
}
|
|
29812
|
-
return result + ")";
|
|
29896
|
+
return (entry.try_cast ? "TRY_CAST(" : "CAST(") + entry.child->ToString() + " AS " +
|
|
29897
|
+
entry.cast_type.ToString() + ")";
|
|
29813
29898
|
}
|
|
29814
29899
|
};
|
|
29815
29900
|
} // namespace duckdb
|
|
29901
|
+
|
|
29816
29902
|
//===----------------------------------------------------------------------===//
|
|
29817
29903
|
// DuckDB
|
|
29818
29904
|
//
|
|
29819
|
-
// duckdb/parser/expression/
|
|
29905
|
+
// duckdb/parser/expression/collate_expression.hpp
|
|
29820
29906
|
//
|
|
29821
29907
|
//
|
|
29822
29908
|
//===----------------------------------------------------------------------===//
|
|
@@ -29827,37 +29913,34 @@ public:
|
|
|
29827
29913
|
|
|
29828
29914
|
namespace duckdb {
|
|
29829
29915
|
|
|
29830
|
-
|
|
29916
|
+
//! CollateExpression represents a COLLATE statement
|
|
29917
|
+
class CollateExpression : public ParsedExpression {
|
|
29831
29918
|
public:
|
|
29832
|
-
|
|
29833
|
-
unique_ptr<ParsedExpression> upper);
|
|
29919
|
+
CollateExpression(string collation, unique_ptr<ParsedExpression> child);
|
|
29834
29920
|
|
|
29835
|
-
|
|
29836
|
-
unique_ptr<ParsedExpression>
|
|
29837
|
-
|
|
29921
|
+
//! The child of the cast expression
|
|
29922
|
+
unique_ptr<ParsedExpression> child;
|
|
29923
|
+
//! The collation clause
|
|
29924
|
+
string collation;
|
|
29838
29925
|
|
|
29839
29926
|
public:
|
|
29840
29927
|
string ToString() const override;
|
|
29841
29928
|
|
|
29842
|
-
static bool Equals(const
|
|
29929
|
+
static bool Equals(const CollateExpression *a, const CollateExpression *b);
|
|
29843
29930
|
|
|
29844
29931
|
unique_ptr<ParsedExpression> Copy() const override;
|
|
29845
29932
|
|
|
29846
29933
|
void Serialize(FieldWriter &writer) const override;
|
|
29847
29934
|
static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
|
|
29848
|
-
|
|
29849
|
-
public:
|
|
29850
|
-
template <class T, class BASE>
|
|
29851
|
-
static string ToString(const T &entry) {
|
|
29852
|
-
return "(" + entry.input->ToString() + " BETWEEN " + entry.lower->ToString() + " AND " +
|
|
29853
|
-
entry.upper->ToString() + ")";
|
|
29854
|
-
}
|
|
29855
29935
|
};
|
|
29856
29936
|
} // namespace duckdb
|
|
29937
|
+
|
|
29938
|
+
|
|
29939
|
+
|
|
29857
29940
|
//===----------------------------------------------------------------------===//
|
|
29858
29941
|
// DuckDB
|
|
29859
29942
|
//
|
|
29860
|
-
// duckdb/parser/expression/
|
|
29943
|
+
// duckdb/parser/expression/conjunction_expression.hpp
|
|
29861
29944
|
//
|
|
29862
29945
|
//
|
|
29863
29946
|
//===----------------------------------------------------------------------===//
|
|
@@ -29869,22 +29952,22 @@ public:
|
|
|
29869
29952
|
|
|
29870
29953
|
namespace duckdb {
|
|
29871
29954
|
|
|
29872
|
-
//!
|
|
29873
|
-
class
|
|
29955
|
+
//! Represents a conjunction (AND/OR)
|
|
29956
|
+
class ConjunctionExpression : public ParsedExpression {
|
|
29874
29957
|
public:
|
|
29875
|
-
DUCKDB_API
|
|
29958
|
+
DUCKDB_API explicit ConjunctionExpression(ExpressionType type);
|
|
29959
|
+
DUCKDB_API ConjunctionExpression(ExpressionType type, vector<unique_ptr<ParsedExpression>> children);
|
|
29960
|
+
DUCKDB_API ConjunctionExpression(ExpressionType type, unique_ptr<ParsedExpression> left,
|
|
29961
|
+
unique_ptr<ParsedExpression> right);
|
|
29876
29962
|
|
|
29877
|
-
|
|
29878
|
-
unique_ptr<ParsedExpression> child;
|
|
29879
|
-
//! The type to cast to
|
|
29880
|
-
LogicalType cast_type;
|
|
29881
|
-
//! Whether or not this is a try_cast expression
|
|
29882
|
-
bool try_cast;
|
|
29963
|
+
vector<unique_ptr<ParsedExpression>> children;
|
|
29883
29964
|
|
|
29884
29965
|
public:
|
|
29966
|
+
void AddExpression(unique_ptr<ParsedExpression> expr);
|
|
29967
|
+
|
|
29885
29968
|
string ToString() const override;
|
|
29886
29969
|
|
|
29887
|
-
static bool Equals(const
|
|
29970
|
+
static bool Equals(const ConjunctionExpression *a, const ConjunctionExpression *b);
|
|
29888
29971
|
|
|
29889
29972
|
unique_ptr<ParsedExpression> Copy() const override;
|
|
29890
29973
|
|
|
@@ -29894,17 +29977,21 @@ public:
|
|
|
29894
29977
|
public:
|
|
29895
29978
|
template <class T, class BASE>
|
|
29896
29979
|
static string ToString(const T &entry) {
|
|
29897
|
-
|
|
29898
|
-
|
|
29980
|
+
string result = "(" + entry.children[0]->ToString();
|
|
29981
|
+
for (idx_t i = 1; i < entry.children.size(); i++) {
|
|
29982
|
+
result += " " + ExpressionTypeToOperator(entry.type) + " " + entry.children[i]->ToString();
|
|
29983
|
+
}
|
|
29984
|
+
return result + ")";
|
|
29899
29985
|
}
|
|
29900
29986
|
};
|
|
29901
29987
|
} // namespace duckdb
|
|
29902
29988
|
|
|
29903
29989
|
|
|
29990
|
+
|
|
29904
29991
|
//===----------------------------------------------------------------------===//
|
|
29905
29992
|
// DuckDB
|
|
29906
29993
|
//
|
|
29907
|
-
// duckdb/parser/expression/
|
|
29994
|
+
// duckdb/parser/expression/function_expression.hpp
|
|
29908
29995
|
//
|
|
29909
29996
|
//
|
|
29910
29997
|
//===----------------------------------------------------------------------===//
|
|
@@ -29914,90 +30001,117 @@ public:
|
|
|
29914
30001
|
|
|
29915
30002
|
|
|
29916
30003
|
|
|
29917
|
-
namespace duckdb {
|
|
29918
|
-
|
|
29919
|
-
struct CaseCheck {
|
|
29920
|
-
unique_ptr<ParsedExpression> when_expr;
|
|
29921
|
-
unique_ptr<ParsedExpression> then_expr;
|
|
29922
|
-
};
|
|
29923
30004
|
|
|
29924
|
-
|
|
29925
|
-
|
|
30005
|
+
namespace duckdb {
|
|
30006
|
+
//! Represents a function call
|
|
30007
|
+
class FunctionExpression : public ParsedExpression {
|
|
29926
30008
|
public:
|
|
29927
|
-
DUCKDB_API
|
|
30009
|
+
DUCKDB_API FunctionExpression(string schema_name, const string &function_name,
|
|
30010
|
+
vector<unique_ptr<ParsedExpression>> children,
|
|
30011
|
+
unique_ptr<ParsedExpression> filter = nullptr,
|
|
30012
|
+
unique_ptr<OrderModifier> order_bys = nullptr, bool distinct = false,
|
|
30013
|
+
bool is_operator = false, bool export_state = false);
|
|
30014
|
+
DUCKDB_API FunctionExpression(const string &function_name, vector<unique_ptr<ParsedExpression>> children,
|
|
30015
|
+
unique_ptr<ParsedExpression> filter = nullptr,
|
|
30016
|
+
unique_ptr<OrderModifier> order_bys = nullptr, bool distinct = false,
|
|
30017
|
+
bool is_operator = false, bool export_state = false);
|
|
29928
30018
|
|
|
29929
|
-
|
|
29930
|
-
|
|
30019
|
+
//! Schema of the function
|
|
30020
|
+
string schema;
|
|
30021
|
+
//! Function name
|
|
30022
|
+
string function_name;
|
|
30023
|
+
//! Whether or not the function is an operator, only used for rendering
|
|
30024
|
+
bool is_operator;
|
|
30025
|
+
//! List of arguments to the function
|
|
30026
|
+
vector<unique_ptr<ParsedExpression>> children;
|
|
30027
|
+
//! Whether or not the aggregate function is distinct, only used for aggregates
|
|
30028
|
+
bool distinct;
|
|
30029
|
+
//! Expression representing a filter, only used for aggregates
|
|
30030
|
+
unique_ptr<ParsedExpression> filter;
|
|
30031
|
+
//! Modifier representing an ORDER BY, only used for aggregates
|
|
30032
|
+
unique_ptr<OrderModifier> order_bys;
|
|
30033
|
+
//! whether this function should export its state or not
|
|
30034
|
+
bool export_state;
|
|
29931
30035
|
|
|
29932
30036
|
public:
|
|
29933
30037
|
string ToString() const override;
|
|
29934
30038
|
|
|
29935
|
-
static bool Equals(const CaseExpression *a, const CaseExpression *b);
|
|
29936
|
-
|
|
29937
30039
|
unique_ptr<ParsedExpression> Copy() const override;
|
|
29938
30040
|
|
|
30041
|
+
static bool Equals(const FunctionExpression *a, const FunctionExpression *b);
|
|
30042
|
+
hash_t Hash() const override;
|
|
30043
|
+
|
|
29939
30044
|
void Serialize(FieldWriter &writer) const override;
|
|
29940
30045
|
static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
|
|
29941
30046
|
|
|
30047
|
+
void Verify() const override;
|
|
30048
|
+
|
|
29942
30049
|
public:
|
|
29943
30050
|
template <class T, class BASE>
|
|
29944
|
-
static string ToString(const T &entry
|
|
29945
|
-
|
|
29946
|
-
|
|
29947
|
-
|
|
29948
|
-
|
|
30051
|
+
static string ToString(const T &entry, const string &schema, const string &function_name, bool is_operator = false,
|
|
30052
|
+
bool distinct = false, BASE *filter = nullptr, OrderModifier *order_bys = nullptr,
|
|
30053
|
+
bool export_state = false, bool add_alias = false) {
|
|
30054
|
+
if (is_operator) {
|
|
30055
|
+
// built-in operator
|
|
30056
|
+
D_ASSERT(!distinct);
|
|
30057
|
+
if (entry.children.size() == 1) {
|
|
30058
|
+
if (StringUtil::Contains(function_name, "__postfix")) {
|
|
30059
|
+
return "(" + entry.children[0]->ToString() + ")" +
|
|
30060
|
+
StringUtil::Replace(function_name, "__postfix", "");
|
|
30061
|
+
} else {
|
|
30062
|
+
return function_name + "(" + entry.children[0]->ToString() + ")";
|
|
30063
|
+
}
|
|
30064
|
+
} else if (entry.children.size() == 2) {
|
|
30065
|
+
return StringUtil::Format("(%s %s %s)", entry.children[0]->ToString(), function_name,
|
|
30066
|
+
entry.children[1]->ToString());
|
|
30067
|
+
}
|
|
29949
30068
|
}
|
|
29950
|
-
|
|
29951
|
-
|
|
29952
|
-
|
|
29953
|
-
|
|
29954
|
-
|
|
29955
|
-
}
|
|
29956
|
-
|
|
29957
|
-
|
|
29958
|
-
|
|
29959
|
-
|
|
29960
|
-
|
|
29961
|
-
//
|
|
29962
|
-
|
|
29963
|
-
|
|
29964
|
-
|
|
29965
|
-
|
|
29966
|
-
|
|
29967
|
-
|
|
29968
|
-
|
|
29969
|
-
|
|
29970
|
-
|
|
29971
|
-
|
|
29972
|
-
|
|
29973
|
-
|
|
29974
|
-
|
|
29975
|
-
CollateExpression(string collation, unique_ptr<ParsedExpression> child);
|
|
29976
|
-
|
|
29977
|
-
//! The child of the cast expression
|
|
29978
|
-
unique_ptr<ParsedExpression> child;
|
|
29979
|
-
//! The collation clause
|
|
29980
|
-
string collation;
|
|
29981
|
-
|
|
29982
|
-
public:
|
|
29983
|
-
string ToString() const override;
|
|
30069
|
+
// standard function call
|
|
30070
|
+
string result = schema.empty() ? function_name : schema + "." + function_name;
|
|
30071
|
+
result += "(";
|
|
30072
|
+
if (distinct) {
|
|
30073
|
+
result += "DISTINCT ";
|
|
30074
|
+
}
|
|
30075
|
+
result += StringUtil::Join(entry.children, entry.children.size(), ", ", [&](const unique_ptr<BASE> &child) {
|
|
30076
|
+
return child->alias.empty() || !add_alias
|
|
30077
|
+
? child->ToString()
|
|
30078
|
+
: KeywordHelper::WriteOptionallyQuoted(child->alias) + " := " + child->ToString();
|
|
30079
|
+
});
|
|
30080
|
+
// ordered aggregate
|
|
30081
|
+
if (order_bys && !order_bys->orders.empty()) {
|
|
30082
|
+
if (entry.children.empty()) {
|
|
30083
|
+
result += ") WITHIN GROUP (";
|
|
30084
|
+
}
|
|
30085
|
+
result += " ORDER BY ";
|
|
30086
|
+
for (idx_t i = 0; i < order_bys->orders.size(); i++) {
|
|
30087
|
+
if (i > 0) {
|
|
30088
|
+
result += ", ";
|
|
30089
|
+
}
|
|
30090
|
+
result += order_bys->orders[i].ToString();
|
|
30091
|
+
}
|
|
30092
|
+
}
|
|
30093
|
+
result += ")";
|
|
29984
30094
|
|
|
29985
|
-
|
|
30095
|
+
// filtered aggregate
|
|
30096
|
+
if (filter) {
|
|
30097
|
+
result += " FILTER (WHERE " + filter->ToString() + ")";
|
|
30098
|
+
}
|
|
29986
30099
|
|
|
29987
|
-
|
|
30100
|
+
if (export_state) {
|
|
30101
|
+
result += " EXPORT_STATE";
|
|
30102
|
+
}
|
|
29988
30103
|
|
|
29989
|
-
|
|
29990
|
-
|
|
30104
|
+
return result;
|
|
30105
|
+
}
|
|
29991
30106
|
};
|
|
29992
30107
|
} // namespace duckdb
|
|
29993
30108
|
|
|
29994
30109
|
|
|
29995
30110
|
|
|
29996
|
-
|
|
29997
30111
|
//===----------------------------------------------------------------------===//
|
|
29998
30112
|
// DuckDB
|
|
29999
30113
|
//
|
|
30000
|
-
// duckdb/parser/expression/
|
|
30114
|
+
// duckdb/parser/expression/parameter_expression.hpp
|
|
30001
30115
|
//
|
|
30002
30116
|
//
|
|
30003
30117
|
//===----------------------------------------------------------------------===//
|
|
@@ -30006,38 +30120,35 @@ public:
|
|
|
30006
30120
|
|
|
30007
30121
|
|
|
30008
30122
|
|
|
30009
|
-
|
|
30010
30123
|
namespace duckdb {
|
|
30011
|
-
|
|
30012
|
-
//! ConstantExpression represents a constant value in the query
|
|
30013
|
-
class ConstantExpression : public ParsedExpression {
|
|
30124
|
+
class ParameterExpression : public ParsedExpression {
|
|
30014
30125
|
public:
|
|
30015
|
-
|
|
30126
|
+
ParameterExpression();
|
|
30016
30127
|
|
|
30017
|
-
|
|
30018
|
-
Value value;
|
|
30128
|
+
idx_t parameter_nr;
|
|
30019
30129
|
|
|
30020
30130
|
public:
|
|
30131
|
+
bool IsScalar() const override {
|
|
30132
|
+
return true;
|
|
30133
|
+
}
|
|
30134
|
+
bool HasParameter() const override {
|
|
30135
|
+
return true;
|
|
30136
|
+
}
|
|
30137
|
+
|
|
30021
30138
|
string ToString() const override;
|
|
30022
30139
|
|
|
30023
|
-
static bool Equals(const
|
|
30024
|
-
hash_t Hash() const override;
|
|
30140
|
+
static bool Equals(const ParameterExpression *a, const ParameterExpression *b);
|
|
30025
30141
|
|
|
30026
30142
|
unique_ptr<ParsedExpression> Copy() const override;
|
|
30143
|
+
hash_t Hash() const override;
|
|
30027
30144
|
|
|
30028
30145
|
void Serialize(FieldWriter &writer) const override;
|
|
30029
30146
|
static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
|
|
30030
30147
|
};
|
|
30031
|
-
|
|
30032
30148
|
} // namespace duckdb
|
|
30033
30149
|
|
|
30034
30150
|
|
|
30035
30151
|
|
|
30036
|
-
|
|
30037
|
-
|
|
30038
|
-
|
|
30039
|
-
|
|
30040
|
-
|
|
30041
30152
|
//===----------------------------------------------------------------------===//
|
|
30042
30153
|
// DuckDB
|
|
30043
30154
|
//
|
|
@@ -30092,7 +30203,7 @@ public:
|
|
|
30092
30203
|
//===----------------------------------------------------------------------===//
|
|
30093
30204
|
// DuckDB
|
|
30094
30205
|
//
|
|
30095
|
-
// duckdb/parser/parsed_data/
|
|
30206
|
+
// duckdb/parser/parsed_data/create_type_info.hpp
|
|
30096
30207
|
//
|
|
30097
30208
|
//
|
|
30098
30209
|
//===----------------------------------------------------------------------===//
|
|
@@ -30102,34 +30213,89 @@ public:
|
|
|
30102
30213
|
|
|
30103
30214
|
|
|
30104
30215
|
|
|
30216
|
+
|
|
30217
|
+
|
|
30105
30218
|
namespace duckdb {
|
|
30106
|
-
class TableCatalogEntry;
|
|
30107
30219
|
|
|
30108
|
-
struct
|
|
30109
|
-
|
|
30110
|
-
|
|
30220
|
+
struct CreateTypeInfo : public CreateInfo {
|
|
30221
|
+
CreateTypeInfo() : CreateInfo(CatalogType::TYPE_ENTRY) {
|
|
30222
|
+
}
|
|
30223
|
+
CreateTypeInfo(string name_p, LogicalType type_p)
|
|
30224
|
+
: CreateInfo(CatalogType::TYPE_ENTRY), name(move(name_p)), type(move(type_p)) {
|
|
30225
|
+
}
|
|
30111
30226
|
|
|
30112
|
-
//! Name of the
|
|
30113
|
-
string
|
|
30227
|
+
//! Name of the Type
|
|
30228
|
+
string name;
|
|
30229
|
+
//! Logical Type
|
|
30230
|
+
LogicalType type;
|
|
30114
30231
|
|
|
30115
|
-
|
|
30116
|
-
|
|
30117
|
-
|
|
30232
|
+
public:
|
|
30233
|
+
unique_ptr<CreateInfo> Copy() const override {
|
|
30234
|
+
auto result = make_unique<CreateTypeInfo>();
|
|
30235
|
+
CopyProperties(*result);
|
|
30236
|
+
result->name = name;
|
|
30237
|
+
result->type = type;
|
|
30238
|
+
return move(result);
|
|
30239
|
+
}
|
|
30118
30240
|
|
|
30119
|
-
|
|
30120
|
-
|
|
30121
|
-
|
|
30241
|
+
protected:
|
|
30242
|
+
void SerializeInternal(Serializer &) const override {
|
|
30243
|
+
throw NotImplementedException("Cannot serialize '%s'", CatalogTypeToString(CreateInfo::type));
|
|
30244
|
+
}
|
|
30122
30245
|
};
|
|
30123
30246
|
|
|
30124
|
-
|
|
30125
|
-
|
|
30247
|
+
} // namespace duckdb
|
|
30248
|
+
//===----------------------------------------------------------------------===//
|
|
30249
|
+
// DuckDB
|
|
30250
|
+
//
|
|
30251
|
+
// duckdb/parser/parsed_data/create_collation_info.hpp
|
|
30252
|
+
//
|
|
30253
|
+
//
|
|
30254
|
+
//===----------------------------------------------------------------------===//
|
|
30255
|
+
|
|
30256
|
+
|
|
30257
|
+
|
|
30258
|
+
|
|
30259
|
+
|
|
30260
|
+
|
|
30261
|
+
namespace duckdb {
|
|
30262
|
+
|
|
30263
|
+
struct CreateCollationInfo : public CreateInfo {
|
|
30264
|
+
CreateCollationInfo(string name_p, ScalarFunction function_p, bool combinable_p, bool not_required_for_equality_p)
|
|
30265
|
+
: CreateInfo(CatalogType::COLLATION_ENTRY), function(move(function_p)), combinable(combinable_p),
|
|
30266
|
+
not_required_for_equality(not_required_for_equality_p) {
|
|
30267
|
+
this->name = move(name_p);
|
|
30268
|
+
}
|
|
30269
|
+
|
|
30270
|
+
//! The name of the collation
|
|
30271
|
+
string name;
|
|
30272
|
+
//! The collation function to push in case collation is required
|
|
30273
|
+
ScalarFunction function;
|
|
30274
|
+
//! Whether or not the collation can be combined with other collations.
|
|
30275
|
+
bool combinable;
|
|
30276
|
+
//! Whether or not the collation is required for equality comparisons or not. For many collations a binary
|
|
30277
|
+
//! comparison for equality comparisons is correct, allowing us to skip the collation in these cases which greatly
|
|
30278
|
+
//! speeds up processing.
|
|
30279
|
+
bool not_required_for_equality;
|
|
30280
|
+
|
|
30281
|
+
protected:
|
|
30282
|
+
void SerializeInternal(Serializer &) const override {
|
|
30283
|
+
throw NotImplementedException("Cannot serialize '%s'", CatalogTypeToString(type));
|
|
30284
|
+
}
|
|
30285
|
+
|
|
30286
|
+
public:
|
|
30287
|
+
unique_ptr<CreateInfo> Copy() const override {
|
|
30288
|
+
auto result = make_unique<CreateCollationInfo>(name, function, combinable, not_required_for_equality);
|
|
30289
|
+
CopyProperties(*result);
|
|
30290
|
+
return move(result);
|
|
30291
|
+
}
|
|
30126
30292
|
};
|
|
30127
30293
|
|
|
30128
30294
|
} // namespace duckdb
|
|
30129
30295
|
//===----------------------------------------------------------------------===//
|
|
30130
30296
|
// DuckDB
|
|
30131
30297
|
//
|
|
30132
|
-
// duckdb/parser/parsed_data/
|
|
30298
|
+
// duckdb/parser/parsed_data/create_aggregate_function_info.hpp
|
|
30133
30299
|
//
|
|
30134
30300
|
//
|
|
30135
30301
|
//===----------------------------------------------------------------------===//
|
|
@@ -30138,23 +30304,39 @@ struct BoundExportData : public ParseInfo {
|
|
|
30138
30304
|
|
|
30139
30305
|
|
|
30140
30306
|
|
|
30307
|
+
|
|
30141
30308
|
namespace duckdb {
|
|
30142
30309
|
|
|
30143
|
-
|
|
30310
|
+
struct CreateAggregateFunctionInfo : public CreateFunctionInfo {
|
|
30311
|
+
explicit CreateAggregateFunctionInfo(AggregateFunction function)
|
|
30312
|
+
: CreateFunctionInfo(CatalogType::AGGREGATE_FUNCTION_ENTRY), functions(function.name) {
|
|
30313
|
+
name = function.name;
|
|
30314
|
+
functions.AddFunction(move(function));
|
|
30315
|
+
}
|
|
30144
30316
|
|
|
30145
|
-
|
|
30146
|
-
|
|
30317
|
+
explicit CreateAggregateFunctionInfo(AggregateFunctionSet set)
|
|
30318
|
+
: CreateFunctionInfo(CatalogType::AGGREGATE_FUNCTION_ENTRY), functions(move(set)) {
|
|
30319
|
+
name = functions.name;
|
|
30320
|
+
for (auto &func : functions.functions) {
|
|
30321
|
+
func.name = functions.name;
|
|
30322
|
+
}
|
|
30147
30323
|
}
|
|
30148
30324
|
|
|
30149
|
-
|
|
30150
|
-
|
|
30325
|
+
AggregateFunctionSet functions;
|
|
30326
|
+
|
|
30327
|
+
public:
|
|
30328
|
+
unique_ptr<CreateInfo> Copy() const override {
|
|
30329
|
+
auto result = make_unique<CreateAggregateFunctionInfo>(functions);
|
|
30330
|
+
CopyProperties(*result);
|
|
30331
|
+
return move(result);
|
|
30332
|
+
}
|
|
30151
30333
|
};
|
|
30152
30334
|
|
|
30153
30335
|
} // namespace duckdb
|
|
30154
30336
|
//===----------------------------------------------------------------------===//
|
|
30155
30337
|
// DuckDB
|
|
30156
30338
|
//
|
|
30157
|
-
// duckdb/parser/parsed_data/
|
|
30339
|
+
// duckdb/parser/parsed_data/vacuum_info.hpp
|
|
30158
30340
|
//
|
|
30159
30341
|
//
|
|
30160
30342
|
//===----------------------------------------------------------------------===//
|
|
@@ -30163,11 +30345,20 @@ struct TransactionInfo : public ParseInfo {
|
|
|
30163
30345
|
|
|
30164
30346
|
|
|
30165
30347
|
|
|
30348
|
+
//===----------------------------------------------------------------------===//
|
|
30349
|
+
// DuckDB
|
|
30350
|
+
//
|
|
30351
|
+
// duckdb/planner/tableref/bound_basetableref.hpp
|
|
30352
|
+
//
|
|
30353
|
+
//
|
|
30354
|
+
//===----------------------------------------------------------------------===//
|
|
30355
|
+
|
|
30356
|
+
|
|
30166
30357
|
|
|
30167
30358
|
//===----------------------------------------------------------------------===//
|
|
30168
30359
|
// DuckDB
|
|
30169
30360
|
//
|
|
30170
|
-
// duckdb/
|
|
30361
|
+
// duckdb/planner/bound_tableref.hpp
|
|
30171
30362
|
//
|
|
30172
30363
|
//
|
|
30173
30364
|
//===----------------------------------------------------------------------===//
|
|
@@ -30177,75 +30368,158 @@ struct TransactionInfo : public ParseInfo {
|
|
|
30177
30368
|
|
|
30178
30369
|
|
|
30179
30370
|
|
|
30371
|
+
|
|
30180
30372
|
namespace duckdb {
|
|
30373
|
+
|
|
30374
|
+
class BoundTableRef {
|
|
30375
|
+
public:
|
|
30376
|
+
explicit BoundTableRef(TableReferenceType type) : type(type) {
|
|
30377
|
+
}
|
|
30378
|
+
virtual ~BoundTableRef() {
|
|
30379
|
+
}
|
|
30380
|
+
|
|
30381
|
+
//! The type of table reference
|
|
30382
|
+
TableReferenceType type;
|
|
30383
|
+
//! The sample options (if any)
|
|
30384
|
+
unique_ptr<SampleOptions> sample;
|
|
30385
|
+
};
|
|
30386
|
+
} // namespace duckdb
|
|
30387
|
+
|
|
30388
|
+
|
|
30389
|
+
|
|
30390
|
+
namespace duckdb {
|
|
30391
|
+
class TableCatalogEntry;
|
|
30392
|
+
|
|
30181
30393
|
//! Represents a TableReference to a base table in the schema
|
|
30182
|
-
class
|
|
30394
|
+
class BoundBaseTableRef : public BoundTableRef {
|
|
30183
30395
|
public:
|
|
30184
|
-
|
|
30396
|
+
BoundBaseTableRef(TableCatalogEntry *table, unique_ptr<LogicalOperator> get)
|
|
30397
|
+
: BoundTableRef(TableReferenceType::BASE_TABLE), table(table), get(move(get)) {
|
|
30185
30398
|
}
|
|
30186
30399
|
|
|
30187
|
-
|
|
30188
|
-
|
|
30189
|
-
|
|
30190
|
-
|
|
30191
|
-
|
|
30192
|
-
vector<string> column_name_alias;
|
|
30400
|
+
TableCatalogEntry *table;
|
|
30401
|
+
unique_ptr<LogicalOperator> get;
|
|
30402
|
+
};
|
|
30403
|
+
} // namespace duckdb
|
|
30404
|
+
|
|
30193
30405
|
|
|
30406
|
+
|
|
30407
|
+
namespace duckdb {
|
|
30408
|
+
|
|
30409
|
+
struct VacuumOptions {
|
|
30410
|
+
bool vacuum;
|
|
30411
|
+
bool analyze;
|
|
30412
|
+
};
|
|
30413
|
+
|
|
30414
|
+
struct VacuumInfo : public ParseInfo {
|
|
30194
30415
|
public:
|
|
30195
|
-
|
|
30196
|
-
bool Equals(const TableRef *other_p) const override;
|
|
30416
|
+
explicit VacuumInfo(VacuumOptions options) : options(options), has_table(false), table(nullptr) {};
|
|
30197
30417
|
|
|
30198
|
-
unique_ptr<
|
|
30418
|
+
unique_ptr<VacuumInfo> Copy() {
|
|
30419
|
+
auto result = make_unique<VacuumInfo>(options);
|
|
30420
|
+
result->has_table = has_table;
|
|
30421
|
+
if (has_table) {
|
|
30422
|
+
result->ref = ref->Copy();
|
|
30423
|
+
}
|
|
30424
|
+
return result;
|
|
30425
|
+
}
|
|
30199
30426
|
|
|
30200
|
-
|
|
30201
|
-
|
|
30202
|
-
|
|
30203
|
-
|
|
30427
|
+
const VacuumOptions options;
|
|
30428
|
+
|
|
30429
|
+
public:
|
|
30430
|
+
bool has_table;
|
|
30431
|
+
unique_ptr<TableRef> ref;
|
|
30432
|
+
TableCatalogEntry *table;
|
|
30433
|
+
unordered_map<idx_t, idx_t> column_id_map;
|
|
30434
|
+
vector<string> columns;
|
|
30204
30435
|
};
|
|
30436
|
+
|
|
30205
30437
|
} // namespace duckdb
|
|
30438
|
+
//===----------------------------------------------------------------------===//
|
|
30439
|
+
// DuckDB
|
|
30440
|
+
//
|
|
30441
|
+
// duckdb/parser/parsed_data/drop_info.hpp
|
|
30442
|
+
//
|
|
30443
|
+
//
|
|
30444
|
+
//===----------------------------------------------------------------------===//
|
|
30445
|
+
|
|
30446
|
+
|
|
30206
30447
|
|
|
30207
30448
|
|
|
30208
30449
|
|
|
30209
30450
|
|
|
30210
30451
|
namespace duckdb {
|
|
30211
30452
|
|
|
30212
|
-
struct
|
|
30213
|
-
|
|
30453
|
+
struct DropInfo : public ParseInfo {
|
|
30454
|
+
DropInfo() : schema(INVALID_SCHEMA), if_exists(false), cascade(false) {
|
|
30214
30455
|
}
|
|
30215
30456
|
|
|
30216
|
-
//!
|
|
30217
|
-
|
|
30218
|
-
//!
|
|
30219
|
-
string
|
|
30220
|
-
//!
|
|
30221
|
-
|
|
30222
|
-
//!
|
|
30223
|
-
|
|
30224
|
-
//!
|
|
30225
|
-
|
|
30226
|
-
|
|
30457
|
+
//! The catalog type to drop
|
|
30458
|
+
CatalogType type;
|
|
30459
|
+
//! Schema name to drop from, if any
|
|
30460
|
+
string schema;
|
|
30461
|
+
//! Element name to drop
|
|
30462
|
+
string name;
|
|
30463
|
+
//! Ignore if the entry does not exist instead of failing
|
|
30464
|
+
bool if_exists = false;
|
|
30465
|
+
//! Cascade drop (drop all dependents instead of throwing an error if there
|
|
30466
|
+
//! are any)
|
|
30467
|
+
bool cascade = false;
|
|
30227
30468
|
|
|
30228
|
-
|
|
30229
|
-
|
|
30230
|
-
|
|
30231
|
-
|
|
30232
|
-
|
|
30233
|
-
|
|
30469
|
+
public:
|
|
30470
|
+
unique_ptr<DropInfo> Copy() const {
|
|
30471
|
+
auto result = make_unique<DropInfo>();
|
|
30472
|
+
result->type = type;
|
|
30473
|
+
result->schema = schema;
|
|
30474
|
+
result->name = name;
|
|
30475
|
+
result->if_exists = if_exists;
|
|
30476
|
+
result->cascade = cascade;
|
|
30477
|
+
return result;
|
|
30478
|
+
}
|
|
30479
|
+
};
|
|
30234
30480
|
|
|
30235
|
-
|
|
30236
|
-
|
|
30481
|
+
} // namespace duckdb
|
|
30482
|
+
//===----------------------------------------------------------------------===//
|
|
30483
|
+
// DuckDB
|
|
30484
|
+
//
|
|
30485
|
+
// duckdb/parser/parsed_data/export_table_data.hpp
|
|
30486
|
+
//
|
|
30487
|
+
//
|
|
30488
|
+
//===----------------------------------------------------------------------===//
|
|
30237
30489
|
|
|
30238
|
-
public:
|
|
30239
|
-
unique_ptr<CreateInfo> Copy() const override;
|
|
30240
30490
|
|
|
30241
|
-
|
|
30491
|
+
|
|
30492
|
+
|
|
30493
|
+
|
|
30494
|
+
|
|
30495
|
+
namespace duckdb {
|
|
30496
|
+
class TableCatalogEntry;
|
|
30497
|
+
|
|
30498
|
+
struct ExportedTableData {
|
|
30499
|
+
//! Name of the exported table
|
|
30500
|
+
string table_name;
|
|
30501
|
+
|
|
30502
|
+
//! Name of the schema
|
|
30503
|
+
string schema_name;
|
|
30504
|
+
|
|
30505
|
+
//! Path to be exported
|
|
30506
|
+
string file_path;
|
|
30507
|
+
};
|
|
30508
|
+
|
|
30509
|
+
struct ExportedTableInfo {
|
|
30510
|
+
TableCatalogEntry *entry;
|
|
30511
|
+
ExportedTableData table_data;
|
|
30512
|
+
};
|
|
30513
|
+
|
|
30514
|
+
struct BoundExportData : public ParseInfo {
|
|
30515
|
+
std::vector<ExportedTableInfo> data;
|
|
30242
30516
|
};
|
|
30243
30517
|
|
|
30244
30518
|
} // namespace duckdb
|
|
30245
30519
|
//===----------------------------------------------------------------------===//
|
|
30246
30520
|
// DuckDB
|
|
30247
30521
|
//
|
|
30248
|
-
// duckdb/parser/parsed_data/
|
|
30522
|
+
// duckdb/parser/parsed_data/alter_function_info.hpp
|
|
30249
30523
|
//
|
|
30250
30524
|
//
|
|
30251
30525
|
//===----------------------------------------------------------------------===//
|
|
@@ -30255,31 +30529,37 @@ public:
|
|
|
30255
30529
|
|
|
30256
30530
|
|
|
30257
30531
|
|
|
30532
|
+
|
|
30258
30533
|
namespace duckdb {
|
|
30259
30534
|
|
|
30260
|
-
|
|
30261
|
-
|
|
30262
|
-
|
|
30263
|
-
|
|
30264
|
-
functions.AddFunction(move(function));
|
|
30265
|
-
}
|
|
30535
|
+
//===--------------------------------------------------------------------===//
|
|
30536
|
+
// Alter Table
|
|
30537
|
+
//===--------------------------------------------------------------------===//
|
|
30538
|
+
enum class AlterFunctionType : uint8_t { INVALID = 0, ADD_FUNCTION_OVERLOADS = 1 };
|
|
30266
30539
|
|
|
30267
|
-
|
|
30268
|
-
|
|
30269
|
-
|
|
30270
|
-
for (auto &func : functions.functions) {
|
|
30271
|
-
func.name = functions.name;
|
|
30272
|
-
}
|
|
30273
|
-
}
|
|
30540
|
+
struct AlterFunctionInfo : public AlterInfo {
|
|
30541
|
+
AlterFunctionInfo(AlterFunctionType type, string schema, string name, bool if_exists);
|
|
30542
|
+
virtual ~AlterFunctionInfo() override;
|
|
30274
30543
|
|
|
30275
|
-
|
|
30544
|
+
AlterFunctionType alter_function_type;
|
|
30276
30545
|
|
|
30277
30546
|
public:
|
|
30278
|
-
|
|
30279
|
-
|
|
30280
|
-
|
|
30281
|
-
|
|
30282
|
-
|
|
30547
|
+
CatalogType GetCatalogType() const override;
|
|
30548
|
+
void Serialize(FieldWriter &writer) const override;
|
|
30549
|
+
static unique_ptr<AlterInfo> Deserialize(FieldReader &reader);
|
|
30550
|
+
};
|
|
30551
|
+
|
|
30552
|
+
//===--------------------------------------------------------------------===//
|
|
30553
|
+
// AddFunctionOverloadInfo
|
|
30554
|
+
//===--------------------------------------------------------------------===//
|
|
30555
|
+
struct AddFunctionOverloadInfo : public AlterFunctionInfo {
|
|
30556
|
+
AddFunctionOverloadInfo(string schema, string name, bool if_exists, ScalarFunctionSet new_overloads);
|
|
30557
|
+
~AddFunctionOverloadInfo() override;
|
|
30558
|
+
|
|
30559
|
+
ScalarFunctionSet new_overloads;
|
|
30560
|
+
|
|
30561
|
+
public:
|
|
30562
|
+
unique_ptr<AlterInfo> Copy() const override;
|
|
30283
30563
|
};
|
|
30284
30564
|
|
|
30285
30565
|
} // namespace duckdb
|
|
@@ -30383,7 +30663,7 @@ protected:
|
|
|
30383
30663
|
//===----------------------------------------------------------------------===//
|
|
30384
30664
|
// DuckDB
|
|
30385
30665
|
//
|
|
30386
|
-
// duckdb/parser/parsed_data/
|
|
30666
|
+
// duckdb/parser/parsed_data/create_schema_info.hpp
|
|
30387
30667
|
//
|
|
30388
30668
|
//
|
|
30389
30669
|
//===----------------------------------------------------------------------===//
|
|
@@ -30392,74 +30672,28 @@ protected:
|
|
|
30392
30672
|
|
|
30393
30673
|
|
|
30394
30674
|
|
|
30395
|
-
|
|
30396
30675
|
namespace duckdb {
|
|
30397
30676
|
|
|
30398
|
-
struct
|
|
30399
|
-
|
|
30400
|
-
vector<LogicalType> types;
|
|
30401
|
-
//! The QueryNode of select query
|
|
30402
|
-
unique_ptr<QueryNode> query;
|
|
30403
|
-
//! Aliases of projected columns
|
|
30404
|
-
vector<string> aliases;
|
|
30405
|
-
//! Whether or not we are requesting a summary or a describe
|
|
30406
|
-
bool is_summary;
|
|
30407
|
-
|
|
30408
|
-
unique_ptr<ShowSelectInfo> Copy() {
|
|
30409
|
-
auto result = make_unique<ShowSelectInfo>();
|
|
30410
|
-
result->types = types;
|
|
30411
|
-
result->query = query->Copy();
|
|
30412
|
-
result->aliases = aliases;
|
|
30413
|
-
result->is_summary = is_summary;
|
|
30414
|
-
return result;
|
|
30677
|
+
struct CreateSchemaInfo : public CreateInfo {
|
|
30678
|
+
CreateSchemaInfo() : CreateInfo(CatalogType::SCHEMA_ENTRY) {
|
|
30415
30679
|
}
|
|
30416
|
-
};
|
|
30417
|
-
|
|
30418
|
-
} // namespace duckdb
|
|
30419
|
-
//===----------------------------------------------------------------------===//
|
|
30420
|
-
// DuckDB
|
|
30421
|
-
//
|
|
30422
|
-
// duckdb/parser/parsed_data/alter_function_info.hpp
|
|
30423
|
-
//
|
|
30424
|
-
//
|
|
30425
|
-
//===----------------------------------------------------------------------===//
|
|
30426
|
-
|
|
30427
|
-
|
|
30428
|
-
|
|
30429
|
-
|
|
30430
|
-
|
|
30431
|
-
|
|
30432
|
-
|
|
30433
|
-
namespace duckdb {
|
|
30434
|
-
|
|
30435
|
-
//===--------------------------------------------------------------------===//
|
|
30436
|
-
// Alter Table
|
|
30437
|
-
//===--------------------------------------------------------------------===//
|
|
30438
|
-
enum class AlterFunctionType : uint8_t { INVALID = 0, ADD_FUNCTION_OVERLOADS = 1 };
|
|
30439
|
-
|
|
30440
|
-
struct AlterFunctionInfo : public AlterInfo {
|
|
30441
|
-
AlterFunctionInfo(AlterFunctionType type, string schema, string name, bool if_exists);
|
|
30442
|
-
virtual ~AlterFunctionInfo() override;
|
|
30443
|
-
|
|
30444
|
-
AlterFunctionType alter_function_type;
|
|
30445
30680
|
|
|
30446
30681
|
public:
|
|
30447
|
-
|
|
30448
|
-
|
|
30449
|
-
|
|
30450
|
-
|
|
30451
|
-
|
|
30452
|
-
//===--------------------------------------------------------------------===//
|
|
30453
|
-
// AddFunctionOverloadInfo
|
|
30454
|
-
//===--------------------------------------------------------------------===//
|
|
30455
|
-
struct AddFunctionOverloadInfo : public AlterFunctionInfo {
|
|
30456
|
-
AddFunctionOverloadInfo(string schema, string name, bool if_exists, ScalarFunctionSet new_overloads);
|
|
30457
|
-
~AddFunctionOverloadInfo() override;
|
|
30682
|
+
unique_ptr<CreateInfo> Copy() const override {
|
|
30683
|
+
auto result = make_unique<CreateSchemaInfo>();
|
|
30684
|
+
CopyProperties(*result);
|
|
30685
|
+
return move(result);
|
|
30686
|
+
}
|
|
30458
30687
|
|
|
30459
|
-
|
|
30688
|
+
static unique_ptr<CreateSchemaInfo> Deserialize(Deserializer &deserializer) {
|
|
30689
|
+
auto result = make_unique<CreateSchemaInfo>();
|
|
30690
|
+
result->DeserializeBase(deserializer);
|
|
30691
|
+
return result;
|
|
30692
|
+
}
|
|
30460
30693
|
|
|
30461
|
-
|
|
30462
|
-
|
|
30694
|
+
protected:
|
|
30695
|
+
void SerializeInternal(Serializer &) const override {
|
|
30696
|
+
}
|
|
30463
30697
|
};
|
|
30464
30698
|
|
|
30465
30699
|
} // namespace duckdb
|
|
@@ -30546,50 +30780,6 @@ public:
|
|
|
30546
30780
|
}
|
|
30547
30781
|
};
|
|
30548
30782
|
|
|
30549
|
-
} // namespace duckdb
|
|
30550
|
-
//===----------------------------------------------------------------------===//
|
|
30551
|
-
// DuckDB
|
|
30552
|
-
//
|
|
30553
|
-
// duckdb/parser/parsed_data/drop_info.hpp
|
|
30554
|
-
//
|
|
30555
|
-
//
|
|
30556
|
-
//===----------------------------------------------------------------------===//
|
|
30557
|
-
|
|
30558
|
-
|
|
30559
|
-
|
|
30560
|
-
|
|
30561
|
-
|
|
30562
|
-
|
|
30563
|
-
namespace duckdb {
|
|
30564
|
-
|
|
30565
|
-
struct DropInfo : public ParseInfo {
|
|
30566
|
-
DropInfo() : schema(INVALID_SCHEMA), if_exists(false), cascade(false) {
|
|
30567
|
-
}
|
|
30568
|
-
|
|
30569
|
-
//! The catalog type to drop
|
|
30570
|
-
CatalogType type;
|
|
30571
|
-
//! Schema name to drop from, if any
|
|
30572
|
-
string schema;
|
|
30573
|
-
//! Element name to drop
|
|
30574
|
-
string name;
|
|
30575
|
-
//! Ignore if the entry does not exist instead of failing
|
|
30576
|
-
bool if_exists = false;
|
|
30577
|
-
//! Cascade drop (drop all dependents instead of throwing an error if there
|
|
30578
|
-
//! are any)
|
|
30579
|
-
bool cascade = false;
|
|
30580
|
-
|
|
30581
|
-
public:
|
|
30582
|
-
unique_ptr<DropInfo> Copy() const {
|
|
30583
|
-
auto result = make_unique<DropInfo>();
|
|
30584
|
-
result->type = type;
|
|
30585
|
-
result->schema = schema;
|
|
30586
|
-
result->name = name;
|
|
30587
|
-
result->if_exists = if_exists;
|
|
30588
|
-
result->cascade = cascade;
|
|
30589
|
-
return result;
|
|
30590
|
-
}
|
|
30591
|
-
};
|
|
30592
|
-
|
|
30593
30783
|
} // namespace duckdb
|
|
30594
30784
|
//===----------------------------------------------------------------------===//
|
|
30595
30785
|
// DuckDB
|
|
@@ -30632,7 +30822,7 @@ public:
|
|
|
30632
30822
|
//===----------------------------------------------------------------------===//
|
|
30633
30823
|
// DuckDB
|
|
30634
30824
|
//
|
|
30635
|
-
// duckdb/parser/parsed_data/
|
|
30825
|
+
// duckdb/parser/parsed_data/transaction_info.hpp
|
|
30636
30826
|
//
|
|
30637
30827
|
//
|
|
30638
30828
|
//===----------------------------------------------------------------------===//
|
|
@@ -30641,20 +30831,23 @@ public:
|
|
|
30641
30831
|
|
|
30642
30832
|
|
|
30643
30833
|
|
|
30644
|
-
|
|
30645
|
-
|
|
30646
|
-
|
|
30647
|
-
// duckdb/planner/tableref/bound_basetableref.hpp
|
|
30648
|
-
//
|
|
30649
|
-
//
|
|
30650
|
-
//===----------------------------------------------------------------------===//
|
|
30834
|
+
namespace duckdb {
|
|
30835
|
+
|
|
30836
|
+
enum class TransactionType : uint8_t { INVALID, BEGIN_TRANSACTION, COMMIT, ROLLBACK };
|
|
30651
30837
|
|
|
30838
|
+
struct TransactionInfo : public ParseInfo {
|
|
30839
|
+
explicit TransactionInfo(TransactionType type) : type(type) {
|
|
30840
|
+
}
|
|
30652
30841
|
|
|
30842
|
+
//! The type of transaction statement
|
|
30843
|
+
TransactionType type;
|
|
30844
|
+
};
|
|
30653
30845
|
|
|
30846
|
+
} // namespace duckdb
|
|
30654
30847
|
//===----------------------------------------------------------------------===//
|
|
30655
30848
|
// DuckDB
|
|
30656
30849
|
//
|
|
30657
|
-
// duckdb/
|
|
30850
|
+
// duckdb/parser/parsed_data/create_index_info.hpp
|
|
30658
30851
|
//
|
|
30659
30852
|
//
|
|
30660
30853
|
//===----------------------------------------------------------------------===//
|
|
@@ -30664,77 +30857,10 @@ public:
|
|
|
30664
30857
|
|
|
30665
30858
|
|
|
30666
30859
|
|
|
30667
|
-
|
|
30668
|
-
namespace duckdb {
|
|
30669
|
-
|
|
30670
|
-
class BoundTableRef {
|
|
30671
|
-
public:
|
|
30672
|
-
explicit BoundTableRef(TableReferenceType type) : type(type) {
|
|
30673
|
-
}
|
|
30674
|
-
virtual ~BoundTableRef() {
|
|
30675
|
-
}
|
|
30676
|
-
|
|
30677
|
-
//! The type of table reference
|
|
30678
|
-
TableReferenceType type;
|
|
30679
|
-
//! The sample options (if any)
|
|
30680
|
-
unique_ptr<SampleOptions> sample;
|
|
30681
|
-
};
|
|
30682
|
-
} // namespace duckdb
|
|
30683
|
-
|
|
30684
|
-
|
|
30685
|
-
|
|
30686
|
-
namespace duckdb {
|
|
30687
|
-
class TableCatalogEntry;
|
|
30688
|
-
|
|
30689
|
-
//! Represents a TableReference to a base table in the schema
|
|
30690
|
-
class BoundBaseTableRef : public BoundTableRef {
|
|
30691
|
-
public:
|
|
30692
|
-
BoundBaseTableRef(TableCatalogEntry *table, unique_ptr<LogicalOperator> get)
|
|
30693
|
-
: BoundTableRef(TableReferenceType::BASE_TABLE), table(table), get(move(get)) {
|
|
30694
|
-
}
|
|
30695
|
-
|
|
30696
|
-
TableCatalogEntry *table;
|
|
30697
|
-
unique_ptr<LogicalOperator> get;
|
|
30698
|
-
};
|
|
30699
|
-
} // namespace duckdb
|
|
30700
|
-
|
|
30701
|
-
|
|
30702
|
-
|
|
30703
|
-
namespace duckdb {
|
|
30704
|
-
|
|
30705
|
-
struct VacuumOptions {
|
|
30706
|
-
bool vacuum;
|
|
30707
|
-
bool analyze;
|
|
30708
|
-
};
|
|
30709
|
-
|
|
30710
|
-
struct VacuumInfo : public ParseInfo {
|
|
30711
|
-
public:
|
|
30712
|
-
explicit VacuumInfo(VacuumOptions options) : options(options), has_table(false), table(nullptr) {};
|
|
30713
|
-
|
|
30714
|
-
unique_ptr<VacuumInfo> Copy() {
|
|
30715
|
-
auto result = make_unique<VacuumInfo>(options);
|
|
30716
|
-
result->has_table = has_table;
|
|
30717
|
-
if (has_table) {
|
|
30718
|
-
result->ref = ref->Copy();
|
|
30719
|
-
}
|
|
30720
|
-
return result;
|
|
30721
|
-
}
|
|
30722
|
-
|
|
30723
|
-
const VacuumOptions options;
|
|
30724
|
-
|
|
30725
|
-
public:
|
|
30726
|
-
bool has_table;
|
|
30727
|
-
unique_ptr<TableRef> ref;
|
|
30728
|
-
TableCatalogEntry *table;
|
|
30729
|
-
unordered_map<idx_t, idx_t> column_id_map;
|
|
30730
|
-
vector<string> columns;
|
|
30731
|
-
};
|
|
30732
|
-
|
|
30733
|
-
} // namespace duckdb
|
|
30734
30860
|
//===----------------------------------------------------------------------===//
|
|
30735
30861
|
// DuckDB
|
|
30736
30862
|
//
|
|
30737
|
-
// duckdb/parser/
|
|
30863
|
+
// duckdb/parser/tableref/basetableref.hpp
|
|
30738
30864
|
//
|
|
30739
30865
|
//
|
|
30740
30866
|
//===----------------------------------------------------------------------===//
|
|
@@ -30745,80 +30871,74 @@ public:
|
|
|
30745
30871
|
|
|
30746
30872
|
|
|
30747
30873
|
namespace duckdb {
|
|
30748
|
-
|
|
30749
|
-
|
|
30750
|
-
|
|
30751
|
-
|
|
30752
|
-
not_required_for_equality(not_required_for_equality_p) {
|
|
30753
|
-
this->name = move(name_p);
|
|
30874
|
+
//! Represents a TableReference to a base table in the schema
|
|
30875
|
+
class BaseTableRef : public TableRef {
|
|
30876
|
+
public:
|
|
30877
|
+
BaseTableRef() : TableRef(TableReferenceType::BASE_TABLE), schema_name(INVALID_SCHEMA) {
|
|
30754
30878
|
}
|
|
30755
30879
|
|
|
30756
|
-
//!
|
|
30757
|
-
string
|
|
30758
|
-
//!
|
|
30759
|
-
|
|
30760
|
-
//!
|
|
30761
|
-
|
|
30762
|
-
//! Whether or not the collation is required for equality comparisons or not. For many collations a binary
|
|
30763
|
-
//! comparison for equality comparisons is correct, allowing us to skip the collation in these cases which greatly
|
|
30764
|
-
//! speeds up processing.
|
|
30765
|
-
bool not_required_for_equality;
|
|
30766
|
-
|
|
30767
|
-
protected:
|
|
30768
|
-
void SerializeInternal(Serializer &) const override {
|
|
30769
|
-
throw NotImplementedException("Cannot serialize '%s'", CatalogTypeToString(type));
|
|
30770
|
-
}
|
|
30880
|
+
//! Schema name
|
|
30881
|
+
string schema_name;
|
|
30882
|
+
//! Table name
|
|
30883
|
+
string table_name;
|
|
30884
|
+
//! Aliases for the column names
|
|
30885
|
+
vector<string> column_name_alias;
|
|
30771
30886
|
|
|
30772
30887
|
public:
|
|
30773
|
-
|
|
30774
|
-
|
|
30775
|
-
CopyProperties(*result);
|
|
30776
|
-
return move(result);
|
|
30777
|
-
}
|
|
30778
|
-
};
|
|
30888
|
+
string ToString() const override;
|
|
30889
|
+
bool Equals(const TableRef *other_p) const override;
|
|
30779
30890
|
|
|
30780
|
-
|
|
30781
|
-
//===----------------------------------------------------------------------===//
|
|
30782
|
-
// DuckDB
|
|
30783
|
-
//
|
|
30784
|
-
// duckdb/parser/parsed_data/create_schema_info.hpp
|
|
30785
|
-
//
|
|
30786
|
-
//
|
|
30787
|
-
//===----------------------------------------------------------------------===//
|
|
30891
|
+
unique_ptr<TableRef> Copy() override;
|
|
30788
30892
|
|
|
30893
|
+
//! Serializes a blob into a BaseTableRef
|
|
30894
|
+
void Serialize(FieldWriter &serializer) const override;
|
|
30895
|
+
//! Deserializes a blob back into a BaseTableRef
|
|
30896
|
+
static unique_ptr<TableRef> Deserialize(FieldReader &source);
|
|
30897
|
+
};
|
|
30898
|
+
} // namespace duckdb
|
|
30789
30899
|
|
|
30790
30900
|
|
|
30791
30901
|
|
|
30792
30902
|
|
|
30793
30903
|
namespace duckdb {
|
|
30794
30904
|
|
|
30795
|
-
struct
|
|
30796
|
-
|
|
30905
|
+
struct CreateIndexInfo : public CreateInfo {
|
|
30906
|
+
CreateIndexInfo() : CreateInfo(CatalogType::INDEX_ENTRY) {
|
|
30797
30907
|
}
|
|
30798
30908
|
|
|
30799
|
-
|
|
30800
|
-
|
|
30801
|
-
|
|
30802
|
-
|
|
30803
|
-
|
|
30804
|
-
|
|
30909
|
+
//! Index Type (e.g., B+-tree, Skip-List, ...)
|
|
30910
|
+
IndexType index_type;
|
|
30911
|
+
//! Name of the Index
|
|
30912
|
+
string index_name;
|
|
30913
|
+
//! Index Constraint Type
|
|
30914
|
+
IndexConstraintType constraint_type;
|
|
30915
|
+
//! The table to create the index on
|
|
30916
|
+
unique_ptr<BaseTableRef> table;
|
|
30917
|
+
//! Set of expressions to index by
|
|
30918
|
+
vector<unique_ptr<ParsedExpression>> expressions;
|
|
30919
|
+
vector<unique_ptr<ParsedExpression>> parsed_expressions;
|
|
30805
30920
|
|
|
30806
|
-
|
|
30807
|
-
|
|
30808
|
-
|
|
30809
|
-
|
|
30810
|
-
|
|
30921
|
+
//! Types used for the CREATE INDEX scan
|
|
30922
|
+
vector<LogicalType> scan_types;
|
|
30923
|
+
//! The names of the columns, used for the CREATE INDEX scan
|
|
30924
|
+
vector<string> names;
|
|
30925
|
+
//! Column IDs needed for index creation
|
|
30926
|
+
vector<column_t> column_ids;
|
|
30811
30927
|
|
|
30812
30928
|
protected:
|
|
30813
|
-
void SerializeInternal(Serializer &) const override
|
|
30814
|
-
|
|
30929
|
+
void SerializeInternal(Serializer &serializer) const override;
|
|
30930
|
+
|
|
30931
|
+
public:
|
|
30932
|
+
unique_ptr<CreateInfo> Copy() const override;
|
|
30933
|
+
|
|
30934
|
+
static unique_ptr<CreateIndexInfo> Deserialize(Deserializer &deserializer);
|
|
30815
30935
|
};
|
|
30816
30936
|
|
|
30817
30937
|
} // namespace duckdb
|
|
30818
30938
|
//===----------------------------------------------------------------------===//
|
|
30819
30939
|
// DuckDB
|
|
30820
30940
|
//
|
|
30821
|
-
// duckdb/parser/parsed_data/
|
|
30941
|
+
// duckdb/parser/parsed_data/show_select_info.hpp
|
|
30822
30942
|
//
|
|
30823
30943
|
//
|
|
30824
30944
|
//===----------------------------------------------------------------------===//
|
|
@@ -30828,34 +30948,25 @@ protected:
|
|
|
30828
30948
|
|
|
30829
30949
|
|
|
30830
30950
|
|
|
30831
|
-
|
|
30832
|
-
|
|
30833
30951
|
namespace duckdb {
|
|
30834
30952
|
|
|
30835
|
-
struct
|
|
30836
|
-
|
|
30837
|
-
|
|
30838
|
-
|
|
30839
|
-
|
|
30840
|
-
|
|
30841
|
-
|
|
30842
|
-
//!
|
|
30843
|
-
|
|
30844
|
-
//! Logical Type
|
|
30845
|
-
LogicalType type;
|
|
30846
|
-
|
|
30847
|
-
public:
|
|
30848
|
-
unique_ptr<CreateInfo> Copy() const override {
|
|
30849
|
-
auto result = make_unique<CreateTypeInfo>();
|
|
30850
|
-
CopyProperties(*result);
|
|
30851
|
-
result->name = name;
|
|
30852
|
-
result->type = type;
|
|
30853
|
-
return move(result);
|
|
30854
|
-
}
|
|
30953
|
+
struct ShowSelectInfo : public ParseInfo {
|
|
30954
|
+
//! Types of projected columns
|
|
30955
|
+
vector<LogicalType> types;
|
|
30956
|
+
//! The QueryNode of select query
|
|
30957
|
+
unique_ptr<QueryNode> query;
|
|
30958
|
+
//! Aliases of projected columns
|
|
30959
|
+
vector<string> aliases;
|
|
30960
|
+
//! Whether or not we are requesting a summary or a describe
|
|
30961
|
+
bool is_summary;
|
|
30855
30962
|
|
|
30856
|
-
|
|
30857
|
-
|
|
30858
|
-
|
|
30963
|
+
unique_ptr<ShowSelectInfo> Copy() {
|
|
30964
|
+
auto result = make_unique<ShowSelectInfo>();
|
|
30965
|
+
result->types = types;
|
|
30966
|
+
result->query = query->Copy();
|
|
30967
|
+
result->aliases = aliases;
|
|
30968
|
+
result->is_summary = is_summary;
|
|
30969
|
+
return result;
|
|
30859
30970
|
}
|
|
30860
30971
|
};
|
|
30861
30972
|
|
|
@@ -30863,7 +30974,7 @@ protected:
|
|
|
30863
30974
|
//===----------------------------------------------------------------------===//
|
|
30864
30975
|
// DuckDB
|
|
30865
30976
|
//
|
|
30866
|
-
// duckdb/parser/tableref/
|
|
30977
|
+
// duckdb/parser/tableref/expressionlistref.hpp
|
|
30867
30978
|
//
|
|
30868
30979
|
//
|
|
30869
30980
|
//===----------------------------------------------------------------------===//
|
|
@@ -30873,16 +30984,21 @@ protected:
|
|
|
30873
30984
|
|
|
30874
30985
|
|
|
30875
30986
|
|
|
30987
|
+
|
|
30988
|
+
|
|
30876
30989
|
namespace duckdb {
|
|
30877
|
-
//! Represents a
|
|
30878
|
-
class
|
|
30990
|
+
//! Represents an expression list as generated by a VALUES statement
|
|
30991
|
+
class ExpressionListRef : public TableRef {
|
|
30879
30992
|
public:
|
|
30880
|
-
|
|
30993
|
+
ExpressionListRef() : TableRef(TableReferenceType::EXPRESSION_LIST) {
|
|
30994
|
+
}
|
|
30881
30995
|
|
|
30882
|
-
//!
|
|
30883
|
-
unique_ptr<
|
|
30884
|
-
//!
|
|
30885
|
-
vector<
|
|
30996
|
+
//! Value list, only used for VALUES statement
|
|
30997
|
+
vector<vector<unique_ptr<ParsedExpression>>> values;
|
|
30998
|
+
//! Expected SQL types
|
|
30999
|
+
vector<LogicalType> expected_types;
|
|
31000
|
+
//! The set of expected names
|
|
31001
|
+
vector<string> expected_names;
|
|
30886
31002
|
|
|
30887
31003
|
public:
|
|
30888
31004
|
string ToString() const override;
|
|
@@ -30890,9 +31006,9 @@ public:
|
|
|
30890
31006
|
|
|
30891
31007
|
unique_ptr<TableRef> Copy() override;
|
|
30892
31008
|
|
|
30893
|
-
//! Serializes a blob into a
|
|
31009
|
+
//! Serializes a blob into a ExpressionListRef
|
|
30894
31010
|
void Serialize(FieldWriter &serializer) const override;
|
|
30895
|
-
//! Deserializes a blob back into a
|
|
31011
|
+
//! Deserializes a blob back into a ExpressionListRef
|
|
30896
31012
|
static unique_ptr<TableRef> Deserialize(FieldReader &source);
|
|
30897
31013
|
};
|
|
30898
31014
|
} // namespace duckdb
|
|
@@ -30947,7 +31063,7 @@ public:
|
|
|
30947
31063
|
//===----------------------------------------------------------------------===//
|
|
30948
31064
|
// DuckDB
|
|
30949
31065
|
//
|
|
30950
|
-
// duckdb/parser/tableref/
|
|
31066
|
+
// duckdb/parser/tableref/subqueryref.hpp
|
|
30951
31067
|
//
|
|
30952
31068
|
//
|
|
30953
31069
|
//===----------------------------------------------------------------------===//
|
|
@@ -30957,41 +31073,33 @@ public:
|
|
|
30957
31073
|
|
|
30958
31074
|
|
|
30959
31075
|
|
|
30960
|
-
|
|
30961
|
-
|
|
30962
|
-
|
|
30963
31076
|
namespace duckdb {
|
|
30964
|
-
//! Represents a
|
|
30965
|
-
class
|
|
31077
|
+
//! Represents a subquery
|
|
31078
|
+
class SubqueryRef : public TableRef {
|
|
30966
31079
|
public:
|
|
30967
|
-
|
|
30968
|
-
|
|
30969
|
-
unique_ptr<ParsedExpression> function;
|
|
30970
|
-
vector<string> column_name_alias;
|
|
31080
|
+
explicit SubqueryRef(unique_ptr<SelectStatement> subquery, string alias = string());
|
|
30971
31081
|
|
|
30972
|
-
|
|
31082
|
+
//! The subquery
|
|
30973
31083
|
unique_ptr<SelectStatement> subquery;
|
|
30974
|
-
|
|
30975
|
-
|
|
30976
|
-
unique_ptr<ExternalDependency> external_dependency;
|
|
31084
|
+
//! Aliases for the column names
|
|
31085
|
+
vector<string> column_name_alias;
|
|
30977
31086
|
|
|
30978
31087
|
public:
|
|
30979
31088
|
string ToString() const override;
|
|
30980
|
-
|
|
30981
31089
|
bool Equals(const TableRef *other_p) const override;
|
|
30982
31090
|
|
|
30983
31091
|
unique_ptr<TableRef> Copy() override;
|
|
30984
31092
|
|
|
30985
|
-
//! Serializes a blob into a
|
|
31093
|
+
//! Serializes a blob into a SubqueryRef
|
|
30986
31094
|
void Serialize(FieldWriter &serializer) const override;
|
|
30987
|
-
//! Deserializes a blob back into a
|
|
31095
|
+
//! Deserializes a blob back into a SubqueryRef
|
|
30988
31096
|
static unique_ptr<TableRef> Deserialize(FieldReader &source);
|
|
30989
31097
|
};
|
|
30990
31098
|
} // namespace duckdb
|
|
30991
31099
|
//===----------------------------------------------------------------------===//
|
|
30992
31100
|
// DuckDB
|
|
30993
31101
|
//
|
|
30994
|
-
// duckdb/parser/tableref/
|
|
31102
|
+
// duckdb/parser/tableref/emptytableref.hpp
|
|
30995
31103
|
//
|
|
30996
31104
|
//
|
|
30997
31105
|
//===----------------------------------------------------------------------===//
|
|
@@ -31002,32 +31110,27 @@ public:
|
|
|
31002
31110
|
|
|
31003
31111
|
namespace duckdb {
|
|
31004
31112
|
//! Represents a cross product
|
|
31005
|
-
class
|
|
31113
|
+
class EmptyTableRef : public TableRef {
|
|
31006
31114
|
public:
|
|
31007
|
-
|
|
31115
|
+
EmptyTableRef() : TableRef(TableReferenceType::EMPTY) {
|
|
31008
31116
|
}
|
|
31009
31117
|
|
|
31010
|
-
//! The left hand side of the cross product
|
|
31011
|
-
unique_ptr<TableRef> left;
|
|
31012
|
-
//! The right hand side of the cross product
|
|
31013
|
-
unique_ptr<TableRef> right;
|
|
31014
|
-
|
|
31015
31118
|
public:
|
|
31016
31119
|
string ToString() const override;
|
|
31017
31120
|
bool Equals(const TableRef *other_p) const override;
|
|
31018
31121
|
|
|
31019
31122
|
unique_ptr<TableRef> Copy() override;
|
|
31020
31123
|
|
|
31021
|
-
//! Serializes a blob into a
|
|
31124
|
+
//! Serializes a blob into a DummyTableRef
|
|
31022
31125
|
void Serialize(FieldWriter &serializer) const override;
|
|
31023
|
-
//! Deserializes a blob back into a
|
|
31126
|
+
//! Deserializes a blob back into a DummyTableRef
|
|
31024
31127
|
static unique_ptr<TableRef> Deserialize(FieldReader &source);
|
|
31025
31128
|
};
|
|
31026
31129
|
} // namespace duckdb
|
|
31027
31130
|
//===----------------------------------------------------------------------===//
|
|
31028
31131
|
// DuckDB
|
|
31029
31132
|
//
|
|
31030
|
-
// duckdb/parser/tableref/
|
|
31133
|
+
// duckdb/parser/tableref/crossproductref.hpp
|
|
31031
31134
|
//
|
|
31032
31135
|
//
|
|
31033
31136
|
//===----------------------------------------------------------------------===//
|
|
@@ -31036,22 +31139,17 @@ public:
|
|
|
31036
31139
|
|
|
31037
31140
|
|
|
31038
31141
|
|
|
31039
|
-
|
|
31040
|
-
|
|
31041
|
-
|
|
31042
31142
|
namespace duckdb {
|
|
31043
|
-
//! Represents
|
|
31044
|
-
class
|
|
31143
|
+
//! Represents a cross product
|
|
31144
|
+
class CrossProductRef : public TableRef {
|
|
31045
31145
|
public:
|
|
31046
|
-
|
|
31146
|
+
CrossProductRef() : TableRef(TableReferenceType::CROSS_PRODUCT) {
|
|
31047
31147
|
}
|
|
31048
31148
|
|
|
31049
|
-
//!
|
|
31050
|
-
|
|
31051
|
-
//!
|
|
31052
|
-
|
|
31053
|
-
//! The set of expected names
|
|
31054
|
-
vector<string> expected_names;
|
|
31149
|
+
//! The left hand side of the cross product
|
|
31150
|
+
unique_ptr<TableRef> left;
|
|
31151
|
+
//! The right hand side of the cross product
|
|
31152
|
+
unique_ptr<TableRef> right;
|
|
31055
31153
|
|
|
31056
31154
|
public:
|
|
31057
31155
|
string ToString() const override;
|
|
@@ -31059,16 +31157,16 @@ public:
|
|
|
31059
31157
|
|
|
31060
31158
|
unique_ptr<TableRef> Copy() override;
|
|
31061
31159
|
|
|
31062
|
-
//! Serializes a blob into a
|
|
31160
|
+
//! Serializes a blob into a CrossProductRef
|
|
31063
31161
|
void Serialize(FieldWriter &serializer) const override;
|
|
31064
|
-
//! Deserializes a blob back into a
|
|
31162
|
+
//! Deserializes a blob back into a CrossProductRef
|
|
31065
31163
|
static unique_ptr<TableRef> Deserialize(FieldReader &source);
|
|
31066
31164
|
};
|
|
31067
31165
|
} // namespace duckdb
|
|
31068
31166
|
//===----------------------------------------------------------------------===//
|
|
31069
31167
|
// DuckDB
|
|
31070
31168
|
//
|
|
31071
|
-
// duckdb/parser/tableref/
|
|
31169
|
+
// duckdb/parser/tableref/table_function_ref.hpp
|
|
31072
31170
|
//
|
|
31073
31171
|
//
|
|
31074
31172
|
//===----------------------------------------------------------------------===//
|
|
@@ -31077,22 +31175,35 @@ public:
|
|
|
31077
31175
|
|
|
31078
31176
|
|
|
31079
31177
|
|
|
31178
|
+
|
|
31179
|
+
|
|
31180
|
+
|
|
31181
|
+
|
|
31080
31182
|
namespace duckdb {
|
|
31081
|
-
//! Represents a
|
|
31082
|
-
class
|
|
31183
|
+
//! Represents a Table producing function
|
|
31184
|
+
class TableFunctionRef : public TableRef {
|
|
31083
31185
|
public:
|
|
31084
|
-
|
|
31085
|
-
|
|
31186
|
+
DUCKDB_API TableFunctionRef();
|
|
31187
|
+
|
|
31188
|
+
unique_ptr<ParsedExpression> function;
|
|
31189
|
+
vector<string> column_name_alias;
|
|
31190
|
+
|
|
31191
|
+
// if the function takes a subquery as argument its in here
|
|
31192
|
+
unique_ptr<SelectStatement> subquery;
|
|
31193
|
+
|
|
31194
|
+
// External dependencies of this table funcion
|
|
31195
|
+
unique_ptr<ExternalDependency> external_dependency;
|
|
31086
31196
|
|
|
31087
31197
|
public:
|
|
31088
31198
|
string ToString() const override;
|
|
31199
|
+
|
|
31089
31200
|
bool Equals(const TableRef *other_p) const override;
|
|
31090
31201
|
|
|
31091
31202
|
unique_ptr<TableRef> Copy() override;
|
|
31092
31203
|
|
|
31093
|
-
//! Serializes a blob into a
|
|
31204
|
+
//! Serializes a blob into a BaseTableRef
|
|
31094
31205
|
void Serialize(FieldWriter &serializer) const override;
|
|
31095
|
-
//! Deserializes a blob back into a
|
|
31206
|
+
//! Deserializes a blob back into a BaseTableRef
|
|
31096
31207
|
static unique_ptr<TableRef> Deserialize(FieldReader &source);
|
|
31097
31208
|
};
|
|
31098
31209
|
} // namespace duckdb
|